Changeset d54838d for functions.c


Ignore:
Timestamp:
Apr 20, 2003, 11:42:11 AM (22 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
801c7cb
Parents:
e9b1f60
Message:
fixes to owl_function_do_newmsgproc from Stephen
converted functions.c to new code style, which I'm giving a shot
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    re9b1f60 rd54838d  
    1414static const char fileIdent[] = "$Id$";
    1515
    16 void owl_function_noop(void) {
     16void owl_function_noop(void)
     17{
    1718  return;
    1819}
    1920
    20 char *owl_function_command(char *cmdbuff) {
     21char *owl_function_command(char *cmdbuff)
     22{
    2123  owl_function_debugmsg("executing command: %s", cmdbuff);
    2224  return owl_cmddict_execute(owl_global_get_cmddict(&g),
     
    2426}
    2527
    26 void owl_function_command_norv(char *cmdbuff) {
     28void owl_function_command_norv(char *cmdbuff)
     29{
    2730  char *rv;
    2831  rv=owl_function_command(cmdbuff);
     
    3033}
    3134
    32 void owl_function_command_alias(char *alias_from, char *alias_to) {
     35void owl_function_command_alias(char *alias_from, char *alias_to)
     36{
    3337  owl_cmddict_add_alias(owl_global_get_cmddict(&g), alias_from, alias_to);
    3438}
    3539
    36 owl_cmd *owl_function_get_cmd(char *name) {
     40owl_cmd *owl_function_get_cmd(char *name)
     41{
    3742  return owl_cmddict_find(owl_global_get_cmddict(&g), name);
    3843}
    3944
    40 void owl_function_show_commands() {
     45void owl_function_show_commands()
     46{
    4147  owl_list l;
    4248  owl_fmtext fm;
     
    5359}
    5460
    55 char *owl_function_cmd_describe(void *name) {
     61char *owl_function_cmd_describe(void *name)
     62{
    5663  owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
    5764  if (cmd) return owl_cmd_describe(cmd);
     
    5966}
    6067
    61 void owl_function_show_command(char *name) {
     68void owl_function_show_command(char *name)
     69{
    6270  owl_function_help_for_command(name);
    6371}
    6472
    65 void owl_function_adminmsg(char *header, char *body) {
     73void owl_function_adminmsg(char *header, char *body)
     74{
    6675  owl_message *m;
    6776  int followlast;
     
    8493}
    8594
    86 void owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig) {
     95void owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig)
     96{
    8797  owl_message *m;
    8898  int followlast;
     
    114124}
    115125
    116 void owl_function_zwrite_setup(char *line) {
     126void owl_function_zwrite_setup(char *line)
     127{
    117128  owl_editwin *e;
    118129  char buff[1024];
     
    155166}
    156167
    157 void owl_function_zcrypt_setup(char *line) {
     168void owl_function_zcrypt_setup(char *line)
     169{
    158170  owl_editwin *e;
    159171  char buff[1024];
     
    202214}
    203215
    204 void owl_function_zwrite(char *line) {
     216void owl_function_zwrite(char *line)
     217{
    205218  owl_zwrite z;
    206219  int i, j;
     
    234247 * If last_if_none, will stop at the last message in the view
    235248 * if no matching messages are found.  */
    236 void owl_function_nextmsg_full(char *filter, int skip_deleted, int last_if_none) {
     249void owl_function_nextmsg_full(char *filter, int skip_deleted, int last_if_none)
     250{
    237251  int curmsg, i, viewsize, found;
    238252  owl_view *v;
     
    283297}
    284298
    285 void owl_function_prevmsg_full(char *filter, int skip_deleted, int first_if_none) {
     299void owl_function_prevmsg_full(char *filter, int skip_deleted, int first_if_none)
     300{
    286301  int curmsg, i, viewsize, found;
    287302  owl_view *v;
     
    331346}
    332347
    333 void owl_function_nextmsg() {
     348void owl_function_nextmsg()
     349{
    334350  owl_function_nextmsg_full(NULL, 0, 1);
    335351}
    336352
    337353
    338 void owl_function_prevmsg() {
     354void owl_function_prevmsg()
     355{
    339356  owl_function_prevmsg_full(NULL, 0, 1);
    340357}
    341358
    342 void owl_function_nextmsg_notdeleted() {
     359void owl_function_nextmsg_notdeleted()
     360{
    343361  owl_function_nextmsg_full(NULL, 1, 1);
    344362}
    345363
    346 void owl_function_prevmsg_notdeleted() {
     364void owl_function_prevmsg_notdeleted()
     365{
    347366  owl_function_prevmsg_full(NULL, 1, 1);
    348367}
    349368
    350369
    351 void owl_function_nextmsg_personal() {
     370void owl_function_nextmsg_personal()
     371{
    352372  owl_function_nextmsg_full("personal", 0, 0);
    353373}
    354374
    355 void owl_function_prevmsg_personal() {
     375void owl_function_prevmsg_personal()
     376{
    356377  owl_function_prevmsg_full("personal", 0, 0);
    357378}
     
    359380
    360381/* if move_after is 1, moves after the delete */
    361 void owl_function_deletecur(int move_after) {
     382void owl_function_deletecur(int move_after)
     383{
    362384  int curmsg;
    363385  owl_view *v;
     
    387409
    388410
    389 void owl_function_undeletecur(int move_after) {
     411void owl_function_undeletecur(int move_after)
     412{
    390413  int curmsg;
    391414  owl_view *v;
     
    417440
    418441
    419 void owl_function_expunge() {
     442void owl_function_expunge()
     443{
    420444  int curmsg;
    421445  owl_message *m;
     
    453477
    454478
    455 void owl_function_firstmsg() {
     479void owl_function_firstmsg()
     480{
    456481  owl_global_set_curmsg(&g, 0);
    457482  owl_global_set_topmsg(&g, 0);
     
    460485}
    461486
    462 void owl_function_lastmsg_noredisplay() {
     487void owl_function_lastmsg_noredisplay()
     488{
    463489  int oldcurmsg, curmsg;
    464490  owl_view *v;
     
    481507}
    482508
    483 void owl_function_lastmsg() {
     509void owl_function_lastmsg()
     510{
    484511  owl_function_lastmsg_noredisplay();
    485512  owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 
    486513}
    487514
    488 void owl_function_shift_right() {
     515void owl_function_shift_right()
     516{
    489517  owl_global_set_rightshift(&g, owl_global_get_rightshift(&g)+10);
    490518  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
     
    493521
    494522
    495 void owl_function_shift_left() {
     523void owl_function_shift_left()
     524{
    496525  int shift;
    497526
     
    508537
    509538
    510 void owl_function_unsuball() {
     539void owl_function_unsuball()
     540{
    511541  unsuball();
    512542  owl_function_makemsg("Unsubscribed from all messages.");
    513543}
    514544
    515 void owl_function_loadsubs(char *file) {
     545void owl_function_loadsubs(char *file)
     546{
    516547  int ret;
    517548
     
    528559}
    529560
    530 void owl_function_loadloginsubs(char *file) {
     561void owl_function_loadloginsubs(char *file)
     562{
    531563  int ret;
    532564
     
    543575}
    544576
    545 void owl_function_suspend() {
     577void owl_function_suspend()
     578{
    546579  endwin();
    547580  printf("\n");
     
    552585}
    553586
    554 void owl_function_zaway_toggle() {
     587void owl_function_zaway_toggle()
     588{
    555589  if (!owl_global_is_zaway(&g)) {
    556590    owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g));
     
    561595}
    562596
    563 void owl_function_zaway_on() {
     597void owl_function_zaway_on()
     598{
    564599  owl_global_set_zaway_on(&g);
    565600  owl_function_makemsg("zaway set (%s)", owl_global_get_zaway_msg(&g));
    566601}
    567602
    568 void owl_function_zaway_off() {
     603void owl_function_zaway_off()
     604{
    569605  owl_global_set_zaway_off(&g);
    570606  owl_function_makemsg("zaway off");
    571607}
    572608
    573 void owl_function_quit() {
     609void owl_function_quit()
     610{
    574611  char *ret;
    575612 
     
    592629
    593630
    594 void owl_function_zlog_in() {
     631void owl_function_zlog_in()
     632{
    595633  char *exposure, *eset;
    596634  int ret;
     
    624662}
    625663
    626 void owl_function_zlog_out() {
     664void owl_function_zlog_out()
     665{
    627666  int ret;
    628667 
     
    638677
    639678
    640 void owl_function_makemsg(char *fmt, ...) {
     679void owl_function_makemsg(char *fmt, ...)
     680{
    641681  va_list ap;
    642682  char buff[2048];
     
    653693}
    654694
    655 void owl_function_errormsg(char *fmt, ...) {
     695void owl_function_errormsg(char *fmt, ...)
     696{
    656697  va_list ap;
    657698  char buff[2048];
     
    670711
    671712
    672 void owl_function_openurl() {
     713void owl_function_openurl()
     714{
    673715  /* visit the first url in the current message */
    674716  owl_message *m;
     
    767809}
    768810
    769 void owl_function_calculate_topmsg(int direction) {
     811void owl_function_calculate_topmsg(int direction)
     812{
    770813  int recwinlines, topmsg, curmsg;
    771814  owl_view *v;
     
    813856 * and the number of lines in the recwin.
    814857 */
    815 int owl_function_calculate_topmsg_top(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) {
     858int owl_function_calculate_topmsg_top(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
     859{
    816860  return(curmsg);
    817861}
    818862
    819 int owl_function_calculate_topmsg_neartop(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) {
     863int owl_function_calculate_topmsg_neartop(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
     864{
    820865  if (curmsg>0
    821866      && (owl_message_get_numlines(owl_view_get_element(v, curmsg-1))
     
    827872}
    828873 
    829 int owl_function_calculate_topmsg_center(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) {
     874int owl_function_calculate_topmsg_center(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
     875{
    830876  int i, last, lines;
    831877
     
    840886}
    841887 
    842 int owl_function_calculate_topmsg_paged(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines, int center_on_page) {
     888int owl_function_calculate_topmsg_paged(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines, int center_on_page)
     889{
    843890  int i, last, lines, savey;
    844891 
     
    880927
    881928
    882 int owl_function_calculate_topmsg_normal(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) {
     929int owl_function_calculate_topmsg_normal(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
     930{
    883931  int savey, j, i, foo, y;
    884932
     
    945993
    946994
    947 void owl_function_resize() {
     995void owl_function_resize()
     996{
    948997  owl_global_set_resize_pending(&g);
    949998}
    950999
    9511000
    952 void owl_function_run_buffercommand() {
     1001void owl_function_run_buffercommand()
     1002{
    9531003  char *buff;
    9541004
     
    9601010}
    9611011
    962 void owl_function_debugmsg(char *fmt, ...) {
     1012void owl_function_debugmsg(char *fmt, ...)
     1013{
    9631014  FILE *file;
    9641015  time_t now;
     
    9871038
    9881039
    989 void owl_function_refresh() {
     1040void owl_function_refresh()
     1041{
    9901042  owl_function_resize();
    9911043}
    9921044
    993 void owl_function_beep() {
     1045void owl_function_beep()
     1046{
    9941047  if (owl_global_is_bell(&g)) {
    9951048    beep();
     
    9991052
    10001053
    1001 void owl_function_subscribe(char *class, char *inst, char *recip) {
     1054void owl_function_subscribe(char *class, char *inst, char *recip)
     1055{
    10021056  int ret;
    10031057
     
    10111065
    10121066
    1013 void owl_function_unsubscribe(char *class, char *inst, char *recip) {
     1067void owl_function_unsubscribe(char *class, char *inst, char *recip)
     1068{
    10141069  int ret;
    10151070
     
    10231078
    10241079
    1025 void owl_function_set_cursor(WINDOW *win) {
     1080void owl_function_set_cursor(WINDOW *win)
     1081{
    10261082  wnoutrefresh(win);
    10271083}
    10281084
    10291085
    1030 void owl_function_full_redisplay() {
     1086void owl_function_full_redisplay()
     1087{
    10311088  redrawwin(owl_global_get_curs_recwin(&g));
    10321089  redrawwin(owl_global_get_curs_sepwin(&g));
     
    10461103
    10471104
    1048 void owl_function_popless_text(char *text) {
     1105void owl_function_popless_text(char *text)
     1106{
    10491107  owl_popwin *pw;
    10501108  owl_viewwin *v;
     
    10631121
    10641122
    1065 void owl_function_popless_fmtext(owl_fmtext *fm) {
     1123void owl_function_popless_fmtext(owl_fmtext *fm)
     1124{
    10661125  owl_popwin *pw;
    10671126  owl_viewwin *v;
     
    10791138}
    10801139
    1081 void owl_function_about() {
     1140void owl_function_about()
     1141{
    10821142  char buff[5000];
    10831143
     
    11041164}
    11051165
    1106 void owl_function_info() {
     1166void owl_function_info()
     1167{
    11071168  owl_message *m;
    11081169  owl_fmtext fm;
     
    12541315
    12551316
    1256 void owl_function_curmsg_to_popwin() {
     1317void owl_function_curmsg_to_popwin()
     1318{
    12571319  owl_popwin *pw;
    12581320  owl_view *v;
     
    12741336
    12751337
    1276 void owl_function_page_curmsg(int step) {
     1338void owl_function_page_curmsg(int step)
     1339{
    12771340  /* scroll down or up within the current message IF the message is truncated */
    12781341
     
    13261389}
    13271390
    1328 void owl_function_resize_typwin(int newsize) {
     1391void owl_function_resize_typwin(int newsize)
     1392{
    13291393  owl_global_set_typwin_lines(&g, newsize);
    13301394  owl_function_resize();
    13311395}
    13321396
    1333 void owl_function_typwin_grow() {
     1397void owl_function_typwin_grow()
     1398{
    13341399  int i;
    13351400
     
    13381403}
    13391404
    1340 void owl_function_typwin_shrink() {
     1405void owl_function_typwin_shrink()
     1406{
    13411407  int i;
    13421408
     
    13471413}
    13481414
    1349 void owl_function_mainwin_pagedown() {
     1415void owl_function_mainwin_pagedown()
     1416{
    13501417  int i;
    13511418
     
    13611428}
    13621429
    1363 void owl_function_mainwin_pageup() {
     1430void owl_function_mainwin_pageup()
     1431{
    13641432  owl_global_set_curmsg(&g, owl_global_get_topmsg(&g));
    13651433  owl_function_prevmsg();
    13661434}
    13671435
    1368 void owl_function_getsubs() {
     1436void owl_function_getsubs()
     1437{
    13691438  int ret, num, i, one;
    13701439  ZSubscription_t sub;
     
    14021471
    14031472#define PABUFLEN 5000
    1404 void owl_function_printallvars() {
     1473void owl_function_printallvars()
     1474{
    14051475  char buff[PABUFLEN], *pos, *name;
    14061476  owl_list varnames;
     
    14301500}
    14311501
    1432 void owl_function_show_variables() {
     1502void owl_function_show_variables()
     1503{
    14331504  owl_list varnames;
    14341505  owl_fmtext fm; 
     
    14521523}
    14531524
    1454 void owl_function_show_variable(char *name) {
     1525void owl_function_show_variable(char *name)
     1526{
    14551527  owl_fmtext fm; 
    14561528
     
    14631535/* note: this applies to global message list, not to view.
    14641536 * If flag is 1, deletes.  If flag is 0, undeletes. */
    1465 void owl_function_delete_by_id(int id, int flag) {
     1537void owl_function_delete_by_id(int id, int flag)
     1538{
    14661539  owl_messagelist *ml;
    14671540  owl_message *m;
     
    14811554}
    14821555
    1483 void owl_function_delete_automsgs() {
     1556void owl_function_delete_automsgs()
     1557{
    14841558  /* mark for deletion all messages in the current view that match the
    14851559   * 'trash' filter */
     
    15141588
    15151589
    1516 void owl_function_status() {
     1590void owl_function_status()
     1591{
    15171592  char buff[5000];
    15181593  time_t start;
     
    15481623}
    15491624
    1550 void owl_function_show_term() {
     1625void owl_function_show_term()
     1626{
    15511627  owl_fmtext fm;
    15521628  char buff[LINE];
     
    15731649
    15741650
    1575 void owl_function_reply(int type, int enter) {
     1651void owl_function_reply(int type, int enter)
     1652{
    15761653  /* if type = 0 then normal reply.
    15771654   * if type = 1 then it's a reply to sender
     
    16821759}
    16831760
    1684 void owl_function_zlocate(int argc, char **argv, int auth) {
     1761void owl_function_zlocate(int argc, char **argv, int auth)
     1762{
    16851763  owl_fmtext fm;
    16861764  char *ptr, buff[LINE];
     
    17001778}
    17011779
    1702 void owl_function_start_command(char *line) {
     1780void owl_function_start_command(char *line)
     1781{
    17031782  int i, j;
    17041783  owl_editwin *tw;
     
    17191798}
    17201799
    1721 char *owl_function_exec(int argc, char **argv, char *buff, int type) {
     1800char *owl_function_exec(int argc, char **argv, char *buff, int type)
     1801{
    17221802  /* if type == 1 display in a popup
    17231803   * if type == 2 display an admin messages
     
    17651845
    17661846
    1767 char *owl_function_perl(int argc, char **argv, char *buff, int type) {
     1847char *owl_function_perl(int argc, char **argv, char *buff, int type)
     1848{
    17681849  /* if type == 1 display in a popup
    17691850   * if type == 2 display an admin messages
     
    17981879
    17991880
    1800 void owl_function_change_view(char *filtname) {
     1881void owl_function_change_view(char *filtname)
     1882{
    18011883  owl_view *v;
    18021884  owl_filter *f;
     
    18451927}
    18461928
    1847 void owl_function_create_filter(int argc, char **argv) {
     1929void owl_function_create_filter(int argc, char **argv)
     1930{
    18481931  owl_filter *f;
    18491932  owl_view *v;
     
    19061989}
    19071990
    1908 void owl_function_show_filters() {
     1991void owl_function_show_filters()
     1992{
    19091993  owl_list *l;
    19101994  owl_filter *f;
     
    19332017}
    19342018
    1935 void owl_function_show_filter(char *name) {
     2019void owl_function_show_filter(char *name)
     2020{
    19362021  owl_filter *f;
    19372022  char buff[5000];
     
    19462031}
    19472032
    1948 void owl_function_show_zpunts() {
     2033void owl_function_show_zpunts()
     2034{
    19492035  owl_filter *f;
    19502036  owl_list *fl;
     
    19682054}
    19692055
    1970 char *owl_function_fastclassinstfilt(char *class, char *instance) {
     2056char *owl_function_fastclassinstfilt(char *class, char *instance)
     2057{
    19712058  /* creates a filter for a class, instance if one doesn't exist.
    19722059   * If instance is null then apply for all messgaes in the class.
     
    19752062  owl_filter *f;
    19762063  char *argbuff, *filtname;
    1977   char *tmpclass, *tmpinstance;
     2064  char *tmpclass, *tmpinstance = NULL;
    19782065  int len;
    19792066
     
    20082095  }
    20092096  sprintf(argbuff, "( class ^%s$ )", tmpclass);
    2010   if (instance) {
     2097  if (tmpinstance) {
    20112098    sprintf(argbuff, "%s and ( instance ^%s$ )", argbuff, tmpinstance);
    20122099  }
    20132100  owl_free(tmpclass);
    2014   if (instance) owl_free(tmpinstance);
     2101  if (tmpinstance) owl_free(tmpinstance);
    20152102
    20162103  f=owl_malloc(sizeof(owl_filter));
     
    20242111}
    20252112
    2026 char *owl_function_fastuserfilt(char *user) {
     2113char *owl_function_fastuserfilt(char *user)
     2114{
    20272115  owl_filter *f;
    20282116  char *argbuff, *longuser, *shortuser, *filtname;
     
    20622150}
    20632151
    2064 char *owl_function_fasttypefilt(char *type) {
     2152char *owl_function_fasttypefilt(char *type)
     2153{
    20652154  owl_filter *f;
    20662155  char *argbuff, *filtname;
     
    20922181/* If flag is 1, marks for deletion.  If flag is 0,
    20932182 * unmarks for deletion. */
    2094 void owl_function_delete_curview_msgs(int flag) {
     2183void owl_function_delete_curview_msgs(int flag)
     2184{
    20952185  owl_view *v;
    20962186  int i, j;
     
    21112201}
    21122202
    2113 char *owl_function_smartfilter(int type) {
     2203char *owl_function_smartfilter(int type)
     2204{
    21142205  /* Returns the name of a filter, or null.  The caller
    21152206   * must free this name.  */
     
    21712262}
    21722263
    2173 void owl_function_smartzpunt(int type) {
     2264void owl_function_smartzpunt(int type)
     2265{
    21742266  /* Starts a zpunt command based on the current class,instance pair.
    21752267   * If type=0, uses just class.  If type=1, uses instance as well. */
     
    22192311
    22202312
    2221 void owl_function_color_current_filter(char *color) {
     2313void owl_function_color_current_filter(char *color)
     2314{
    22222315  owl_filter *f;
    22232316  char *name;
     
    22422335}
    22432336
    2244 void owl_function_show_colors() {
     2337void owl_function_show_colors()
     2338{
    22452339  owl_fmtext fm;
    22462340
     
    22592353}
    22602354
    2261 void owl_function_zpunt(char *class, char *inst, char *recip, int direction) {
     2355void owl_function_zpunt(char *class, char *inst, char *recip, int direction)
     2356{
    22622357  /* add the given class, inst, recip to the punt list for filtering.
    22632358   *   if direction==0 then punt
     
    23122407}
    23132408
    2314 void owl_function_activate_keymap(char *keymap) {
     2409void owl_function_activate_keymap(char *keymap)
     2410{
    23152411  if (!owl_keyhandler_activate(owl_global_get_keyhandler(&g), keymap)) {
    23162412    owl_function_makemsg("Unable to activate keymap '%s'", keymap);
     
    23192415
    23202416
    2321 void owl_function_show_keymaps() {
     2417void owl_function_show_keymaps()
     2418{
    23222419  owl_list l;
    23232420  owl_fmtext fm;
     
    23492446}
    23502447
    2351 char *owl_function_keymap_summary(void *name) {
     2448char *owl_function_keymap_summary(void *name)
     2449{
    23522450  owl_keymap *km
    23532451    = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), name);
     
    23572455
    23582456/* TODO: implement for real */
    2359 void owl_function_show_keymap(char *name) {
     2457void owl_function_show_keymap(char *name)
     2458{
    23602459  owl_fmtext fm;
    23612460  owl_keymap *km;
     
    23722471}
    23732472
    2374 void owl_function_help_for_command(char *cmdname) {
     2473void owl_function_help_for_command(char *cmdname)
     2474{
    23752475  owl_fmtext fm;
    23762476
     
    23812481}
    23822482
    2383 void owl_function_search_start(char *string, int direction) {
     2483void owl_function_search_start(char *string, int direction)
     2484{
    23842485  /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS */
    23852486  owl_global_set_search_active(&g, string);
     
    23872488}
    23882489
    2389 void owl_function_search_continue(int direction) {
     2490void owl_function_search_continue(int direction)
     2491{
    23902492  /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS */
    23912493  owl_function_search_helper(1, direction);
    23922494}
    23932495
    2394 void owl_function_search_helper(int mode, int direction) {
     2496void owl_function_search_helper(int mode, int direction)
     2497{
    23952498  /* move to a message that contains the string.  If direction is
    23962499   * OWL_DIRECTION_DOWNWARDS then search fowards, if direction is
     
    24542557/* strips formatting from ztext and returns the unformatted text.
    24552558 * caller is responsible for freeing. */
    2456 char *owl_function_ztext_stylestrip(char *zt) {
     2559char *owl_function_ztext_stylestrip(char *zt)
     2560{
    24572561  owl_fmtext fm;
    24582562  char *plaintext;
     
    24672571/* popup a znol listing.  If file is NULL use the default .anyone */
    24682572/* this doesn't obey 'elapsed' or 'timesort' yet */
    2469 void owl_function_zlist(char *file, int elapsed, int timesort) {
     2573void owl_function_zlist(char *file, int elapsed, int timesort)
     2574{
    24702575  char *ourfile, *tmp, buff[LINE], *line;
    24712576  FILE *f;
     
    25522657}
    25532658
    2554 void owl_function_dump(char *filename) {
     2659void owl_function_dump(char *filename)
     2660{
    25552661  int i, j, count;
    25562662  owl_message *m;
     
    25872693
    25882694
    2589 void owl_function_do_newmsgproc() {
     2695void owl_function_do_newmsgproc(void) {
    25902696  if (owl_global_get_newmsgproc(&g) && strcmp(owl_global_get_newmsgproc(&g), "")) {
    25912697    /* if there's a process out there, we need to check on it */
     
    26102716        /* parent set the child's pid */
    26112717        owl_global_set_newmsgproc_pid(&g, i);
    2612         waitpid(i, NULL, WNOHANG);
    26132718        owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", i);
    26142719      } else {
     
    26162721        char **parsed;
    26172722        parsed=owl_parseline(owl_global_get_newmsgproc(&g), &myargc);
    2618         parsed=realloc(parsed, strlen(owl_global_get_newmsgproc(&g)+300));
    2619         parsed[myargc]=(char *) NULL;
     2723        if (myargc < 0) {
     2724          owl_function_debugmsg("Could not parse newmsgproc '%s': unbalanced quotes?", owl_global_get_newmsgproc(&g));
     2725        }
     2726        if (myargc <= 0) {
     2727          _exit(127);
     2728        }
     2729        parsed=realloc(parsed, sizeof(*parsed) * (myargc+1));
     2730        parsed[myargc] = NULL;
    26202731       
    2621         owl_function_debugmsg("About to exec: %s with %i arguments", parsed[0], myargc);
     2732        owl_function_debugmsg("About to exec \"%s\" with %d arguments", parsed[0], myargc);
    26222733       
    2623         execvp(parsed[0], (char **) parsed);
     2734        execvp(parsed[0], parsed);
    26242735       
    26252736       
    26262737        /* was there an error exec'ing? */
    2627         owl_function_debugmsg("Error execing: %s", strerror(errno));
     2738        owl_function_debugmsg("Cannot run newmsgproc '%s': cannot exec '%s': %s",
     2739                              owl_global_get_newmsgproc(&g), parsed[0], strerror(errno));
    26282740        _exit(127);
    26292741      }
     
    26342746void owl_function_xterm_raise(void) {
    26352747  printf("\033[5t");
    2636   fflush(stdout);
    26372748}
    26382749
    26392750void owl_function_xterm_deiconify(void) {
    26402751  printf("\033[1t");
    2641   fflush(stdout);
    2642 }
     2752}
Note: See TracChangeset for help on using the changeset viewer.