Changeset 7e9fa84


Ignore:
Timestamp:
Jul 24, 2011, 2:26:09 PM (13 years ago)
Author:
GitHub Merge Button <merge-button@github.com>
Parents:
3234121 (diff), 14c15d9 (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.
Message:
Merge 14c15d942910b33590fc67229a029540a97eb9ac into 323412185513364eaef94cf3f6cbb70957d93c5f
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • fmtext.c

    rd8f22b6 r7e9fa84  
    186186static void _owl_fmtext_wcolor_set(WINDOW *w, short pair)
    187187{
     188  cchar_t background;
     189  wchar_t blank[2];
    188190  if (has_colors()) {
    189       wcolor_set(w,pair,NULL);
    190       wbkgdset(w, COLOR_PAIR(pair));
     191      wcolor_set(w, pair, NULL);
     192      /* Set the background with wbkgrndset so that we can handle color-pairs
     193       * past 256 on ncurses ABI 6 and later. */
     194      blank[0] = ' ';
     195      blank[1] = 0;
     196      setcchar(&background, blank, 0, pair, NULL);
     197      wbkgrndset(w, &background);
    191198  }
    192199}
  • ChangeLog

    r2ff0693 r65ff3f4  
     11.8
     2 * Compute the home directory in zcrypt consistently with BarnOwl -davidben@mit.edu
     3 * Make help show the correct keybinding for A -jgross@mit.edu
     4 * Add a delete-and-expunge command. -jgross@mit.edu
     5 * Fix a bug in the expunge command -jgross@mit.edu
     6 * Replace 'Owl' with 'BarnOwl' in user visible places -jgross@mit.edu
     7 * Allow zsigs to be '0' -jgross@mit.edu
     8 * Reformat the man page to look more like others -davidben@mit.edu
     9 * Consistently use BarnOwl or barnowl -davidben@mit.edu
     10 * Update autoconf macros -andersk@mit.edu
     11 * history: Do not deduplicate a partial entry -andersk@mit.edu
     12 * Drop show timers feature -davidben@mit.edu
     13 * Add new dependencies, AnyEvent and perl-Glib -davidben@mit.edu
     14 * Bump required glib version to 2.16 -davidben@mit.edu
     15 * Don't leak timestr when setting time in a perl message -asedeno@mit.edu
     16 * Build with -Wwrite-strings -andersk@mit.edu
     17 * Build with C99 -davidben@mit.edu
     18 * Jabber: Handle nicks with leading dashes (e.g. Facebook XMPP) -ezyang@mit.edu
     19 * Move log-writing onto a background thread. -adam@crossproduct.net
     20 * Remove the length limit on field values in :info -jgross@mit.edu
     21 * Show how far you are in a long message -jgross@mit.edu
     22 * stderr_redirect_handler: Handle partial or failed reads -andersk@mit.edu
     23 * Inform the user when an unpunt command does nothing -davidben@mit.edu
     24 * Replace custom event loop with GLib's GMainLoop -davidben@mit.edu
     25 * Encode glib version requirements in pkg-config check -asedeno@mit.edu
     26 * Fix color pair usage on ncurses builds without ext-color -davidben@mit.edu
     27 * IRC: Fix reconnect behavior. -nelhage@mit.edu
     28 * IRC: Make nick-change events LOGIN messages instead of ADMIN. -nelhage@mit.edu
     29 * IRC: Port module to AnyEvent::IRC. -asedeno@mit.edu, nelhage@nelhage.com
     30 * Ability to set exposure arbitrarily (like "zctl set exposure") -jgross@mit.edu
     31 * Kill --remove-debug option -davidben@mit.edu
     32 * exec: Fix input redirection of multistatement commands -andersk@mit.edu
     33 * Correctly set the realm in outgoing zwrite errors -davidben@mit.edu
     34 * Correctly compute the realm for outgoing messages -davidben@mit.edu
     35 * In duplicated outgoing zephyrs only reply on the relevant recipient -davidben@mit.edu
     36 * Create per-recipient copies of outgoing messages for non-CC'd personals -liudi@mit.edu
     37 * Add black to :show colors -andersk@mit.edu
     38 * Fix reporting of errors from libzephyr -kcr@1ts.org
     39 * Load Encode module for IRC. -timhill@alum.mit.edu
     40 * IRC: Sort the output of :irc-names -nelhage@mit.edu
     41 * Prepend "UNAUTH: " to displayed sender for unauthenticated zephyrs -adam@crossproduct.net
     42 * For ‘punt’ with one argument, quote the filter name -andersk@mit.edu
     43 * Fix spurious error running ‘punt’ with no arguments -andersk@mit.edu
     44 * Only handle CCs in messages sent directly to you. -davidben@mit.edu
     45 * Update copyright notices for 2011 -davidben@mit.edu
     46 * If a smartfilter fails to parse, handle the error -davidben@mit.edu
     47 * Replace per-editwin killbuf with a global one. -adam@crossproduct.net
     48 * Don't use error_message if we are building without Zephyr. -nelhage@mit.edu
     49 * Fix replying to outgoing zwrite when -m is passed -davidben@mit.edu
     50 * Fix a number of quoting bugs -davidben@mit.edu
     51 * Check passwd entries to determine home dir -davidben@mit.edu
     52
     531.7.1
     54 * Append sender's realm to CC'd unqualified names when replying. -adam@crossproduct.net
     55 * Don't reset ncurses colorpairs in the middle of drawing. -davidben@mit.edu
     56 * Fix viewuser when an unqualified name is given. -davidben@mit.edu
     57
    1581.7
     59 * Fix quoting bugs in smartfilter, zpunt, and numerous other commands. -davidben@mit.edu
    260 * Download Twitter consumer keys from barnowl.mit.edu. -nelhage@MIT.EDU
    361 * Fix unsub when .zephyr.subs is a symlink. -jgross@MIT.EDU
  • aim.c

    r2770be99 r3234121  
    10641064  g_free(wrapmsg);
    10651065  g_free(nz_screenname);
     1066  g_free(realmsg);
    10661067
    10671068  return(1);
    10681069
    1069   owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: message: %s\n", realmsg);
    1070  
    1071   if (args->icbmflags & AIM_IMFLAGS_MULTIPART) {
    1072     aim_mpmsg_section_t *sec;
    1073     int z;
    1074 
    1075     owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: multipart: this message has %d parts\n", args->mpmsg.numparts);
    1076    
    1077     for (sec = args->mpmsg.parts, z = 0; sec; sec = sec->next, z++) {
    1078       if ((sec->charset == 0x0000) || (sec->charset == 0x0003) || (sec->charset == 0xffff)) {
    1079         owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: multipart:   part %d: charset 0x%04x, subset 0x%04x, msg = %s\n", z, sec->charset, sec->charsubset, sec->data);
    1080       } else {
    1081         owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: multipart:   part %d: charset 0x%04x, subset 0x%04x, binary or UNICODE data\n", z, sec->charset, sec->charsubset);
    1082       }
    1083     }
    1084   }
    1085  
    1086   if (args->icbmflags & AIM_IMFLAGS_HASICON) {
    1087     /* aim_send_im(sess, userinfo->sn, AIM_IMFLAGS_BUDDYREQ, "You have an icon"); */
    1088     owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: their icon: iconstamp = %ld, iconlen = 0x%08x, iconsum = 0x%04x\n", args->iconstamp, args->iconlen, args->iconsum);
    1089   }
    1090 
    1091   g_free(realmsg);
    1092 
    1093   return(1);
     1070  /* TODO: Multipart? See history from before 1.8 release. */
    10941071}
    10951072
     
    18521829      fd = event_source->fds->pdata[i];
    18531830      fd->fd = cur->fd;
    1854       fd->events |= G_IO_IN | G_IO_HUP | G_IO_ERR;
     1831      fd->events = G_IO_IN | G_IO_HUP | G_IO_ERR;
    18551832      if (cur->status & AIM_CONN_STATUS_INPROGRESS) {
    1856         /* Yes, we're checking writable sockets here. Without it, AIM
    1857            login is really slow. */
     1833        /* AIM login requires checking writable sockets. See aim_select. */
    18581834        fd->events |= G_IO_OUT;
    18591835      }
  • cmd.c

    rce68f23 r14be3a5  
    260260  if (cmd->usage && *cmd->usage) {
    261261    s = cmd->usage;
    262     indent = owl_text_indent(s, OWL_TAB);
     262    indent = owl_text_indent(s, OWL_TAB, true);
    263263    owl_fmtext_append_bold(fm, "\nSYNOPSIS\n");
    264264    owl_fmtext_append_normal(fm, indent);
     
    274274  if (cmd->description && *cmd->description) {
    275275    s = cmd->description;
    276     indent = owl_text_indent(s, OWL_TAB);
     276    indent = owl_text_indent(s, OWL_TAB, true);
    277277    owl_fmtext_append_bold(fm, "\nDESCRIPTION\n");
    278278    owl_fmtext_append_normal(fm, indent);
  • commands.c

    refeec7f r287c634  
    21652165      myargv[i]=argv[i];
    21662166    }
    2167     owl_function_create_filter(argc, myargv);
    2168     owl_function_change_currentview_filter("owl-dynamic");
     2167    if (owl_function_create_filter(argc, myargv)) {
     2168      owl_function_change_currentview_filter("owl-dynamic");
     2169    }
    21692170    g_free(myargv);
    21702171    return NULL;
  • configure.ac

    r0de04fa r883502d  
    11dnl Process this file with autoconf to produce a configure script.
    2 AC_INIT([BarnOwl],[1.8dev],[bug-barnowl@mit.edu])
     2AC_INIT([BarnOwl],[1.9dev],[bug-barnowl@mit.edu])
    33AM_INIT_AUTOMAKE([1.7.0 -Wall -Wno-portability foreign])
    44m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
  • editwin.c

    r6829afc rf661cee  
    11511151{
    11521152  oe_excursion x;
    1153   gunichar ch;
     1153  gunichar ch = 0;
     1154  gunichar last_ch;
    11541155  int sentence;
    11551156
     
    11841185    }
    11851186
     1187    last_ch = ch;
    11861188    ch = owl_editwin_get_char_at_point(e);
    11871189
     
    12011203    }
    12021204
    1203     if(ch == '.' || ch == '!' || ch == '?')
     1205    if (ch == '.' || ch == '!' || ch == '?' ||
     1206        (ch == '"' && (last_ch == '.' || last_ch == '!' || last_ch == '?')))
    12041207      sentence = 1;
    12051208    else
  • functions.c

    r99ac28a r287c634  
    12231223void G_GNUC_PRINTF(1, 2) owl_function_debugmsg(const char *fmt, ...)
    12241224{
     1225  char *tmpbuff;
    12251226  FILE *file;
    12261227  time_t now;
     
    12371238  now = time(NULL);
    12381239
    1239   fprintf(file, "[%d -  %.24s - %lds]: ",
    1240           (int) getpid(), ctime(&now), now - owl_global_get_starttime(&g));
     1240  tmpbuff = owl_util_time_to_timestr(localtime(&now));
     1241  fprintf(file, "[%d -  %s - %lds]: ",
     1242          (int) getpid(), tmpbuff, now - owl_global_get_starttime(&g));
     1243  g_free(tmpbuff);
    12411244  vfprintf(file, fmt, ap);
    12421245  putc('\n', file);
     
    14301433#ifdef HAVE_LIBZEPHYR
    14311434    if (owl_message_is_direction_in(m)) {
    1432       char *tmpbuff;
     1435      char *tmpbuff, *tmpbuff2;
    14331436      int i, fields;
    14341437
     
    14761479
    14771480        for (i = 0; i < fields; i++) {
    1478           tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1);
    1479 
    1480           g_strdelimit(tmpbuff, "\n", '~');
    1481           g_strdelimit(tmpbuff, "\r", '!');
    1482 
    1483           owl_fmtext_appendf_normal(&fm, "  Field %i   : %s\n", i + 1, tmpbuff);
    1484           g_free(tmpbuff);
     1481          tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1);
     1482          tmpbuff2 = owl_text_indent(tmpbuff, 14, false);
     1483          owl_fmtext_appendf_normal(&fm, "  Field %i   : %s\n", i + 1, tmpbuff2);
     1484          g_free(tmpbuff2);
     1485          g_free(tmpbuff);
    14851486        }
    1486         owl_fmtext_appendf_normal(&fm, "  Default Fm: %s\n", n->z_default_format);
     1487        tmpbuff = owl_text_indent(n->z_default_format, 14, false);
     1488        owl_fmtext_appendf_normal(&fm, "  Default Fm: %s\n", tmpbuff);
     1489        g_free(tmpbuff);
    14871490      }
    14881491
     
    17611764void owl_function_status(void)
    17621765{
     1766  char *tmpbuff;
    17631767  char buff[MAXPATHLEN+1];
    17641768  time_t start;
     
    17881792  owl_fmtext_append_normal(&fm, "\n");
    17891793
    1790   owl_fmtext_appendf_normal(&fm, "  Startup Time: %s", ctime(&start));
     1794  tmpbuff = owl_util_time_to_timestr(localtime(&start));
     1795  owl_fmtext_appendf_normal(&fm, "  Startup Time: %s\n", tmpbuff);
     1796  g_free(tmpbuff);
    17911797
    17921798  up=owl_global_get_runtime(&g);
     
    21262132
    21272133/* Create a new filter, or replace an existing one
    2128  * with a new definition.
     2134 * with a new definition. Returns true on success.
    21292135 */
    2130 void owl_function_create_filter(int argc, const char *const *argv)
     2136bool owl_function_create_filter(int argc, const char *const *argv)
    21312137{
    21322138  owl_filter *f;
     
    21362142  if (argc < 2) {
    21372143    owl_function_error("Wrong number of arguments to filter command");
    2138     return;
     2144    return false;
    21392145  }
    21402146
     
    21462152  if (!strcmp(argv[1], "all")) {
    21472153    owl_function_error("You may not change the 'all' filter.");
    2148     return;
     2154    return false;
    21492155  }
    21502156
     
    21542160    if (!f) {
    21552161      owl_function_error("The filter '%s' does not exist.", argv[1]);
    2156       return;
     2162      return false;
    21572163    }
    21582164    if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) {
    21592165      owl_function_error("The color '%s' is not available.", argv[3]);
    2160       return;
     2166      return false;
    21612167    }
    21622168    owl_filter_set_fgcolor(f, owl_util_string_to_color(argv[3]));
    21632169    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    2164     return;
     2170    return false;
    21652171  }
    21662172  if (argc==4 && !strcmp(argv[2], "-b")) {
     
    21682174    if (!f) {
    21692175      owl_function_error("The filter '%s' does not exist.", argv[1]);
    2170       return;
     2176      return false;
    21712177    }
    21722178    if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) {
    21732179      owl_function_error("The color '%s' is not available.", argv[3]);
    2174       return;
     2180      return false;
    21752181    }
    21762182    owl_filter_set_bgcolor(f, owl_util_string_to_color(argv[3]));
    21772183    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    2178     return;
     2184    return true;
    21792185  }
    21802186
     
    21832189  if (f == NULL) {
    21842190    owl_function_error("Invalid filter");
    2185     return;
     2191    return false;
    21862192  }
    21872193
     
    22042210  }
    22052211  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
     2212  return true;
    22062213}
    22072214
     
    24552462  /* if it already exists then go with it.  This lets users override */
    24562463  if (owl_global_get_filter(&g, filtname)) {
    2457     return(g_strdup(filtname));
     2464    return filtname;
    24582465  }
    24592466
     
    34093416  char *buff;
    34103417
    3411   now=time(NULL);
    3412   date=g_strdup(ctime(&now));
    3413   date[strlen(date)-1]='\0';
     3418  now = time(NULL);
     3419  date = owl_util_time_to_timestr(localtime(&now));
    34143420
    34153421  buff = g_strdup_printf("%s %s", date, string);
  • message.c

    rdde1b4d r4ebbfbc  
    4646 
    4747  /* save the time */
    48   m->time=time(NULL);
    49   m->timestr=g_strdup(ctime(&(m->time)));
    50   m->timestr[strlen(m->timestr)-1]='\0';
     48  m->time = time(NULL);
     49  m->timestr = owl_util_time_to_timestr(localtime(&m->time));
    5150
    5251  m->fmtext = NULL;
     
    125124    p = m->attributes->pdata[i];
    126125
    127     tmpbuff = g_strdup(owl_pair_get_value(p));
    128     g_strdelimit(tmpbuff, "\n", '~');
    129     g_strdelimit(tmpbuff, "\r", '!');
    130     buff = g_strdup_printf("  %-15.15s: %s\n", owl_pair_get_key(p), tmpbuff);
    131     g_free(tmpbuff);
     126    buff = g_strdup(owl_pair_get_value(p));
     127    if (buff) {
     128      tmpbuff = owl_text_indent(buff, 19, false);
     129      g_free(buff);
     130      buff = g_strdup_printf("  %-15.15s: %s\n", owl_pair_get_key(p), tmpbuff);
     131      g_free(tmpbuff);
     132    }
    132133
    133134    if(buff == NULL) {
     
    794795  /* save the time, we need to nuke the string saved by message_init */
    795796  if (m->timestr) g_free(m->timestr);
    796   m->time=n->z_time.tv_sec;
    797   m->timestr=g_strdup(ctime(&(m->time)));
    798   m->timestr[strlen(m->timestr)-1]='\0';
     797  m->time = n->z_time.tv_sec;
     798  m->timestr = owl_util_time_to_timestr(localtime(&m->time));
    799799
    800800  /* set other info */
  • owl.c

    rb8a3e00 ra7fac14  
    389389}
    390390
    391 #define CHECK_RESULT(s, syscall) \
     391#define OR_DIE(s, syscall)      \
    392392  G_STMT_START {                 \
    393     if ((syscall) != 0) {        \
     393    if ((syscall) == -1) {       \
    394394      perror((s));               \
    395395      exit(1);                   \
     
    402402  sigset_t sigset;
    403403  int ret, i;
    404   const int signals[] = { SIGABRT, SIGBUS, SIGCHLD, SIGFPE, SIGHUP, SIGILL,
    405                           SIGINT, SIGQUIT, SIGSEGV, SIGTERM, SIGWINCH };
     404  const int reset_signals[] = { SIGABRT, SIGBUS, SIGCHLD, SIGFPE, SIGILL,
     405                                SIGQUIT, SIGSEGV, };
     406  /* Don't bother resetting watched ones because owl_signal_init will. */
     407  const int watch_signals[] = { SIGWINCH, SIGTERM, SIGHUP, SIGINT, };
    406408
    407409  /* Sanitize our signals; the mask and dispositions from our parent
    408410   * aren't really useful. Signal list taken from equivalent code in
    409411   * Chromium. */
    410   CHECK_RESULT("sigemptyset", sigemptyset(&sigset));
     412  OR_DIE("sigemptyset", sigemptyset(&sigset));
    411413  if ((ret = pthread_sigmask(SIG_SETMASK, &sigset, NULL)) != 0) {
    412414    errno = ret;
    413415    perror("pthread_sigmask");
    414   }
    415   for (i = 0; i < G_N_ELEMENTS(signals); i++) {
    416     CHECK_RESULT("sigaction", sigaction(signals[i], &sig_default, NULL));
     416    exit(1);
     417  }
     418  for (i = 0; i < G_N_ELEMENTS(reset_signals); i++) {
     419    OR_DIE("sigaction", sigaction(reset_signals[i], &sig_default, NULL));
    417420  }
    418421
    419422  /* Turn off SIGPIPE; we check the return value of write. */
    420   CHECK_RESULT("sigaction", sigaction(SIGPIPE, &sig_ignore, NULL));
     423  OR_DIE("sigaction", sigaction(SIGPIPE, &sig_ignore, NULL));
    421424
    422425  /* Register some signals with the signal thread. */
    423   CHECK_RESULT("sigaddset", sigaddset(&sigset, SIGWINCH));
    424   CHECK_RESULT("sigaddset", sigaddset(&sigset, SIGTERM));
    425   CHECK_RESULT("sigaddset", sigaddset(&sigset, SIGHUP));
    426   CHECK_RESULT("sigaddset", sigaddset(&sigset, SIGINT));
    427   owl_signal_init(&sigset, sig_handler, NULL);
     426  owl_signal_init(watch_signals, G_N_ELEMENTS(watch_signals),
     427                  sig_handler, NULL);
    428428}
    429429
  • owl.h

    r67e5ba36 rcbc8657  
    7575
    7676#define OWL_CONFIG_DIR "/.owl"             /* this is relative to the user's home directory */
    77 #define OWL_STARTUP_FILE "/.owl/startup"   /* this is relative to the user's home directory */
    7877
    7978#define OWL_FMTEXT_ATTR_NONE      0
     
    206205#define OWL_META(key) ((key)|010000)
    207206/* OWL_CTRL is definied in kepress.c */
    208 
    209 #define LINE 2048
    210207
    211208#ifdef HAVE_LIBZEPHYR
  • perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm

    r7aa1fa5 r4ebbfbc  
    2929use BarnOwl;
    3030use BarnOwl::Message::Twitter;
    31 use POSIX qw(asctime);
     31use POSIX qw(strftime);
    3232
    3333use LWP::UserAgent;
     
    247247                       ($self->{cfg}->{account_nickname} ?
    248248                        "[$self->{cfg}->{account_nickname}]" : "") .
    249                         ": ratelimited until " . asctime(localtime($timeout)));
     249                        ": ratelimited until " . strftime('%c', localtime($timeout)));
    250250    } elsif(exists($ratelimit->{error})) {
    251251        $self->sleep(60*20);
  • regex.c

    rd427f08 rcbc8657  
    1111{
    1212  int ret;
    13   char buff1[LINE];
     13  size_t errbuf_size;
     14  char *errbuf;
    1415  const char *ptr;
    1516 
     
    2627  ret=regcomp(&(re->re), ptr, REG_EXTENDED|REG_ICASE);
    2728  if (ret) {
    28     regerror(ret, NULL, buff1, LINE);
    29     owl_function_makemsg("Error in regular expression: %s", buff1);
     29    errbuf_size = regerror(ret, NULL, NULL, 0);
     30    errbuf = g_new(char, errbuf_size);
     31    regerror(ret, NULL, errbuf, errbuf_size);
     32    owl_function_error("Error in regular expression: %s", errbuf);
     33    g_free(errbuf);
    3034    g_free(re->string);
    3135    re->string=NULL;
  • signal.c

    r1d21d9f ra7fac14  
    11#include <errno.h>
     2#include <glib.h>
    23#include <pthread.h>
    34#include <signal.h>
     
    1314static void *signal_thread_func(void *data);
    1415
    15 /* Initializes the signal thread to listen for 'set' on a dedicated
     16static void dummy_handler(int signum)
     17{
     18  /* Do nothing. This should never get called. It'd be nice to report the error
     19   * or something, but you can't have nice things in a signal handler. */
     20}
     21
     22#define OR_DIE(s, syscall)       \
     23  G_STMT_START {                 \
     24    if ((syscall) == -1) {       \
     25      perror((s));               \
     26      exit(1);                   \
     27    }                            \
     28  } G_STMT_END
     29
     30/* Initializes the signal thread to listen for 'signals' on a dedicated
    1631 * thread. 'callback' is called *on the signal thread* when a signal
    1732 * is received.
     
    1934 * This function /must/ be called before any other threads are
    2035 * created. (Otherwise the signals will not get blocked correctly.) */
    21 void owl_signal_init(const sigset_t *set, void (*callback)(const siginfo_t*, void*), void *data) {
     36void owl_signal_init(const int *signals, int num_signals, void (*callback)(const siginfo_t*, void*), void *data) {
     37  struct sigaction sig_dummy = { .sa_handler = dummy_handler };
    2238  int ret;
     39  int i;
    2340
    24   signal_set = *set;
    2541  signal_cb = callback;
    2642  signal_cbdata = data;
     43
     44  /* Stuff the signals into our sigset_t. Also assign all of them to a dummy
     45   * handler. Otherwise, if their default is SIG_IGN, they will get dropped if
     46   * delivered while processing. On Solaris, they will not get delivered at
     47   * all. */
     48  OR_DIE("sigemptyset", sigemptyset(&signal_set));
     49  for (i = 0; i < num_signals; i++) {
     50    OR_DIE("sigaddset", sigaddset(&signal_set, signals[i]));
     51    OR_DIE("sigaction", sigaction(signals[i], &sig_dummy, NULL));
     52  }
     53
    2754  /* Block these signals in all threads, so we can get them. */
    28   if ((ret = pthread_sigmask(SIG_BLOCK, set, NULL)) != 0) {
     55  if ((ret = pthread_sigmask(SIG_BLOCK, &signal_set, NULL)) != 0) {
    2956    errno = ret;
    3057    perror("pthread_sigmask");
     58    exit(1);
    3159  }
    3260  /* Spawn a dedicated thread to sigwait. */
  • style.c

    rd4927a7 r14be3a5  
    6565
    6666  /* indent and ensure ends with a newline */
    67   indent = owl_text_indent(body, OWL_TAB);
     67  indent = owl_text_indent(body, OWL_TAB, true);
    6868  curlen = strlen(indent);
    69   if (curlen==0 || indent[curlen-1] != '\n') {
    70     indent[curlen] = '\n';
    71     indent[curlen+1] = '\0';
     69  if (curlen == 0 || indent[curlen-1] != '\n') {
     70    char *tmp = indent;
     71    indent = g_strconcat(tmp, "\n", NULL);
     72    g_free(tmp);
    7273  }
    7374
  • text.c

    r6829afc r14be3a5  
    77/* Returns a copy of 'in' with each line indented 'n'
    88 * characters. Result must be freed with g_free. */
    9 CALLER_OWN char *owl_text_indent(const char *in, int n)
     9CALLER_OWN char *owl_text_indent(const char *in, int n, bool indent_first_line)
    1010{
    1111  const char *ptr1, *ptr2, *last;
    1212  GString *out = g_string_new("");
    1313  int i;
     14  bool indent_this_line = indent_first_line;
    1415
    1516  last=in+strlen(in)-1;
    1617  ptr1=in;
    1718  while (ptr1<=last) {
    18     for (i=0; i<n; i++) {
    19       g_string_append_c(out, ' ');
    20     }
     19    if (indent_this_line) {
     20      for (i = 0; i < n; i++) {
     21        g_string_append_c(out, ' ');
     22      }
     23    }
     24    indent_this_line = true;
    2125    ptr2=strchr(ptr1, '\n');
    2226    if (!ptr2) {
  • util.c

    r8219374 r4ebbfbc  
    296296}
    297297
     298CALLER_OWN char *owl_util_time_to_timestr(const struct tm *time)
     299{
     300  /* 32 chosen for first attempt because timestr will end up being
     301   * something like "Www Mmm dd hh:mm:ss AM yyyy UTC\0" */
     302  size_t timestr_size = 16;
     303  char *timestr = NULL;
     304  do {
     305    timestr_size *= 2;
     306    timestr = g_renew(char, timestr, timestr_size);
     307  } while (strftime(timestr, timestr_size, "%c", time) == 0);
     308  return timestr;
     309}
     310
    298311/* These are in order of their value in owl.h */
    299312static const struct {
  • variable.c

    r30d0cf7 r6f7d4f6  
    707707}
    708708
    709 void owl_variable_dict_newvar_bool(owl_vardict *vd, const char *name, const char *summ, const char *desc, bool initval)
     709void owl_variable_dict_newvar_bool(owl_vardict *vd, const char *name, const char *summ, const char *desc, int initval)
    710710{
    711711  owl_variable *old = owl_variable_get_var(vd, name);
Note: See TracChangeset for help on using the changeset viewer.