Changes in / [e9d74be:3159e27]


Ignore:
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • aim.c

    r2770be99 re4524da  
    18121812  GPollFD *fd;
    18131813  int i;
    1814   if (len < event_source->fds->len) {
     1814  if (len < event_source->fds->len)
    18151815    owl_function_debugmsg("Truncating AIM PollFDs to %d, was %d", len, event_source->fds->len);
    1816     for (i = len; i < event_source->fds->len; i++) {
    1817       fd = event_source->fds->pdata[i];
    1818       g_source_remove_poll(&event_source->source, fd);
    1819       g_free(fd);
    1820     }
    1821     g_ptr_array_remove_range(event_source->fds, len, event_source->fds->len - len);
    1822   }
     1816  for (i = len; i < event_source->fds->len; i++) {
     1817    fd = event_source->fds->pdata[i];
     1818    g_source_remove_poll(&event_source->source, fd);
     1819    g_free(fd);
     1820  }
     1821  g_ptr_array_remove_range(event_source->fds, len, event_source->fds->len - len);
    18231822}
    18241823
     
    18911890{
    18921891  owl_aim_event_source *event_source = (owl_aim_event_source*)source;
    1893   /* Don't remove the GPollFDs. We are being finalized, so they'll be removed
    1894    * for us. Moreover, glib will fire asserts if g_source_remove_poll is called
    1895    * on a source which has been destroyed (which occurs when g_source_remove is
    1896    * called on it). */
    1897   owl_ptr_array_free(event_source->fds, g_free);
     1892  truncate_pollfd_list(event_source, 0);
     1893  g_ptr_array_free(event_source->fds, TRUE);
    18981894}
    18991895
  • barnowl

    rf5f6ec0 rb14f8cb  
    88
    99if test ! -x "$EXE"; then
    10     echo "Cannot find $EXE" >&2
     10    echo "Cannot find barnowl.bin" >&2
    1111    exit 1
    1212fi
  • functions.c

    r99ac28a refeec7f  
    410410  old_msg = g_strdup(owl_zwrite_get_message(z));
    411411
    412   zcrypt = g_build_filename(owl_get_bindir(), "zcrypt", NULL);
     412  zcrypt = g_strdup_printf("%s/zcrypt", owl_get_bindir());
    413413  argv[0] = "zcrypt";
    414414  argv[1] = "-E";
     
    32263226      } else if (myargc > 0) {
    32273227        /* Spawn the child. */
    3228         GPid pid;
     3228        pid_t pid;
    32293229        GError *error = NULL;
    32303230        owl_function_debugmsg("About to exec \"%s\" with %d arguments", argv[0], myargc);
  • global.c

    rdde1b4d r2560529  
    5353  g->resizepending=0;
    5454  g->direction=OWL_DIRECTION_DOWNWARDS;
     55  g->zaway=0;
    5556  owl_fmtext_init_colorpair_mgr(&(g->cpmgr));
    5657  g->debug=OWL_DEBUG;
     
    7778  g->confdir = NULL;
    7879  g->startupfile = NULL;
    79   cd = g_build_filename(g->homedir, OWL_CONFIG_DIR, NULL);
     80  cd = g_strdup_printf("%s/%s", g->homedir, OWL_CONFIG_DIR);
    8081  owl_global_set_confdir(g, cd);
    8182  g_free(cd);
     
    364365  g->confdir = g_strdup(cd);
    365366  g_free(g->startupfile);
    366   g->startupfile = g_build_filename(cd, "startup", NULL);
     367  g->startupfile = g_strdup_printf("%s/startup", cd);
    367368}
    368369
  • help.c

    r820e852 ra16d7e5  
    6666     "\n"
    6767     "    l             Print a zephyr/AIM buddy listing\n"
    68      "    A             Toggle away\n"
     68     "    A             Toggle zaway\n"
    6969     "    o             Toggle one-line display mode\n"
    7070     "    w             Open a URL in the current message\n"
  • logging.c

    rdde1b4d r6829afc  
    224224    while (cc != NULL) {
    225225      temp = short_zuser(cc->data);
    226       filename = g_build_filename(logpath, temp, NULL);
     226      filename = g_strdup_printf("%s/%s", logpath, temp);
    227227      owl_log_append(m, filename);
    228228
     
    248248  }
    249249
    250   filename = g_build_filename(logpath, to, NULL);
     250  filename = g_strdup_printf("%s/%s", logpath, to);
    251251  owl_log_append(m, filename);
    252252  g_free(to);
    253253  g_free(filename);
    254254
    255   filename = g_build_filename(logpath, "all", NULL);
     255  filename = g_strdup_printf("%s/all", logpath);
    256256  owl_log_append(m, filename);
    257257  g_free(logpath);
     
    285285  /* expand ~ in path names */
    286286  logpath = owl_util_makepath(owl_global_get_logpath(&g));
    287   filename = g_build_filename(logpath, tobuff, NULL);
     287  filename = g_strdup_printf("%s/%s", logpath, tobuff);
    288288  msgbuf = g_string_new("");
    289289  g_string_printf(msgbuf, "ERROR (owl): %s\n%s\n", tobuff, text);
     
    294294  g_string_free(msgbuf, TRUE);
    295295
    296   filename = g_build_filename(logpath, "all", NULL);
     296  filename = g_strdup_printf("%s/all", logpath);
    297297  g_free(logpath);
    298298  msgbuf = g_string_new("");
     
    393393  if (personal) {
    394394    logpath = owl_util_makepath(owl_global_get_logpath(&g));
    395     filename = g_build_filename(logpath, from, NULL);
    396     allfilename = g_build_filename(logpath, "all", NULL);
     395    filename = g_strdup_printf("%s/%s", logpath, from);
     396    allfilename = g_strdup_printf("%s/all", logpath);
    397397    owl_log_append(m, allfilename);
    398398    g_free(allfilename);
    399399  } else {
    400400    logpath = owl_util_makepath(owl_global_get_classlogpath(&g));
    401     filename = g_build_filename(logpath, from, NULL);
     401    filename = g_strdup_printf("%s/%s", logpath, from);
    402402  }
    403403
     
    415415      temp = short_zuser(cc->data);
    416416      if (strcasecmp(temp, frombuff) != 0) {
    417         filename = g_build_filename(logpath, temp, NULL);
     417        filename = g_strdup_printf("%s/%s", logpath, temp);
    418418        owl_log_append(m, filename);
    419419        g_free(filename);
  • message.c

    rdde1b4d rf9df2f0  
    884884    char *zcrypt;
    885885
    886     zcrypt = g_build_filename(owl_get_bindir(), "zcrypt", NULL);
     886    zcrypt = g_strdup_printf("%s/zcrypt", owl_get_bindir());
    887887
    888888    rv = call_filter(zcrypt, argv, owl_message_get_body(m), &out, &status);
  • owl.h

    r16cf182d r2560529  
    556556  char *startupfile;
    557557  int direction;
     558  int zaway;
     559  char *cur_zaway_msg;
    558560  int haveconfig;
    559561  int config_format;
  • perlconfig.c

    rdde1b4d rce68f23  
    406406  /* Add the system lib path to @INC */
    407407  inc = get_av("INC", 0);
    408   path = g_build_filename(owl_get_datadir(), "lib", NULL);
     408  path = g_strdup_printf("%s/lib", owl_get_datadir());
    409409  av_unshift(inc, 1);
    410410  av_store(inc, 0, owl_new_sv(path));
  • runtests.sh

    rf6ab6ee r786a410  
    11#!/bin/sh
    2 exec env HARNESS_PERL=./tester prove --failures t/
     2SRCDIR=`dirname "${0}"`
     3
     4export BARNOWL_DATA_DIR="$SRCDIR/perl/"
     5export BARNOWL_BIN_DIR="$SRCDIR/"
     6
     7HARNESS_PERL=./tester exec prove --failures t/
  • scripts/locker-build

    r055e366 r401752a  
    8585    BARNOWL="/afs/sipb.mit.edu/project/barnowl/arch/$ATHENA_SYS"
    8686    export PKG_CONFIG_PATH="$BARNOWL/lib/pkgconfig"
    87     eval $("$BARNOWL/bin/barnowl-perl-config")
    8887
    8988    SUFFIX=
  • t/completion.t

    re59d775 r3001c11  
    323323}
    324324
    325 mkpath(["$tmpdir/.owl/",
    326         "$tmpdir/.owl/modules/",
    327         "$tmpdir/Public/",
    328         "$tmpdir/Private/",
    329         "$tmpdir/.ours",
    330         "$tmpdir/www"],
    331        0, 0700);
     325mkpath("$tmpdir/.owl/",
     326       "$tmpdir/.owl/modules/",
     327       "$tmpdir/Public/",
     328       "$tmpdir/Private/",
     329       "$tmpdir/.ours",
     330       "$tmpdir/www",
     331     {mode => 0700});
    332332touch("$tmpdir/.zephyr.subs");
    333333touch("$tmpdir/wheee");
  • t/unicode.t

    rf415f83 r09ff1eb  
    55use Encode;
    66
     7BEGIN { bootstrap BarnOwl; };
     8
    79use Test::More qw(no_plan);
    8 
    9 use BarnOwl;
    1010
    1111my $unicode = "“hello”";
  • tester.c

    r0ba7333 r14c9e05  
    44#undef WINDOW
    55
     6#include <errno.h>
    67#include <unistd.h>
     8#include <pwd.h>
    79#include <stdio.h>
    810#include <stdlib.h>
    911#include <string.h>
     12#include <sys/types.h>
    1013
    1114#undef instr
     
    133136{
    134137  int numfailed=0;
    135   char *s, *path, *home;
     138  const char *home;
     139  char *s, *path;
     140  struct passwd *pw;
    136141
    137142  printf("# BEGIN testing owl_util\n");
     
    222227                "\"");
    223228
    224   GString *quoted = g_string_new("");
    225   owl_string_appendf_quoted(quoted, "%q foo %q%q %s %", "hello", "world is", "can't");
     229  GString *g = g_string_new("");
     230  owl_string_appendf_quoted(g, "%q foo %q%q %s %", "hello", "world is", "can't");
    226231  FAIL_UNLESS("owl_string_appendf",
    227               !strcmp(quoted->str, "hello foo 'world is'\"can't\" %s %"));
    228   g_string_free(quoted, true);
     232              !strcmp(g->str, "hello foo 'world is'\"can't\" %s %"));
     233  g_string_free(g, true);
    229234
    230235
     
    269274  g_free(s);
    270275
    271   home = g_strdup(owl_global_get_homedir(&g));
     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  }
    272285  s = owl_util_makepath("~");
    273286  FAIL_UNLESS("makepath ~", !strcmp(home, s));
    274287  g_free(s);
    275288
    276   path = g_build_filename(home, "foo/bar/baz", NULL);
     289  path = g_strconcat(home, "/foo/bar/baz", NULL);
    277290  s = owl_util_makepath("~///foo/bar//baz");
    278291  FAIL_UNLESS("makepath ~///foo/bar//baz", !strcmp(path, s));
    279292  g_free(s);
    280293  g_free(path);
    281   g_free(home);
    282 
    283   home = owl_util_homedir_for_user("root");
    284   if (home == NULL) {
     294
     295  errno = 0;
     296  pw = getpwnam("root");
     297  if (pw) {
     298    home = pw->pw_dir;
     299  } else {
    285300    /* Just make some noise so we notice. */
    286     home = g_strdup("<WHAT>");
    287     fprintf(stderr, "owl_util_homedir_for_user failed");
     301    home = "<WHAT>";
     302    fprintf(stderr, "getpwnam: %s", errno ? strerror(errno) : "No such user");
    288303  }
    289304
     
    292307  g_free(s);
    293308
    294   path = g_build_filename(home, "foo/bar/baz", NULL);
     309  path = g_strconcat(home, "/foo/bar/baz", NULL);
    295310  s = owl_util_makepath("~root///foo/bar//baz");
    296311  FAIL_UNLESS("makepath ~root///foo/bar//baz", !strcmp(path, s));
    297312  g_free(s);
    298313  g_free(path);
    299   g_free(home);
    300314
    301315  /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */
  • util.c

    r8219374 rc0c48d14  
    3232}
    3333
    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 
    5934/* Return a "nice" version of the path.  Tilde expansion is done, and
    6035 * duplicate slashes are removed.  Caller must free the return.
     
    6742    /* Attempt tilde-expansion of the first component. Get the
    6843       tilde-prefix, which goes up to the next slash. */
     44    struct passwd *pw;
    6945    const char *end = strchr(in + 1, '/');
    7046    if (end == NULL)
    7147      end = in + strlen(in);
    7248
    73     /* Patch together a new path. Replace the ~ and tilde-prefix with
    74        the homedir, if available. */
    7549    if (end == in + 1) {
    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);
     50      /* My home directory. */
     51      pw = getpwuid(getuid());
    7952    } else {
    8053      /* Someone else's home directory. */
    8154      char *user = g_strndup(in + 1, end - (in + 1));
    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);
     55      pw = getpwnam(user);
    8956      g_free(user);
    9057    }
     58
     59    /* Patch together a new path. Replace the ~ and tilde-prefix with
     60       the homedir. */
     61    if (pw) {
     62      out = g_strconcat(pw->pw_dir, end, NULL);
     63    } else {
     64      out = g_strdup(in);
     65    }
    9166  } else {
    92     out = g_strdup(in);
     67      out = g_strdup(in);
    9368  }
    9469
     
    413388    if (!g_path_is_absolute(link_path)) {
    414389      char *last_dir = g_path_get_dirname(last_path);
    415       char *tmp = g_build_filename(last_dir, link_path, NULL);
     390      char *tmp = g_build_path(G_DIR_SEPARATOR_S,
     391                               last_dir,
     392                               link_path,
     393                               NULL);
    416394      g_free(last_dir);
    417395      g_free(link_path);
  • variable.c

    r30d0cf7 ra16d7e5  
    161161               "Enable logging of login notifications",
    162162               "When this is enabled, BarnOwl will log login and logout notifications\n"
    163                "for AIM, zephyr, or other protocols.  If disabled BarnOwl will not print\n"
     163               "for AIM, zephyr, or other protocols.  If disabled Owl will not print\n"
    164164               "login or logout notifications.\n"),
    165165
  • zcrypt.c

    rc6332f5 r6829afc  
    411411  int length[MAX_SEARCH], i;
    412412  char buffer[MAX_BUFF];
    413   const char *home;
    414413  char *filename;
    415414  char result[MAX_SEARCH][MAX_BUFF];
     
    434433
    435434  /* Open~/.crypt-table */
    436   home = getenv("HOME");
    437   if (home == NULL)
    438     home = g_get_home_dir();
    439   filename = g_build_filename(home, ".crypt-table", NULL);
     435  filename = g_strdup_printf("%s/.crypt-table", getenv("HOME"));
    440436  fsearch = fopen(filename, "r");
    441437  if (fsearch)
  • zephyr.c

    rc855755 recffae6  
    3838    return g_strdup(input);
    3939  else
    40     return g_build_filename(owl_global_get_homedir(&g), name, NULL);
     40    return g_strdup_printf("%s/%s", owl_global_get_homedir(&g), name);
    4141}
    4242
     
    12311231    return -1;
    12321232  ret = ZSetLocation(zstr(exposure));
    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      ) {
     1233  if (ret != ZERR_NONE) {
    12421234    owl_function_error("Unable to set exposure level: %s.", error_message(ret));
    12431235    return -1;
Note: See TracChangeset for help on using the changeset viewer.