Changeset 7e9fa84
- Timestamp:
- Jul 24, 2011, 2:26:09 PM (13 years ago)
- 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. - Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
fmtext.c
rd8f22b6 r7e9fa84 186 186 static void _owl_fmtext_wcolor_set(WINDOW *w, short pair) 187 187 { 188 cchar_t background; 189 wchar_t blank[2]; 188 190 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); 191 198 } 192 199 } -
ChangeLog
r2ff0693 r65ff3f4 1 1.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 53 1.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 1 58 1.7 59 * Fix quoting bugs in smartfilter, zpunt, and numerous other commands. -davidben@mit.edu 2 60 * Download Twitter consumer keys from barnowl.mit.edu. -nelhage@MIT.EDU 3 61 * Fix unsub when .zephyr.subs is a symlink. -jgross@MIT.EDU -
aim.c
r2770be99 r3234121 1064 1064 g_free(wrapmsg); 1065 1065 g_free(nz_screenname); 1066 g_free(realmsg); 1066 1067 1067 1068 return(1); 1068 1069 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. */ 1094 1071 } 1095 1072 … … 1852 1829 fd = event_source->fds->pdata[i]; 1853 1830 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; 1855 1832 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. */ 1858 1834 fd->events |= G_IO_OUT; 1859 1835 } -
cmd.c
rce68f23 r14be3a5 260 260 if (cmd->usage && *cmd->usage) { 261 261 s = cmd->usage; 262 indent = owl_text_indent(s, OWL_TAB );262 indent = owl_text_indent(s, OWL_TAB, true); 263 263 owl_fmtext_append_bold(fm, "\nSYNOPSIS\n"); 264 264 owl_fmtext_append_normal(fm, indent); … … 274 274 if (cmd->description && *cmd->description) { 275 275 s = cmd->description; 276 indent = owl_text_indent(s, OWL_TAB );276 indent = owl_text_indent(s, OWL_TAB, true); 277 277 owl_fmtext_append_bold(fm, "\nDESCRIPTION\n"); 278 278 owl_fmtext_append_normal(fm, indent); -
commands.c
refeec7f r287c634 2165 2165 myargv[i]=argv[i]; 2166 2166 } 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 } 2169 2170 g_free(myargv); 2170 2171 return NULL; -
configure.ac
r0de04fa r883502d 1 1 dnl Process this file with autoconf to produce a configure script. 2 AC_INIT([BarnOwl],[1. 8dev],[bug-barnowl@mit.edu])2 AC_INIT([BarnOwl],[1.9dev],[bug-barnowl@mit.edu]) 3 3 AM_INIT_AUTOMAKE([1.7.0 -Wall -Wno-portability foreign]) 4 4 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) -
editwin.c
r6829afc rf661cee 1151 1151 { 1152 1152 oe_excursion x; 1153 gunichar ch; 1153 gunichar ch = 0; 1154 gunichar last_ch; 1154 1155 int sentence; 1155 1156 … … 1184 1185 } 1185 1186 1187 last_ch = ch; 1186 1188 ch = owl_editwin_get_char_at_point(e); 1187 1189 … … 1201 1203 } 1202 1204 1203 if(ch == '.' || ch == '!' || ch == '?') 1205 if (ch == '.' || ch == '!' || ch == '?' || 1206 (ch == '"' && (last_ch == '.' || last_ch == '!' || last_ch == '?'))) 1204 1207 sentence = 1; 1205 1208 else -
functions.c
r99ac28a r287c634 1223 1223 void G_GNUC_PRINTF(1, 2) owl_function_debugmsg(const char *fmt, ...) 1224 1224 { 1225 char *tmpbuff; 1225 1226 FILE *file; 1226 1227 time_t now; … … 1237 1238 now = time(NULL); 1238 1239 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); 1241 1244 vfprintf(file, fmt, ap); 1242 1245 putc('\n', file); … … 1430 1433 #ifdef HAVE_LIBZEPHYR 1431 1434 if (owl_message_is_direction_in(m)) { 1432 char *tmpbuff ;1435 char *tmpbuff, *tmpbuff2; 1433 1436 int i, fields; 1434 1437 … … 1476 1479 1477 1480 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); 1485 1486 } 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); 1487 1490 } 1488 1491 … … 1761 1764 void owl_function_status(void) 1762 1765 { 1766 char *tmpbuff; 1763 1767 char buff[MAXPATHLEN+1]; 1764 1768 time_t start; … … 1788 1792 owl_fmtext_append_normal(&fm, "\n"); 1789 1793 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); 1791 1797 1792 1798 up=owl_global_get_runtime(&g); … … 2126 2132 2127 2133 /* Create a new filter, or replace an existing one 2128 * with a new definition. 2134 * with a new definition. Returns true on success. 2129 2135 */ 2130 voidowl_function_create_filter(int argc, const char *const *argv)2136 bool owl_function_create_filter(int argc, const char *const *argv) 2131 2137 { 2132 2138 owl_filter *f; … … 2136 2142 if (argc < 2) { 2137 2143 owl_function_error("Wrong number of arguments to filter command"); 2138 return ;2144 return false; 2139 2145 } 2140 2146 … … 2146 2152 if (!strcmp(argv[1], "all")) { 2147 2153 owl_function_error("You may not change the 'all' filter."); 2148 return ;2154 return false; 2149 2155 } 2150 2156 … … 2154 2160 if (!f) { 2155 2161 owl_function_error("The filter '%s' does not exist.", argv[1]); 2156 return ;2162 return false; 2157 2163 } 2158 2164 if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) { 2159 2165 owl_function_error("The color '%s' is not available.", argv[3]); 2160 return ;2166 return false; 2161 2167 } 2162 2168 owl_filter_set_fgcolor(f, owl_util_string_to_color(argv[3])); 2163 2169 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2164 return ;2170 return false; 2165 2171 } 2166 2172 if (argc==4 && !strcmp(argv[2], "-b")) { … … 2168 2174 if (!f) { 2169 2175 owl_function_error("The filter '%s' does not exist.", argv[1]); 2170 return ;2176 return false; 2171 2177 } 2172 2178 if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) { 2173 2179 owl_function_error("The color '%s' is not available.", argv[3]); 2174 return ;2180 return false; 2175 2181 } 2176 2182 owl_filter_set_bgcolor(f, owl_util_string_to_color(argv[3])); 2177 2183 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2178 return ;2184 return true; 2179 2185 } 2180 2186 … … 2183 2189 if (f == NULL) { 2184 2190 owl_function_error("Invalid filter"); 2185 return ;2191 return false; 2186 2192 } 2187 2193 … … 2204 2210 } 2205 2211 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2212 return true; 2206 2213 } 2207 2214 … … 2455 2462 /* if it already exists then go with it. This lets users override */ 2456 2463 if (owl_global_get_filter(&g, filtname)) { 2457 return (g_strdup(filtname));2464 return filtname; 2458 2465 } 2459 2466 … … 3409 3416 char *buff; 3410 3417 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)); 3414 3420 3415 3421 buff = g_strdup_printf("%s %s", date, string); -
message.c
rdde1b4d r4ebbfbc 46 46 47 47 /* 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)); 51 50 52 51 m->fmtext = NULL; … … 125 124 p = m->attributes->pdata[i]; 126 125 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 } 132 133 133 134 if(buff == NULL) { … … 794 795 /* save the time, we need to nuke the string saved by message_init */ 795 796 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)); 799 799 800 800 /* set other info */ -
owl.c
rb8a3e00 ra7fac14 389 389 } 390 390 391 #define CHECK_RESULT(s, syscall)\391 #define OR_DIE(s, syscall) \ 392 392 G_STMT_START { \ 393 if ((syscall) != 0) { \393 if ((syscall) == -1) { \ 394 394 perror((s)); \ 395 395 exit(1); \ … … 402 402 sigset_t sigset; 403 403 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, }; 406 408 407 409 /* Sanitize our signals; the mask and dispositions from our parent 408 410 * aren't really useful. Signal list taken from equivalent code in 409 411 * Chromium. */ 410 CHECK_RESULT("sigemptyset", sigemptyset(&sigset));412 OR_DIE("sigemptyset", sigemptyset(&sigset)); 411 413 if ((ret = pthread_sigmask(SIG_SETMASK, &sigset, NULL)) != 0) { 412 414 errno = ret; 413 415 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)); 417 420 } 418 421 419 422 /* 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)); 421 424 422 425 /* 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); 428 428 } 429 429 -
owl.h
r67e5ba36 rcbc8657 75 75 76 76 #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 */78 77 79 78 #define OWL_FMTEXT_ATTR_NONE 0 … … 206 205 #define OWL_META(key) ((key)|010000) 207 206 /* OWL_CTRL is definied in kepress.c */ 208 209 #define LINE 2048210 207 211 208 #ifdef HAVE_LIBZEPHYR -
perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm
r7aa1fa5 r4ebbfbc 29 29 use BarnOwl; 30 30 use BarnOwl::Message::Twitter; 31 use POSIX qw( asctime);31 use POSIX qw(strftime); 32 32 33 33 use LWP::UserAgent; … … 247 247 ($self->{cfg}->{account_nickname} ? 248 248 "[$self->{cfg}->{account_nickname}]" : "") . 249 ": ratelimited until " . asctime(localtime($timeout)));249 ": ratelimited until " . strftime('%c', localtime($timeout))); 250 250 } elsif(exists($ratelimit->{error})) { 251 251 $self->sleep(60*20); -
regex.c
rd427f08 rcbc8657 11 11 { 12 12 int ret; 13 char buff1[LINE]; 13 size_t errbuf_size; 14 char *errbuf; 14 15 const char *ptr; 15 16 … … 26 27 ret=regcomp(&(re->re), ptr, REG_EXTENDED|REG_ICASE); 27 28 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); 30 34 g_free(re->string); 31 35 re->string=NULL; -
signal.c
r1d21d9f ra7fac14 1 1 #include <errno.h> 2 #include <glib.h> 2 3 #include <pthread.h> 3 4 #include <signal.h> … … 13 14 static void *signal_thread_func(void *data); 14 15 15 /* Initializes the signal thread to listen for 'set' on a dedicated 16 static 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 16 31 * thread. 'callback' is called *on the signal thread* when a signal 17 32 * is received. … … 19 34 * This function /must/ be called before any other threads are 20 35 * 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) { 36 void 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 }; 22 38 int ret; 39 int i; 23 40 24 signal_set = *set;25 41 signal_cb = callback; 26 42 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 27 54 /* 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) { 29 56 errno = ret; 30 57 perror("pthread_sigmask"); 58 exit(1); 31 59 } 32 60 /* Spawn a dedicated thread to sigwait. */ -
style.c
rd4927a7 r14be3a5 65 65 66 66 /* indent and ensure ends with a newline */ 67 indent = owl_text_indent(body, OWL_TAB );67 indent = owl_text_indent(body, OWL_TAB, true); 68 68 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); 72 73 } 73 74 -
text.c
r6829afc r14be3a5 7 7 /* Returns a copy of 'in' with each line indented 'n' 8 8 * characters. Result must be freed with g_free. */ 9 CALLER_OWN char *owl_text_indent(const char *in, int n )9 CALLER_OWN char *owl_text_indent(const char *in, int n, bool indent_first_line) 10 10 { 11 11 const char *ptr1, *ptr2, *last; 12 12 GString *out = g_string_new(""); 13 13 int i; 14 bool indent_this_line = indent_first_line; 14 15 15 16 last=in+strlen(in)-1; 16 17 ptr1=in; 17 18 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; 21 25 ptr2=strchr(ptr1, '\n'); 22 26 if (!ptr2) { -
util.c
r8219374 r4ebbfbc 296 296 } 297 297 298 CALLER_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 298 311 /* These are in order of their value in owl.h */ 299 312 static const struct { -
variable.c
r30d0cf7 r6f7d4f6 707 707 } 708 708 709 void owl_variable_dict_newvar_bool(owl_vardict *vd, const char *name, const char *summ, const char *desc, boolinitval)709 void owl_variable_dict_newvar_bool(owl_vardict *vd, const char *name, const char *summ, const char *desc, int initval) 710 710 { 711 711 owl_variable *old = owl_variable_get_var(vd, name);
Note: See TracChangeset
for help on using the changeset viewer.