Changeset e19eb97 for commands.c
- Timestamp:
- Aug 15, 2009, 7:08:18 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 1077891a
- Parents:
- fa4562c
- git-author:
- Anders Kaseorg <andersk@mit.edu> (08/04/09 02:37:51)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (08/15/09 19:08:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
rfa4562c re19eb97 5 5 #include "owl.h" 6 6 7 /* fn is "char *foo(int argc, c har **argv,char *buff)" */7 /* fn is "char *foo(int argc, const char *const *argv, const char *buff)" */ 8 8 #define OWLCMD_ARGS(name, fn, ctx, summary, usage, description) \ 9 9 { name, summary, usage, description, ctx, \ … … 24 24 actualname, NULL, NULL, NULL, NULL, NULL, NULL, NULL } 25 25 26 /* fn is "char *foo(void *ctx, int argc, c har **argv,char *buff)" */26 /* fn is "char *foo(void *ctx, int argc, const char *const *argv, const char *buff)" */ 27 27 #define OWLCMD_ARGS_CTX(name, fn, ctx, summary, usage, description) \ 28 28 { name, summary, usage, description, ctx, \ 29 NULL, NULL, NULL, NULL, ((char*(*)(void*,int,c har**,char*))fn), NULL, NULL, NULL }29 NULL, NULL, NULL, NULL, ((char*(*)(void*,int,const char*const *,const char*))fn), NULL, NULL, NULL } 30 30 31 31 /* fn is "void foo(void)" */ … … 1004 1004 } 1005 1005 1006 char *owl_command_help(int argc, c har **argv,char *buff)1006 char *owl_command_help(int argc, const char *const *argv, const char *buff) 1007 1007 { 1008 1008 if (argc!=2) { … … 1015 1015 } 1016 1016 1017 char *owl_command_zlist(int argc, c har **argv,char *buff)1017 char *owl_command_zlist(int argc, const char *const *argv, const char *buff) 1018 1018 { 1019 1019 int elapsed=0, timesort=0; 1020 c har *file=NULL;1020 const char *file=NULL; 1021 1021 1022 1022 argc--; … … 1076 1076 } 1077 1077 1078 char *owl_command_aim(int argc, c har **argv,char *buff)1078 char *owl_command_aim(int argc, const char *const *argv, const char *buff) 1079 1079 { 1080 1080 if (argc<2) { … … 1096 1096 } 1097 1097 1098 char *owl_command_addbuddy(int argc, c har **argv,char *buff)1098 char *owl_command_addbuddy(int argc, const char *const *argv, const char *buff) 1099 1099 { 1100 1100 if (argc!=3) { … … 1124 1124 } 1125 1125 1126 char *owl_command_delbuddy(int argc, c har **argv,char *buff)1126 char *owl_command_delbuddy(int argc, const char *const *argv, const char *buff) 1127 1127 { 1128 1128 if (argc!=3) { … … 1148 1148 } 1149 1149 1150 char *owl_command_join(int argc, c har **argv,char *buff)1150 char *owl_command_join(int argc, const char *const *argv, const char *buff) 1151 1151 { 1152 1152 if (argc!=3 && argc!=4) { … … 1172 1172 } 1173 1173 1174 char *owl_command_startup(int argc, c har **argv,char *buff)1175 { 1176 c har *ptr;1174 char *owl_command_startup(int argc, const char *const *argv, const char *buff) 1175 { 1176 const char *ptr; 1177 1177 1178 1178 if (argc<2) { … … 1193 1193 } 1194 1194 1195 char *owl_command_unstartup(int argc, c har **argv,char *buff)1196 { 1197 c har *ptr;1195 char *owl_command_unstartup(int argc, const char *const *argv, const char *buff) 1196 { 1197 const char *ptr; 1198 1198 1199 1199 if (argc<2) { … … 1213 1213 } 1214 1214 1215 char *owl_command_dump(int argc, c har **argv,char *buff)1215 char *owl_command_dump(int argc, const char *const *argv, const char *buff) 1216 1216 { 1217 1217 char *filename; … … 1227 1227 } 1228 1228 1229 char *owl_command_source(int argc, c har **argv,char *buff)1229 char *owl_command_source(int argc, const char *const *argv, const char *buff) 1230 1230 { 1231 1231 if (argc!=2) { … … 1238 1238 } 1239 1239 1240 char *owl_command_next(int argc, c har **argv,char *buff)1240 char *owl_command_next(int argc, const char *const *argv, const char *buff) 1241 1241 { 1242 1242 char *filter=NULL; … … 1268 1268 } 1269 1269 1270 char *owl_command_prev(int argc, c har **argv,char *buff)1270 char *owl_command_prev(int argc, const char *const *argv, const char *buff) 1271 1271 { 1272 1272 char *filter=NULL; … … 1298 1298 } 1299 1299 1300 char *owl_command_smartnarrow(int argc, c har **argv,char *buff)1300 char *owl_command_smartnarrow(int argc, const char *const *argv, const char *buff) 1301 1301 { 1302 1302 char *filtname = NULL; … … 1316 1316 } 1317 1317 1318 char *owl_command_smartfilter(int argc, c har **argv,char *buff)1318 char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff) 1319 1319 { 1320 1320 char *filtname = NULL; … … 1372 1372 } 1373 1373 1374 char *owl_command_loadsubs(int argc, c har **argv,char *buff)1374 char *owl_command_loadsubs(int argc, const char *const *argv, const char *buff) 1375 1375 { 1376 1376 if (argc == 2) { … … 1386 1386 1387 1387 1388 char *owl_command_loadloginsubs(int argc, c har **argv,char *buff)1388 char *owl_command_loadloginsubs(int argc, const char *const *argv, const char *buff) 1389 1389 { 1390 1390 if (argc == 2) { … … 1404 1404 } 1405 1405 1406 char *owl_command_start_command(int argc, c har **argv,char *buff)1406 char *owl_command_start_command(int argc, const char *const *argv, const char *buff) 1407 1407 { 1408 1408 buff = skiptokens(buff, 1); … … 1411 1411 } 1412 1412 1413 char *owl_command_zaway(int argc, c har **argv,char *buff)1413 char *owl_command_zaway(int argc, const char *const *argv, const char *buff) 1414 1414 { 1415 1415 if ((argc==1) || … … 1437 1437 1438 1438 1439 char *owl_command_aaway(int argc, c har **argv,char *buff)1439 char *owl_command_aaway(int argc, const char *const *argv, const char *buff) 1440 1440 { 1441 1441 if ((argc==1) || … … 1463 1463 1464 1464 1465 char *owl_command_away(int argc, c har **argv,char *buff)1465 char *owl_command_away(int argc, const char *const *argv, const char *buff) 1466 1466 { 1467 1467 if ((argc==1) || … … 1506 1506 } 1507 1507 1508 char *owl_command_set(int argc, c har **argv,char *buff)1509 { 1510 c har *var, *val;1508 char *owl_command_set(int argc, const char *const *argv, const char *buff) 1509 { 1510 const char *var, *val; 1511 1511 int silent=0; 1512 1512 int requirebool=0; … … 1537 1537 } 1538 1538 1539 char *owl_command_unset(int argc, c har **argv,char *buff)1540 { 1541 c har *var, *val;1539 char *owl_command_unset(int argc, const char *const *argv, const char *buff) 1540 { 1541 const char *var, *val; 1542 1542 int silent=0; 1543 1543 … … 1557 1557 } 1558 1558 1559 char *owl_command_print(int argc, c har **argv,char *buff)1560 { 1561 c har *var;1559 char *owl_command_print(int argc, const char *const *argv, const char *buff) 1560 { 1561 const char *var; 1562 1562 char valbuff[1024]; 1563 1563 … … 1582 1582 1583 1583 1584 char *owl_command_exec(int argc, c har **argv,char *buff)1584 char *owl_command_exec(int argc, const char *const *argv, const char *buff) 1585 1585 { 1586 1586 return owl_function_exec(argc, argv, buff, 0); 1587 1587 } 1588 1588 1589 char *owl_command_pexec(int argc, c har **argv,char *buff)1589 char *owl_command_pexec(int argc, const char *const *argv, const char *buff) 1590 1590 { 1591 1591 return owl_function_exec(argc, argv, buff, 1); 1592 1592 } 1593 1593 1594 char *owl_command_aexec(int argc, c har **argv,char *buff)1594 char *owl_command_aexec(int argc, const char *const *argv, const char *buff) 1595 1595 { 1596 1596 return owl_function_exec(argc, argv, buff, 2); 1597 1597 } 1598 1598 1599 char *owl_command_perl(int argc, c har **argv,char *buff)1599 char *owl_command_perl(int argc, const char *const *argv, const char *buff) 1600 1600 { 1601 1601 return owl_function_perl(argc, argv, buff, 0); 1602 1602 } 1603 1603 1604 char *owl_command_pperl(int argc, c har **argv,char *buff)1604 char *owl_command_pperl(int argc, const char *const *argv, const char *buff) 1605 1605 { 1606 1606 return owl_function_perl(argc, argv, buff, 1); 1607 1607 } 1608 1608 1609 char *owl_command_aperl(int argc, c har **argv,char *buff)1609 char *owl_command_aperl(int argc, const char *const *argv, const char *buff) 1610 1610 { 1611 1611 return owl_function_perl(argc, argv, buff, 2); 1612 1612 } 1613 1613 1614 char *owl_command_multi(int argc, c har **argv,char *buff)1614 char *owl_command_multi(int argc, const char *const *argv, const char *buff) 1615 1615 { 1616 1616 char *lastrv = NULL, *newbuff; … … 1647 1647 1648 1648 1649 char *owl_command_alias(int argc, c har **argv,char *buff)1649 char *owl_command_alias(int argc, const char *const *argv, const char *buff) 1650 1650 { 1651 1651 if (argc < 3) { … … 1659 1659 1660 1660 1661 char *owl_command_bindkey(int argc, c har **argv,char *buff)1661 char *owl_command_bindkey(int argc, const char *const *argv, const char *buff) 1662 1662 { 1663 1663 owl_keymap *km; … … 1688 1688 } 1689 1689 1690 char *owl_command_debug(int argc, c har **argv,char *buff)1690 char *owl_command_debug(int argc, const char *const *argv, const char *buff) 1691 1691 { 1692 1692 if (argc<2) { … … 1704 1704 } 1705 1705 1706 char *owl_command_term(int argc, c har **argv,char *buff)1706 char *owl_command_term(int argc, const char *const *argv, const char *buff) 1707 1707 { 1708 1708 if (argc<2) { … … 1721 1721 } 1722 1722 1723 char *owl_command_zlog(int argc, c har **argv,char *buff)1723 char *owl_command_zlog(int argc, const char *const *argv, const char *buff) 1724 1724 { 1725 1725 if ((argc<2) || (argc>3)) { … … 1745 1745 } 1746 1746 1747 char *owl_command_subscribe(int argc, c har **argv,char *buff)1748 { 1749 c har *class, *instance, *recip="";1747 char *owl_command_subscribe(int argc, const char *const *argv, const char *buff) 1748 { 1749 const char *class, *instance, *recip=""; 1750 1750 int temp=0; 1751 1751 int ret=0; … … 1795 1795 1796 1796 1797 char *owl_command_unsubscribe(int argc, c har **argv,char *buff)1798 { 1799 c har *class, *instance, *recip="";1797 char *owl_command_unsubscribe(int argc, const char *const *argv, const char *buff) 1798 { 1799 const char *class, *instance, *recip=""; 1800 1800 int temp=0; 1801 1801 … … 1843 1843 } 1844 1844 1845 char *owl_command_echo(int argc, c har **argv,char *buff)1845 char *owl_command_echo(int argc, const char *const *argv, const char *buff) 1846 1846 { 1847 1847 buff = skiptokens(buff, 1); … … 1860 1860 } 1861 1861 1862 char *owl_command_zwrite(int argc, c har **argv,char *buff)1862 char *owl_command_zwrite(int argc, const char *const *argv, const char *buff) 1863 1863 { 1864 1864 owl_zwrite z; … … 1884 1884 } 1885 1885 1886 char *owl_command_aimwrite(int argc, c har **argv,char *buff)1886 char *owl_command_aimwrite(int argc, const char *const *argv, const char *buff) 1887 1887 { 1888 1888 char *newbuff, *recip; 1889 c har **myargv;1889 const char *const *myargv; 1890 1890 int i, j, myargc; 1891 1891 owl_message *m; … … 1964 1964 } 1965 1965 1966 char *owl_command_loopwrite(int argc, c har **argv,char *buff)1966 char *owl_command_loopwrite(int argc, const char *const *argv, const char *buff) 1967 1967 { 1968 1968 owl_function_loopwrite_setup(); … … 1970 1970 } 1971 1971 1972 char *owl_command_zcrypt(int argc, c har **argv,char *buff)1972 char *owl_command_zcrypt(int argc, const char *const *argv, const char *buff) 1973 1973 { 1974 1974 #ifdef OWL_ENABLE_ZCRYPT … … 1998 1998 } 1999 1999 2000 char *owl_command_reply(int argc, c har **argv,char *buff)2000 char *owl_command_reply(int argc, const char *const *argv, const char *buff) 2001 2001 { 2002 2002 int edit=0; … … 2024 2024 } 2025 2025 2026 char *owl_command_filter(int argc, c har **argv,char *buff)2026 char *owl_command_filter(int argc, const char *const *argv, const char *buff) 2027 2027 { 2028 2028 owl_function_create_filter(argc, argv); … … 2030 2030 } 2031 2031 2032 char *owl_command_zlocate(int argc, c har **argv,char *buff)2032 char *owl_command_zlocate(int argc, const char *const *argv, const char *buff) 2033 2033 { 2034 2034 int auth; … … 2064 2064 * view --home 2065 2065 */ 2066 char *owl_command_view(int argc, c har **argv,char *buff)2066 char *owl_command_view(int argc, const char *const *argv, const char *buff) 2067 2067 { 2068 2068 /* First take the 'view --home' and 'view -r' cases */ … … 2088 2088 /* Now get 'view -d <expression>' */ 2089 2089 if (argc>=3 && !strcmp(argv[1], "-d")) { 2090 c har **myargv;2090 const char **myargv; 2091 2091 int i; 2092 2092 2093 myargv=owl_malloc((argc*sizeof(c har *))+50);2093 myargv=owl_malloc((argc*sizeof(const char *))+50); 2094 2094 myargv[0]=""; 2095 2095 myargv[1]="owl-dynamic"; … … 2136 2136 argv++; 2137 2137 } else if (!strcmp(argv[0], "-r")) { 2138 c har *foo;2138 const char *foo; 2139 2139 foo=owl_function_create_negative_filter(owl_view_get_filtname(owl_global_get_current_view(&g))); 2140 2140 owl_function_change_currentview_filter(foo); … … 2156 2156 } 2157 2157 2158 char *owl_command_show(int argc, c har **argv,char *buff)2158 char *owl_command_show(int argc, const char *const *argv, const char *buff) 2159 2159 { 2160 2160 if (argc<2) { … … 2213 2213 owl_function_show_quickstart(); 2214 2214 } else if (!strcmp(argv[1], "startup")) { 2215 c har *filename;2215 const char *filename; 2216 2216 2217 2217 filename=owl_global_get_startupfile(&g); … … 2226 2226 } 2227 2227 2228 char *owl_command_viewclass(int argc, c har **argv,char *buff)2228 char *owl_command_viewclass(int argc, const char *const *argv, const char *buff) 2229 2229 { 2230 2230 char *filtname; … … 2239 2239 } 2240 2240 2241 char *owl_command_viewuser(int argc, c har **argv,char *buff)2241 char *owl_command_viewuser(int argc, const char *const *argv, const char *buff) 2242 2242 { 2243 2243 char *filtname; … … 2258 2258 } 2259 2259 2260 char *owl_command_delete(int argc, c har **argv,char *buff)2260 char *owl_command_delete(int argc, const char *const *argv, const char *buff) 2261 2261 { 2262 2262 int move_after = 1; … … 2292 2292 } 2293 2293 2294 char *owl_command_undelete(int argc, c har **argv,char *buff)2294 char *owl_command_undelete(int argc, const char *const *argv, const char *buff) 2295 2295 { 2296 2296 int move_after = 1; … … 2326 2326 } 2327 2327 2328 char *owl_command_colorview(int argc, c har **argv,char *buff)2328 char *owl_command_colorview(int argc, const char *const *argv, const char *buff) 2329 2329 { 2330 2330 if (argc < 2 || argc > 3) { … … 2336 2336 } 2337 2337 2338 char *owl_command_colorclass(int argc, c har **argv,char *buff)2339 { 2340 c har *filtname;2338 char *owl_command_colorclass(int argc, const char *const *argv, const char *buff) 2339 { 2340 const char *filtname; 2341 2341 2342 2342 if (argc < 3 || argc > 4) { … … 2350 2350 } 2351 2351 2352 char *owl_command_zpunt(int argc, c har **argv,char *buff)2352 char *owl_command_zpunt(int argc, const char *const *argv, const char *buff) 2353 2353 { 2354 2354 owl_command_zpunt_and_zunpunt(argc, argv, 0); … … 2356 2356 } 2357 2357 2358 char *owl_command_zunpunt(int argc, c har **argv,char *buff)2358 char *owl_command_zunpunt(int argc, const char *const *argv, const char *buff) 2359 2359 { 2360 2360 owl_command_zpunt_and_zunpunt(argc, argv, 1); … … 2362 2362 } 2363 2363 2364 void owl_command_zpunt_and_zunpunt(int argc, c har **argv, int type)2364 void owl_command_zpunt_and_zunpunt(int argc, const char *const *argv, int type) 2365 2365 { 2366 2366 /* if type==0 then zpunt 2367 2367 * if type==1 then zunpunt 2368 2368 */ 2369 c har *class, *inst, *recip;2369 const char *class, *inst, *recip; 2370 2370 2371 2371 class="message"; … … 2399 2399 } 2400 2400 2401 char *owl_command_smartzpunt(int argc, c har **argv,char *buff)2401 char *owl_command_smartzpunt(int argc, const char *const *argv, const char *buff) 2402 2402 { 2403 2403 if (argc == 1) { … … 2411 2411 } 2412 2412 2413 char *owl_command_punt(int argc, c har **argv,char *buff)2413 char *owl_command_punt(int argc, const char *const *argv, const char *buff) 2414 2414 { 2415 2415 owl_command_punt_unpunt(argc, argv, buff, 0); … … 2417 2417 } 2418 2418 2419 char *owl_command_unpunt(int argc, c har **argv,char *buff)2419 char *owl_command_unpunt(int argc, const char *const *argv, const char *buff) 2420 2420 { 2421 2421 owl_command_punt_unpunt(argc, argv, buff, 1); … … 2423 2423 } 2424 2424 2425 void owl_command_punt_unpunt(int argc, c har ** argv,char *buff, int unpunt)2425 void owl_command_punt_unpunt(int argc, const char *const * argv, const char *buff, int unpunt) 2426 2426 { 2427 2427 owl_list * fl; … … 2457 2457 2458 2458 2459 char *owl_command_getview(int argc, c har **argv,char *buff)2460 { 2461 c har *filtname;2459 char *owl_command_getview(int argc, const char *const *argv, const char *buff) 2460 { 2461 const char *filtname; 2462 2462 if (argc != 1) { 2463 2463 owl_function_makemsg("Wrong number of arguments for %s", argv[0]); … … 2469 2469 } 2470 2470 2471 char *owl_command_getvar(int argc, c har **argv,char *buff)2471 char *owl_command_getvar(int argc, const char *const *argv, const char *buff) 2472 2472 { 2473 2473 char tmpbuff[1024]; … … 2483 2483 } 2484 2484 2485 char *owl_command_getfilter(int argc, c har **argv,char *buf)2485 char *owl_command_getfilter(int argc, const char *const *argv, const char *buf) 2486 2486 { 2487 2487 owl_filter *f; … … 2497 2497 } 2498 2498 2499 char *owl_command_search(int argc, c har **argv,char *buff)2499 char *owl_command_search(int argc, const char *const *argv, const char *buff) 2500 2500 { 2501 2501 int direction; 2502 c har *buffstart;2502 const char *buffstart; 2503 2503 2504 2504 direction=OWL_DIRECTION_DOWNWARDS; … … 2518 2518 } 2519 2519 2520 char *owl_command_setsearch(int argc, c har **argv,char *buff)2521 { 2522 c har *buffstart;2520 char *owl_command_setsearch(int argc, const char *const *argv, const char *buff) 2521 { 2522 const char *buffstart; 2523 2523 2524 2524 buffstart=skiptokens(buff, 1); … … 2528 2528 } 2529 2529 2530 char *owl_command_aimlogin(int argc, c har **argv,char *buff)2530 char *owl_command_aimlogin(int argc, const char *const *argv, const char *buff) 2531 2531 { 2532 2532 if ((argc<2) || (argc>3)) { … … 2549 2549 } 2550 2550 2551 char *owl_command_aimlogout(int argc, c har **argv,char *buff)2551 char *owl_command_aimlogout(int argc, const char *const *argv, const char *buff) 2552 2552 { 2553 2553 /* clear the buddylist */ … … 2558 2558 } 2559 2559 2560 char *owl_command_getstyle(int argc, c har **argv,char *buff)2561 { 2562 c har *stylename;2560 char *owl_command_getstyle(int argc, const char *const *argv, const char *buff) 2561 { 2562 const char *stylename; 2563 2563 if (argc != 1) { 2564 2564 owl_function_makemsg("Wrong number of arguments for %s", argv[0]); … … 2570 2570 } 2571 2571 2572 char *owl_command_error(int argc, c har **argv,char *buff)2572 char *owl_command_error(int argc, const char *const *argv, const char *buff) 2573 2573 { 2574 2574 buff = skiptokens(buff, 1); … … 2577 2577 } 2578 2578 2579 char *owl_command_message(int argc, c har **argv,char *buff)2579 char *owl_command_message(int argc, const char *const *argv, const char *buff) 2580 2580 { 2581 2581 buff = skiptokens(buff, 1); … … 2588 2588 owl_message *m; 2589 2589 owl_view *v; 2590 c har *cmd;2590 const char *cmd; 2591 2591 2592 2592 v = owl_global_get_current_view(&g); … … 2622 2622 owl_message *m; 2623 2623 owl_view *v; 2624 c har *cmd;2624 const char *cmd; 2625 2625 2626 2626 v = owl_global_get_current_view(&g); … … 2680 2680 { 2681 2681 owl_history *hist; 2682 c har *ptr;2682 const char *ptr; 2683 2683 2684 2684 hist=owl_editwin_get_history(e); … … 2701 2701 { 2702 2702 owl_history *hist; 2703 c har *ptr;2703 const char *ptr; 2704 2704 2705 2705 hist=owl_editwin_get_history(e); … … 2715 2715 } 2716 2716 2717 char *owl_command_edit_insert_text(owl_editwin *e, int argc, c har **argv,char *buff)2717 char *owl_command_edit_insert_text(owl_editwin *e, int argc, const char *const *argv, const char *buff) 2718 2718 { 2719 2719 buff = skiptokens(buff, 1);
Note: See TracChangeset
for help on using the changeset viewer.