Changeset d54838d for functions.c
- Timestamp:
- Apr 20, 2003, 11:42:11 AM (22 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
re9b1f60 rd54838d 14 14 static const char fileIdent[] = "$Id$"; 15 15 16 void owl_function_noop(void) { 16 void owl_function_noop(void) 17 { 17 18 return; 18 19 } 19 20 20 char *owl_function_command(char *cmdbuff) { 21 char *owl_function_command(char *cmdbuff) 22 { 21 23 owl_function_debugmsg("executing command: %s", cmdbuff); 22 24 return owl_cmddict_execute(owl_global_get_cmddict(&g), … … 24 26 } 25 27 26 void owl_function_command_norv(char *cmdbuff) { 28 void owl_function_command_norv(char *cmdbuff) 29 { 27 30 char *rv; 28 31 rv=owl_function_command(cmdbuff); … … 30 33 } 31 34 32 void owl_function_command_alias(char *alias_from, char *alias_to) { 35 void owl_function_command_alias(char *alias_from, char *alias_to) 36 { 33 37 owl_cmddict_add_alias(owl_global_get_cmddict(&g), alias_from, alias_to); 34 38 } 35 39 36 owl_cmd *owl_function_get_cmd(char *name) { 40 owl_cmd *owl_function_get_cmd(char *name) 41 { 37 42 return owl_cmddict_find(owl_global_get_cmddict(&g), name); 38 43 } 39 44 40 void owl_function_show_commands() { 45 void owl_function_show_commands() 46 { 41 47 owl_list l; 42 48 owl_fmtext fm; … … 53 59 } 54 60 55 char *owl_function_cmd_describe(void *name) { 61 char *owl_function_cmd_describe(void *name) 62 { 56 63 owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name); 57 64 if (cmd) return owl_cmd_describe(cmd); … … 59 66 } 60 67 61 void owl_function_show_command(char *name) { 68 void owl_function_show_command(char *name) 69 { 62 70 owl_function_help_for_command(name); 63 71 } 64 72 65 void owl_function_adminmsg(char *header, char *body) { 73 void owl_function_adminmsg(char *header, char *body) 74 { 66 75 owl_message *m; 67 76 int followlast; … … 84 93 } 85 94 86 void owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig) { 95 void owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig) 96 { 87 97 owl_message *m; 88 98 int followlast; … … 114 124 } 115 125 116 void owl_function_zwrite_setup(char *line) { 126 void owl_function_zwrite_setup(char *line) 127 { 117 128 owl_editwin *e; 118 129 char buff[1024]; … … 155 166 } 156 167 157 void owl_function_zcrypt_setup(char *line) { 168 void owl_function_zcrypt_setup(char *line) 169 { 158 170 owl_editwin *e; 159 171 char buff[1024]; … … 202 214 } 203 215 204 void owl_function_zwrite(char *line) { 216 void owl_function_zwrite(char *line) 217 { 205 218 owl_zwrite z; 206 219 int i, j; … … 234 247 * If last_if_none, will stop at the last message in the view 235 248 * if no matching messages are found. */ 236 void owl_function_nextmsg_full(char *filter, int skip_deleted, int last_if_none) { 249 void owl_function_nextmsg_full(char *filter, int skip_deleted, int last_if_none) 250 { 237 251 int curmsg, i, viewsize, found; 238 252 owl_view *v; … … 283 297 } 284 298 285 void owl_function_prevmsg_full(char *filter, int skip_deleted, int first_if_none) { 299 void owl_function_prevmsg_full(char *filter, int skip_deleted, int first_if_none) 300 { 286 301 int curmsg, i, viewsize, found; 287 302 owl_view *v; … … 331 346 } 332 347 333 void owl_function_nextmsg() { 348 void owl_function_nextmsg() 349 { 334 350 owl_function_nextmsg_full(NULL, 0, 1); 335 351 } 336 352 337 353 338 void owl_function_prevmsg() { 354 void owl_function_prevmsg() 355 { 339 356 owl_function_prevmsg_full(NULL, 0, 1); 340 357 } 341 358 342 void owl_function_nextmsg_notdeleted() { 359 void owl_function_nextmsg_notdeleted() 360 { 343 361 owl_function_nextmsg_full(NULL, 1, 1); 344 362 } 345 363 346 void owl_function_prevmsg_notdeleted() { 364 void owl_function_prevmsg_notdeleted() 365 { 347 366 owl_function_prevmsg_full(NULL, 1, 1); 348 367 } 349 368 350 369 351 void owl_function_nextmsg_personal() { 370 void owl_function_nextmsg_personal() 371 { 352 372 owl_function_nextmsg_full("personal", 0, 0); 353 373 } 354 374 355 void owl_function_prevmsg_personal() { 375 void owl_function_prevmsg_personal() 376 { 356 377 owl_function_prevmsg_full("personal", 0, 0); 357 378 } … … 359 380 360 381 /* if move_after is 1, moves after the delete */ 361 void owl_function_deletecur(int move_after) { 382 void owl_function_deletecur(int move_after) 383 { 362 384 int curmsg; 363 385 owl_view *v; … … 387 409 388 410 389 void owl_function_undeletecur(int move_after) { 411 void owl_function_undeletecur(int move_after) 412 { 390 413 int curmsg; 391 414 owl_view *v; … … 417 440 418 441 419 void owl_function_expunge() { 442 void owl_function_expunge() 443 { 420 444 int curmsg; 421 445 owl_message *m; … … 453 477 454 478 455 void owl_function_firstmsg() { 479 void owl_function_firstmsg() 480 { 456 481 owl_global_set_curmsg(&g, 0); 457 482 owl_global_set_topmsg(&g, 0); … … 460 485 } 461 486 462 void owl_function_lastmsg_noredisplay() { 487 void owl_function_lastmsg_noredisplay() 488 { 463 489 int oldcurmsg, curmsg; 464 490 owl_view *v; … … 481 507 } 482 508 483 void owl_function_lastmsg() { 509 void owl_function_lastmsg() 510 { 484 511 owl_function_lastmsg_noredisplay(); 485 512 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 486 513 } 487 514 488 void owl_function_shift_right() { 515 void owl_function_shift_right() 516 { 489 517 owl_global_set_rightshift(&g, owl_global_get_rightshift(&g)+10); 490 518 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); … … 493 521 494 522 495 void owl_function_shift_left() { 523 void owl_function_shift_left() 524 { 496 525 int shift; 497 526 … … 508 537 509 538 510 void owl_function_unsuball() { 539 void owl_function_unsuball() 540 { 511 541 unsuball(); 512 542 owl_function_makemsg("Unsubscribed from all messages."); 513 543 } 514 544 515 void owl_function_loadsubs(char *file) { 545 void owl_function_loadsubs(char *file) 546 { 516 547 int ret; 517 548 … … 528 559 } 529 560 530 void owl_function_loadloginsubs(char *file) { 561 void owl_function_loadloginsubs(char *file) 562 { 531 563 int ret; 532 564 … … 543 575 } 544 576 545 void owl_function_suspend() { 577 void owl_function_suspend() 578 { 546 579 endwin(); 547 580 printf("\n"); … … 552 585 } 553 586 554 void owl_function_zaway_toggle() { 587 void owl_function_zaway_toggle() 588 { 555 589 if (!owl_global_is_zaway(&g)) { 556 590 owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g)); … … 561 595 } 562 596 563 void owl_function_zaway_on() { 597 void owl_function_zaway_on() 598 { 564 599 owl_global_set_zaway_on(&g); 565 600 owl_function_makemsg("zaway set (%s)", owl_global_get_zaway_msg(&g)); 566 601 } 567 602 568 void owl_function_zaway_off() { 603 void owl_function_zaway_off() 604 { 569 605 owl_global_set_zaway_off(&g); 570 606 owl_function_makemsg("zaway off"); 571 607 } 572 608 573 void owl_function_quit() { 609 void owl_function_quit() 610 { 574 611 char *ret; 575 612 … … 592 629 593 630 594 void owl_function_zlog_in() { 631 void owl_function_zlog_in() 632 { 595 633 char *exposure, *eset; 596 634 int ret; … … 624 662 } 625 663 626 void owl_function_zlog_out() { 664 void owl_function_zlog_out() 665 { 627 666 int ret; 628 667 … … 638 677 639 678 640 void owl_function_makemsg(char *fmt, ...) { 679 void owl_function_makemsg(char *fmt, ...) 680 { 641 681 va_list ap; 642 682 char buff[2048]; … … 653 693 } 654 694 655 void owl_function_errormsg(char *fmt, ...) { 695 void owl_function_errormsg(char *fmt, ...) 696 { 656 697 va_list ap; 657 698 char buff[2048]; … … 670 711 671 712 672 void owl_function_openurl() { 713 void owl_function_openurl() 714 { 673 715 /* visit the first url in the current message */ 674 716 owl_message *m; … … 767 809 } 768 810 769 void owl_function_calculate_topmsg(int direction) { 811 void owl_function_calculate_topmsg(int direction) 812 { 770 813 int recwinlines, topmsg, curmsg; 771 814 owl_view *v; … … 813 856 * and the number of lines in the recwin. 814 857 */ 815 int owl_function_calculate_topmsg_top(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) { 858 int owl_function_calculate_topmsg_top(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) 859 { 816 860 return(curmsg); 817 861 } 818 862 819 int owl_function_calculate_topmsg_neartop(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) { 863 int owl_function_calculate_topmsg_neartop(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) 864 { 820 865 if (curmsg>0 821 866 && (owl_message_get_numlines(owl_view_get_element(v, curmsg-1)) … … 827 872 } 828 873 829 int owl_function_calculate_topmsg_center(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) { 874 int owl_function_calculate_topmsg_center(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) 875 { 830 876 int i, last, lines; 831 877 … … 840 886 } 841 887 842 int owl_function_calculate_topmsg_paged(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines, int center_on_page) { 888 int owl_function_calculate_topmsg_paged(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines, int center_on_page) 889 { 843 890 int i, last, lines, savey; 844 891 … … 880 927 881 928 882 int owl_function_calculate_topmsg_normal(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) { 929 int owl_function_calculate_topmsg_normal(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) 930 { 883 931 int savey, j, i, foo, y; 884 932 … … 945 993 946 994 947 void owl_function_resize() { 995 void owl_function_resize() 996 { 948 997 owl_global_set_resize_pending(&g); 949 998 } 950 999 951 1000 952 void owl_function_run_buffercommand() { 1001 void owl_function_run_buffercommand() 1002 { 953 1003 char *buff; 954 1004 … … 960 1010 } 961 1011 962 void owl_function_debugmsg(char *fmt, ...) { 1012 void owl_function_debugmsg(char *fmt, ...) 1013 { 963 1014 FILE *file; 964 1015 time_t now; … … 987 1038 988 1039 989 void owl_function_refresh() { 1040 void owl_function_refresh() 1041 { 990 1042 owl_function_resize(); 991 1043 } 992 1044 993 void owl_function_beep() { 1045 void owl_function_beep() 1046 { 994 1047 if (owl_global_is_bell(&g)) { 995 1048 beep(); … … 999 1052 1000 1053 1001 void owl_function_subscribe(char *class, char *inst, char *recip) { 1054 void owl_function_subscribe(char *class, char *inst, char *recip) 1055 { 1002 1056 int ret; 1003 1057 … … 1011 1065 1012 1066 1013 void owl_function_unsubscribe(char *class, char *inst, char *recip) { 1067 void owl_function_unsubscribe(char *class, char *inst, char *recip) 1068 { 1014 1069 int ret; 1015 1070 … … 1023 1078 1024 1079 1025 void owl_function_set_cursor(WINDOW *win) { 1080 void owl_function_set_cursor(WINDOW *win) 1081 { 1026 1082 wnoutrefresh(win); 1027 1083 } 1028 1084 1029 1085 1030 void owl_function_full_redisplay() { 1086 void owl_function_full_redisplay() 1087 { 1031 1088 redrawwin(owl_global_get_curs_recwin(&g)); 1032 1089 redrawwin(owl_global_get_curs_sepwin(&g)); … … 1046 1103 1047 1104 1048 void owl_function_popless_text(char *text) { 1105 void owl_function_popless_text(char *text) 1106 { 1049 1107 owl_popwin *pw; 1050 1108 owl_viewwin *v; … … 1063 1121 1064 1122 1065 void owl_function_popless_fmtext(owl_fmtext *fm) { 1123 void owl_function_popless_fmtext(owl_fmtext *fm) 1124 { 1066 1125 owl_popwin *pw; 1067 1126 owl_viewwin *v; … … 1079 1138 } 1080 1139 1081 void owl_function_about() { 1140 void owl_function_about() 1141 { 1082 1142 char buff[5000]; 1083 1143 … … 1104 1164 } 1105 1165 1106 void owl_function_info() { 1166 void owl_function_info() 1167 { 1107 1168 owl_message *m; 1108 1169 owl_fmtext fm; … … 1254 1315 1255 1316 1256 void owl_function_curmsg_to_popwin() { 1317 void owl_function_curmsg_to_popwin() 1318 { 1257 1319 owl_popwin *pw; 1258 1320 owl_view *v; … … 1274 1336 1275 1337 1276 void owl_function_page_curmsg(int step) { 1338 void owl_function_page_curmsg(int step) 1339 { 1277 1340 /* scroll down or up within the current message IF the message is truncated */ 1278 1341 … … 1326 1389 } 1327 1390 1328 void owl_function_resize_typwin(int newsize) { 1391 void owl_function_resize_typwin(int newsize) 1392 { 1329 1393 owl_global_set_typwin_lines(&g, newsize); 1330 1394 owl_function_resize(); 1331 1395 } 1332 1396 1333 void owl_function_typwin_grow() { 1397 void owl_function_typwin_grow() 1398 { 1334 1399 int i; 1335 1400 … … 1338 1403 } 1339 1404 1340 void owl_function_typwin_shrink() { 1405 void owl_function_typwin_shrink() 1406 { 1341 1407 int i; 1342 1408 … … 1347 1413 } 1348 1414 1349 void owl_function_mainwin_pagedown() { 1415 void owl_function_mainwin_pagedown() 1416 { 1350 1417 int i; 1351 1418 … … 1361 1428 } 1362 1429 1363 void owl_function_mainwin_pageup() { 1430 void owl_function_mainwin_pageup() 1431 { 1364 1432 owl_global_set_curmsg(&g, owl_global_get_topmsg(&g)); 1365 1433 owl_function_prevmsg(); 1366 1434 } 1367 1435 1368 void owl_function_getsubs() { 1436 void owl_function_getsubs() 1437 { 1369 1438 int ret, num, i, one; 1370 1439 ZSubscription_t sub; … … 1402 1471 1403 1472 #define PABUFLEN 5000 1404 void owl_function_printallvars() { 1473 void owl_function_printallvars() 1474 { 1405 1475 char buff[PABUFLEN], *pos, *name; 1406 1476 owl_list varnames; … … 1430 1500 } 1431 1501 1432 void owl_function_show_variables() { 1502 void owl_function_show_variables() 1503 { 1433 1504 owl_list varnames; 1434 1505 owl_fmtext fm; … … 1452 1523 } 1453 1524 1454 void owl_function_show_variable(char *name) { 1525 void owl_function_show_variable(char *name) 1526 { 1455 1527 owl_fmtext fm; 1456 1528 … … 1463 1535 /* note: this applies to global message list, not to view. 1464 1536 * If flag is 1, deletes. If flag is 0, undeletes. */ 1465 void owl_function_delete_by_id(int id, int flag) { 1537 void owl_function_delete_by_id(int id, int flag) 1538 { 1466 1539 owl_messagelist *ml; 1467 1540 owl_message *m; … … 1481 1554 } 1482 1555 1483 void owl_function_delete_automsgs() { 1556 void owl_function_delete_automsgs() 1557 { 1484 1558 /* mark for deletion all messages in the current view that match the 1485 1559 * 'trash' filter */ … … 1514 1588 1515 1589 1516 void owl_function_status() { 1590 void owl_function_status() 1591 { 1517 1592 char buff[5000]; 1518 1593 time_t start; … … 1548 1623 } 1549 1624 1550 void owl_function_show_term() { 1625 void owl_function_show_term() 1626 { 1551 1627 owl_fmtext fm; 1552 1628 char buff[LINE]; … … 1573 1649 1574 1650 1575 void owl_function_reply(int type, int enter) { 1651 void owl_function_reply(int type, int enter) 1652 { 1576 1653 /* if type = 0 then normal reply. 1577 1654 * if type = 1 then it's a reply to sender … … 1682 1759 } 1683 1760 1684 void owl_function_zlocate(int argc, char **argv, int auth) { 1761 void owl_function_zlocate(int argc, char **argv, int auth) 1762 { 1685 1763 owl_fmtext fm; 1686 1764 char *ptr, buff[LINE]; … … 1700 1778 } 1701 1779 1702 void owl_function_start_command(char *line) { 1780 void owl_function_start_command(char *line) 1781 { 1703 1782 int i, j; 1704 1783 owl_editwin *tw; … … 1719 1798 } 1720 1799 1721 char *owl_function_exec(int argc, char **argv, char *buff, int type) { 1800 char *owl_function_exec(int argc, char **argv, char *buff, int type) 1801 { 1722 1802 /* if type == 1 display in a popup 1723 1803 * if type == 2 display an admin messages … … 1765 1845 1766 1846 1767 char *owl_function_perl(int argc, char **argv, char *buff, int type) { 1847 char *owl_function_perl(int argc, char **argv, char *buff, int type) 1848 { 1768 1849 /* if type == 1 display in a popup 1769 1850 * if type == 2 display an admin messages … … 1798 1879 1799 1880 1800 void owl_function_change_view(char *filtname) { 1881 void owl_function_change_view(char *filtname) 1882 { 1801 1883 owl_view *v; 1802 1884 owl_filter *f; … … 1845 1927 } 1846 1928 1847 void owl_function_create_filter(int argc, char **argv) { 1929 void owl_function_create_filter(int argc, char **argv) 1930 { 1848 1931 owl_filter *f; 1849 1932 owl_view *v; … … 1906 1989 } 1907 1990 1908 void owl_function_show_filters() { 1991 void owl_function_show_filters() 1992 { 1909 1993 owl_list *l; 1910 1994 owl_filter *f; … … 1933 2017 } 1934 2018 1935 void owl_function_show_filter(char *name) { 2019 void owl_function_show_filter(char *name) 2020 { 1936 2021 owl_filter *f; 1937 2022 char buff[5000]; … … 1946 2031 } 1947 2032 1948 void owl_function_show_zpunts() { 2033 void owl_function_show_zpunts() 2034 { 1949 2035 owl_filter *f; 1950 2036 owl_list *fl; … … 1968 2054 } 1969 2055 1970 char *owl_function_fastclassinstfilt(char *class, char *instance) { 2056 char *owl_function_fastclassinstfilt(char *class, char *instance) 2057 { 1971 2058 /* creates a filter for a class, instance if one doesn't exist. 1972 2059 * If instance is null then apply for all messgaes in the class. … … 1975 2062 owl_filter *f; 1976 2063 char *argbuff, *filtname; 1977 char *tmpclass, *tmpinstance ;2064 char *tmpclass, *tmpinstance = NULL; 1978 2065 int len; 1979 2066 … … 2008 2095 } 2009 2096 sprintf(argbuff, "( class ^%s$ )", tmpclass); 2010 if ( instance) {2097 if (tmpinstance) { 2011 2098 sprintf(argbuff, "%s and ( instance ^%s$ )", argbuff, tmpinstance); 2012 2099 } 2013 2100 owl_free(tmpclass); 2014 if ( instance) owl_free(tmpinstance);2101 if (tmpinstance) owl_free(tmpinstance); 2015 2102 2016 2103 f=owl_malloc(sizeof(owl_filter)); … … 2024 2111 } 2025 2112 2026 char *owl_function_fastuserfilt(char *user) { 2113 char *owl_function_fastuserfilt(char *user) 2114 { 2027 2115 owl_filter *f; 2028 2116 char *argbuff, *longuser, *shortuser, *filtname; … … 2062 2150 } 2063 2151 2064 char *owl_function_fasttypefilt(char *type) { 2152 char *owl_function_fasttypefilt(char *type) 2153 { 2065 2154 owl_filter *f; 2066 2155 char *argbuff, *filtname; … … 2092 2181 /* If flag is 1, marks for deletion. If flag is 0, 2093 2182 * unmarks for deletion. */ 2094 void owl_function_delete_curview_msgs(int flag) { 2183 void owl_function_delete_curview_msgs(int flag) 2184 { 2095 2185 owl_view *v; 2096 2186 int i, j; … … 2111 2201 } 2112 2202 2113 char *owl_function_smartfilter(int type) { 2203 char *owl_function_smartfilter(int type) 2204 { 2114 2205 /* Returns the name of a filter, or null. The caller 2115 2206 * must free this name. */ … … 2171 2262 } 2172 2263 2173 void owl_function_smartzpunt(int type) { 2264 void owl_function_smartzpunt(int type) 2265 { 2174 2266 /* Starts a zpunt command based on the current class,instance pair. 2175 2267 * If type=0, uses just class. If type=1, uses instance as well. */ … … 2219 2311 2220 2312 2221 void owl_function_color_current_filter(char *color) { 2313 void owl_function_color_current_filter(char *color) 2314 { 2222 2315 owl_filter *f; 2223 2316 char *name; … … 2242 2335 } 2243 2336 2244 void owl_function_show_colors() { 2337 void owl_function_show_colors() 2338 { 2245 2339 owl_fmtext fm; 2246 2340 … … 2259 2353 } 2260 2354 2261 void owl_function_zpunt(char *class, char *inst, char *recip, int direction) { 2355 void owl_function_zpunt(char *class, char *inst, char *recip, int direction) 2356 { 2262 2357 /* add the given class, inst, recip to the punt list for filtering. 2263 2358 * if direction==0 then punt … … 2312 2407 } 2313 2408 2314 void owl_function_activate_keymap(char *keymap) { 2409 void owl_function_activate_keymap(char *keymap) 2410 { 2315 2411 if (!owl_keyhandler_activate(owl_global_get_keyhandler(&g), keymap)) { 2316 2412 owl_function_makemsg("Unable to activate keymap '%s'", keymap); … … 2319 2415 2320 2416 2321 void owl_function_show_keymaps() { 2417 void owl_function_show_keymaps() 2418 { 2322 2419 owl_list l; 2323 2420 owl_fmtext fm; … … 2349 2446 } 2350 2447 2351 char *owl_function_keymap_summary(void *name) { 2448 char *owl_function_keymap_summary(void *name) 2449 { 2352 2450 owl_keymap *km 2353 2451 = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), name); … … 2357 2455 2358 2456 /* TODO: implement for real */ 2359 void owl_function_show_keymap(char *name) { 2457 void owl_function_show_keymap(char *name) 2458 { 2360 2459 owl_fmtext fm; 2361 2460 owl_keymap *km; … … 2372 2471 } 2373 2472 2374 void owl_function_help_for_command(char *cmdname) { 2473 void owl_function_help_for_command(char *cmdname) 2474 { 2375 2475 owl_fmtext fm; 2376 2476 … … 2381 2481 } 2382 2482 2383 void owl_function_search_start(char *string, int direction) { 2483 void owl_function_search_start(char *string, int direction) 2484 { 2384 2485 /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS */ 2385 2486 owl_global_set_search_active(&g, string); … … 2387 2488 } 2388 2489 2389 void owl_function_search_continue(int direction) { 2490 void owl_function_search_continue(int direction) 2491 { 2390 2492 /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS */ 2391 2493 owl_function_search_helper(1, direction); 2392 2494 } 2393 2495 2394 void owl_function_search_helper(int mode, int direction) { 2496 void owl_function_search_helper(int mode, int direction) 2497 { 2395 2498 /* move to a message that contains the string. If direction is 2396 2499 * OWL_DIRECTION_DOWNWARDS then search fowards, if direction is … … 2454 2557 /* strips formatting from ztext and returns the unformatted text. 2455 2558 * caller is responsible for freeing. */ 2456 char *owl_function_ztext_stylestrip(char *zt) { 2559 char *owl_function_ztext_stylestrip(char *zt) 2560 { 2457 2561 owl_fmtext fm; 2458 2562 char *plaintext; … … 2467 2571 /* popup a znol listing. If file is NULL use the default .anyone */ 2468 2572 /* this doesn't obey 'elapsed' or 'timesort' yet */ 2469 void owl_function_zlist(char *file, int elapsed, int timesort) { 2573 void owl_function_zlist(char *file, int elapsed, int timesort) 2574 { 2470 2575 char *ourfile, *tmp, buff[LINE], *line; 2471 2576 FILE *f; … … 2552 2657 } 2553 2658 2554 void owl_function_dump(char *filename) { 2659 void owl_function_dump(char *filename) 2660 { 2555 2661 int i, j, count; 2556 2662 owl_message *m; … … 2587 2693 2588 2694 2589 void owl_function_do_newmsgproc( ) {2695 void owl_function_do_newmsgproc(void) { 2590 2696 if (owl_global_get_newmsgproc(&g) && strcmp(owl_global_get_newmsgproc(&g), "")) { 2591 2697 /* if there's a process out there, we need to check on it */ … … 2610 2716 /* parent set the child's pid */ 2611 2717 owl_global_set_newmsgproc_pid(&g, i); 2612 waitpid(i, NULL, WNOHANG);2613 2718 owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", i); 2614 2719 } else { … … 2616 2721 char **parsed; 2617 2722 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; 2620 2731 2621 owl_function_debugmsg("About to exec : %s with %iarguments", parsed[0], myargc);2732 owl_function_debugmsg("About to exec \"%s\" with %d arguments", parsed[0], myargc); 2622 2733 2623 execvp(parsed[0], (char **)parsed);2734 execvp(parsed[0], parsed); 2624 2735 2625 2736 2626 2737 /* 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)); 2628 2740 _exit(127); 2629 2741 } … … 2634 2746 void owl_function_xterm_raise(void) { 2635 2747 printf("\033[5t"); 2636 fflush(stdout);2637 2748 } 2638 2749 2639 2750 void owl_function_xterm_deiconify(void) { 2640 2751 printf("\033[1t"); 2641 fflush(stdout); 2642 } 2752 }
Note: See TracChangeset
for help on using the changeset viewer.