Changeset 117a955
- Timestamp:
- Jul 16, 2011, 1:08:39 AM (13 years ago)
- Parents:
- b711711 (diff), 05725694 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
README
r9179fd7 rb711711 7 7 Notes: 8 8 ----- 9 This project's perl/ lib/ contains the lib directories from the9 This project's perl/modules/ contains the lib directories from the 10 10 following CPAN modules: 11 11 … … 19 19 20 20 AnyEvent 21 Class::Accessor 21 22 Glib 22 23 PAR 23 Net::DNS24 Authen::SASL::Perl25 IO::Socket::SSL26 Digest::SHA127 24 28 25 (Note that these are all available as Debian packages) … … 33 30 34 31 AnyEvent::IRC 35 Class::Accessor 32 33 The Jabber module requires: 34 35 Net::DNS 36 Authen::SASL::Perl 37 IO::Socket::SSL 38 Digest::SHA1 39 40 The Twitter module requires: 41 42 HTML::Entities 43 Net::Twitter::Lite 36 44 37 45 The WordWrap module requires: -
barnowl
rb14f8cb rf5f6ec0 8 8 9 9 if test ! -x "$EXE"; then 10 echo "Cannot find barnowl.bin" >&210 echo "Cannot find $EXE" >&2 11 11 exit 1 12 12 fi -
configure.ac
rf2a96c0 r0de04fa 109 109 AC_CHECK_LIB([perl], [perl_alloc],, AC_MSG_ERROR([No libperl found])) 110 110 111 AX_PROG_PERL_MODULES([AnyEvent],, 112 [AC_MSG_ERROR([cannot find perl module AnyEvent.])]) 111 113 AX_PROG_PERL_MODULES([Class::Accessor::Fast],, 112 114 [AC_MSG_ERROR([cannot find perl module Class::Accessor::Fast.])]) 115 AX_PROG_PERL_MODULES([Glib],, 116 [AC_MSG_ERROR([cannot find perl module Glib.])]) 113 117 AX_PROG_PERL_MODULES([PAR],, 114 118 [AC_MSG_WARN([PAR.pm not found. Loadable modules will be disabled.])]) -
functions.c
refeec7f r99ac28a 410 410 old_msg = g_strdup(owl_zwrite_get_message(z)); 411 411 412 zcrypt = g_ strdup_printf("%s/zcrypt", owl_get_bindir());412 zcrypt = g_build_filename(owl_get_bindir(), "zcrypt", NULL); 413 413 argv[0] = "zcrypt"; 414 414 argv[1] = "-E"; … … 3226 3226 } else if (myargc > 0) { 3227 3227 /* Spawn the child. */ 3228 pid_tpid;3228 GPid pid; 3229 3229 GError *error = NULL; 3230 3230 owl_function_debugmsg("About to exec \"%s\" with %d arguments", argv[0], myargc); -
global.c
r16cf182d rdde1b4d 77 77 g->confdir = NULL; 78 78 g->startupfile = NULL; 79 cd = g_ strdup_printf("%s/%s", g->homedir, OWL_CONFIG_DIR);79 cd = g_build_filename(g->homedir, OWL_CONFIG_DIR, NULL); 80 80 owl_global_set_confdir(g, cd); 81 81 g_free(cd); … … 364 364 g->confdir = g_strdup(cd); 365 365 g_free(g->startupfile); 366 g->startupfile = g_ strdup_printf("%s/startup", cd);366 g->startupfile = g_build_filename(cd, "startup", NULL); 367 367 } 368 368 -
logging.c
r6829afc rdde1b4d 224 224 while (cc != NULL) { 225 225 temp = short_zuser(cc->data); 226 filename = g_ strdup_printf("%s/%s", logpath, temp);226 filename = g_build_filename(logpath, temp, NULL); 227 227 owl_log_append(m, filename); 228 228 … … 248 248 } 249 249 250 filename = g_ strdup_printf("%s/%s", logpath, to);250 filename = g_build_filename(logpath, to, NULL); 251 251 owl_log_append(m, filename); 252 252 g_free(to); 253 253 g_free(filename); 254 254 255 filename = g_ strdup_printf("%s/all", logpath);255 filename = g_build_filename(logpath, "all", NULL); 256 256 owl_log_append(m, filename); 257 257 g_free(logpath); … … 285 285 /* expand ~ in path names */ 286 286 logpath = owl_util_makepath(owl_global_get_logpath(&g)); 287 filename = g_ strdup_printf("%s/%s", logpath, tobuff);287 filename = g_build_filename(logpath, tobuff, NULL); 288 288 msgbuf = g_string_new(""); 289 289 g_string_printf(msgbuf, "ERROR (owl): %s\n%s\n", tobuff, text); … … 294 294 g_string_free(msgbuf, TRUE); 295 295 296 filename = g_ strdup_printf("%s/all", logpath);296 filename = g_build_filename(logpath, "all", NULL); 297 297 g_free(logpath); 298 298 msgbuf = g_string_new(""); … … 393 393 if (personal) { 394 394 logpath = owl_util_makepath(owl_global_get_logpath(&g)); 395 filename = g_ strdup_printf("%s/%s", logpath, from);396 allfilename = g_ strdup_printf("%s/all", logpath);395 filename = g_build_filename(logpath, from, NULL); 396 allfilename = g_build_filename(logpath, "all", NULL); 397 397 owl_log_append(m, allfilename); 398 398 g_free(allfilename); 399 399 } else { 400 400 logpath = owl_util_makepath(owl_global_get_classlogpath(&g)); 401 filename = g_ strdup_printf("%s/%s", logpath, from);401 filename = g_build_filename(logpath, from, NULL); 402 402 } 403 403 … … 415 415 temp = short_zuser(cc->data); 416 416 if (strcasecmp(temp, frombuff) != 0) { 417 filename = g_ strdup_printf("%s/%s", logpath, temp);417 filename = g_build_filename(logpath, temp, NULL); 418 418 owl_log_append(m, filename); 419 419 g_free(filename); -
message.c
rf9df2f0 rdde1b4d 884 884 char *zcrypt; 885 885 886 zcrypt = g_ strdup_printf("%s/zcrypt", owl_get_bindir());886 zcrypt = g_build_filename(owl_get_bindir(), "zcrypt", NULL); 887 887 888 888 rv = call_filter(zcrypt, argv, owl_message_get_body(m), &out, &status); -
perlconfig.c
rce68f23 rdde1b4d 406 406 /* Add the system lib path to @INC */ 407 407 inc = get_av("INC", 0); 408 path = g_ strdup_printf("%s/lib", owl_get_datadir());408 path = g_build_filename(owl_get_datadir(), "lib", NULL); 409 409 av_unshift(inc, 1); 410 410 av_store(inc, 0, owl_new_sv(path)); -
runtests.sh
r786a410 rf6ab6ee 1 1 #!/bin/sh 2 SRCDIR=`dirname "${0}"` 3 4 export BARNOWL_DATA_DIR="$SRCDIR/perl/" 5 export BARNOWL_BIN_DIR="$SRCDIR/" 6 7 HARNESS_PERL=./tester exec prove --failures t/ 2 exec env HARNESS_PERL=./tester prove --failures t/ -
scripts/locker-build
r401752a r055e366 85 85 BARNOWL="/afs/sipb.mit.edu/project/barnowl/arch/$ATHENA_SYS" 86 86 export PKG_CONFIG_PATH="$BARNOWL/lib/pkgconfig" 87 eval $("$BARNOWL/bin/barnowl-perl-config") 87 88 88 89 SUFFIX= -
t/completion.t
r3001c11 re59d775 323 323 } 324 324 325 mkpath( "$tmpdir/.owl/",326 "$tmpdir/.owl/modules/",327 "$tmpdir/Public/",328 "$tmpdir/Private/",329 "$tmpdir/.ours",330 "$tmpdir/www",331 {mode => 0700});325 mkpath(["$tmpdir/.owl/", 326 "$tmpdir/.owl/modules/", 327 "$tmpdir/Public/", 328 "$tmpdir/Private/", 329 "$tmpdir/.ours", 330 "$tmpdir/www"], 331 0, 0700); 332 332 touch("$tmpdir/.zephyr.subs"); 333 333 touch("$tmpdir/wheee"); -
t/unicode.t
r09ff1eb rf415f83 5 5 use Encode; 6 6 7 BEGIN { bootstrap BarnOwl; };7 use Test::More qw(no_plan); 8 8 9 use Test::More qw(no_plan);9 use BarnOwl; 10 10 11 11 my $unicode = "“hello”"; -
tester.c
r14c9e05 r0ba7333 4 4 #undef WINDOW 5 5 6 #include <errno.h>7 6 #include <unistd.h> 8 #include <pwd.h>9 7 #include <stdio.h> 10 8 #include <stdlib.h> 11 9 #include <string.h> 12 #include <sys/types.h>13 10 14 11 #undef instr … … 136 133 { 137 134 int numfailed=0; 138 const char *home; 139 char *s, *path; 140 struct passwd *pw; 135 char *s, *path, *home; 141 136 142 137 printf("# BEGIN testing owl_util\n"); … … 227 222 "\""); 228 223 229 GString * g= g_string_new("");230 owl_string_appendf_quoted( g, "%q foo %q%q %s %", "hello", "world is", "can't");224 GString *quoted = g_string_new(""); 225 owl_string_appendf_quoted(quoted, "%q foo %q%q %s %", "hello", "world is", "can't"); 231 226 FAIL_UNLESS("owl_string_appendf", 232 !strcmp( g->str, "hello foo 'world is'\"can't\" %s %"));233 g_string_free( g, true);227 !strcmp(quoted->str, "hello foo 'world is'\"can't\" %s %")); 228 g_string_free(quoted, true); 234 229 235 230 … … 274 269 g_free(s); 275 270 276 errno = 0; 277 pw = getpwuid(getuid()); 278 if (pw) { 279 home = pw->pw_dir; 280 } else { 281 /* Just make some noise so we notice. */ 282 home = "<WHAT>"; 283 fprintf(stderr, "getpwuid: %s", errno ? strerror(errno) : "No such user"); 284 } 271 home = g_strdup(owl_global_get_homedir(&g)); 285 272 s = owl_util_makepath("~"); 286 273 FAIL_UNLESS("makepath ~", !strcmp(home, s)); 287 274 g_free(s); 288 275 289 path = g_ strconcat(home, "/foo/bar/baz", NULL);276 path = g_build_filename(home, "foo/bar/baz", NULL); 290 277 s = owl_util_makepath("~///foo/bar//baz"); 291 278 FAIL_UNLESS("makepath ~///foo/bar//baz", !strcmp(path, s)); 292 279 g_free(s); 293 280 g_free(path); 294 295 errno = 0; 296 pw = getpwnam("root"); 297 if (pw) { 298 home = pw->pw_dir; 299 } else { 281 g_free(home); 282 283 home = owl_util_homedir_for_user("root"); 284 if (home == NULL) { 300 285 /* Just make some noise so we notice. */ 301 home = "<WHAT>";302 fprintf(stderr, " getpwnam: %s", errno ? strerror(errno) : "No such user");286 home = g_strdup("<WHAT>"); 287 fprintf(stderr, "owl_util_homedir_for_user failed"); 303 288 } 304 289 … … 307 292 g_free(s); 308 293 309 path = g_ strconcat(home, "/foo/bar/baz", NULL);294 path = g_build_filename(home, "foo/bar/baz", NULL); 310 295 s = owl_util_makepath("~root///foo/bar//baz"); 311 296 FAIL_UNLESS("makepath ~root///foo/bar//baz", !strcmp(path, s)); 312 297 g_free(s); 313 298 g_free(path); 299 g_free(home); 314 300 315 301 /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */ -
util.c
rc0c48d14 r8219374 32 32 } 33 33 34 CALLER_OWN char *owl_util_homedir_for_user(const char *name) 35 { 36 int err; 37 struct passwd pw_buf; 38 struct passwd *pw; 39 40 char *pw_strbuf, *ret; 41 long pw_strbuf_len = sysconf(_SC_GETPW_R_SIZE_MAX); 42 if (pw_strbuf_len < 0) { 43 /* If we really hate ourselves, we can be fancy and loop until we stop 44 * getting ERANGE. For now just pick a random number. */ 45 owl_function_error("owl_util_homedir_for_user: Could not get _SC_GETPW_R_SIZE_MAX"); 46 pw_strbuf_len = 16384; 47 } 48 pw_strbuf = g_new0(char, pw_strbuf_len); 49 err = getpwnam_r(name, &pw_buf, pw_strbuf, pw_strbuf_len, &pw); 50 if (err) { 51 owl_function_error("getpwuid_r: %s", strerror(err)); 52 /* Fall through; pw will be NULL. */ 53 } 54 ret = pw ? g_strdup(pw->pw_dir) : NULL; 55 g_free(pw_strbuf); 56 return ret; 57 } 58 34 59 /* Return a "nice" version of the path. Tilde expansion is done, and 35 60 * duplicate slashes are removed. Caller must free the return. … … 42 67 /* Attempt tilde-expansion of the first component. Get the 43 68 tilde-prefix, which goes up to the next slash. */ 44 struct passwd *pw;45 69 const char *end = strchr(in + 1, '/'); 46 70 if (end == NULL) 47 71 end = in + strlen(in); 48 72 73 /* Patch together a new path. Replace the ~ and tilde-prefix with 74 the homedir, if available. */ 49 75 if (end == in + 1) { 50 /* My home directory. */ 51 pw = getpwuid(getuid()); 76 /* My home directory. Use the one in owl_global for consistency with 77 * owl_zephyr_dotfile. */ 78 out = g_strconcat(owl_global_get_homedir(&g), end, NULL); 52 79 } else { 53 80 /* Someone else's home directory. */ 54 81 char *user = g_strndup(in + 1, end - (in + 1)); 55 pw = getpwnam(user); 82 char *home = owl_util_homedir_for_user(user); 83 if (home) { 84 out = g_strconcat(home, end, NULL); 85 } else { 86 out = g_strdup(in); 87 } 88 g_free(home); 56 89 g_free(user); 57 90 } 58 59 /* Patch together a new path. Replace the ~ and tilde-prefix with60 the homedir. */61 if (pw) {62 out = g_strconcat(pw->pw_dir, end, NULL);63 } else {64 out = g_strdup(in);65 }66 91 } else { 67 92 out = g_strdup(in); 68 93 } 69 94 … … 388 413 if (!g_path_is_absolute(link_path)) { 389 414 char *last_dir = g_path_get_dirname(last_path); 390 char *tmp = g_build_path(G_DIR_SEPARATOR_S, 391 last_dir, 392 link_path, 393 NULL); 415 char *tmp = g_build_filename(last_dir, link_path, NULL); 394 416 g_free(last_dir); 395 417 g_free(link_path); -
variable.c
ra16d7e5 r30d0cf7 161 161 "Enable logging of login notifications", 162 162 "When this is enabled, BarnOwl will log login and logout notifications\n" 163 "for AIM, zephyr, or other protocols. If disabled Owl will not print\n"163 "for AIM, zephyr, or other protocols. If disabled BarnOwl will not print\n" 164 164 "login or logout notifications.\n"), 165 165 -
zcrypt.c
r6829afc rc6332f5 411 411 int length[MAX_SEARCH], i; 412 412 char buffer[MAX_BUFF]; 413 const char *home; 413 414 char *filename; 414 415 char result[MAX_SEARCH][MAX_BUFF]; … … 433 434 434 435 /* Open~/.crypt-table */ 435 filename = g_strdup_printf("%s/.crypt-table", getenv("HOME")); 436 home = getenv("HOME"); 437 if (home == NULL) 438 home = g_get_home_dir(); 439 filename = g_build_filename(home, ".crypt-table", NULL); 436 440 fsearch = fopen(filename, "r"); 437 441 if (fsearch) -
zephyr.c
recffae6 rc855755 38 38 return g_strdup(input); 39 39 else 40 return g_ strdup_printf("%s/%s", owl_global_get_homedir(&g), name);40 return g_build_filename(owl_global_get_homedir(&g), name, NULL); 41 41 } 42 42 … … 1231 1231 return -1; 1232 1232 ret = ZSetLocation(zstr(exposure)); 1233 if (ret != ZERR_NONE) { 1233 if (ret != ZERR_NONE 1234 #ifdef ZCONST 1235 /* Before zephyr 3.0, ZSetLocation had a bug where, if you were subscribed 1236 * to your own logins, it could wait for the wrong notice and return 1237 * ZERR_INTERNAL when found neither SERVACK nor SERVNAK. Suppress it when 1238 * building against the old ABI. */ 1239 && ret != ZERR_INTERNAL 1240 #endif 1241 ) { 1234 1242 owl_function_error("Unable to set exposure level: %s.", error_message(ret)); 1235 1243 return -1;
Note: See TracChangeset
for help on using the changeset viewer.