Index: commands.c
===================================================================
--- commands.c	(revision fa4562c3dde208105e6938363d047e5622012e67)
+++ commands.c	(revision e19eb97bacd75cf02905ec2b7a6a73b9642b907a)
@@ -5,5 +5,5 @@
 #include "owl.h"
 
-/* fn is "char *foo(int argc, char **argv, char *buff)" */
+/* fn is "char *foo(int argc, const char *const *argv, const char *buff)" */
 #define OWLCMD_ARGS(name, fn, ctx, summary, usage, description) \
         { name, summary, usage, description, ctx, \
@@ -24,8 +24,8 @@
           actualname, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
 
-/* fn is "char *foo(void *ctx, int argc, char **argv, char *buff)" */
+/* fn is "char *foo(void *ctx, int argc, const char *const *argv, const char *buff)" */
 #define OWLCMD_ARGS_CTX(name, fn, ctx, summary, usage, description) \
         { name, summary, usage, description, ctx, \
-          NULL, NULL, NULL, NULL, ((char*(*)(void*,int,char**,char*))fn), NULL, NULL, NULL }
+          NULL, NULL, NULL, NULL, ((char*(*)(void*,int,const char*const *,const char*))fn), NULL, NULL, NULL }
 
 /* fn is "void foo(void)" */
@@ -1004,5 +1004,5 @@
 }
 
-char *owl_command_help(int argc, char **argv, char *buff)
+char *owl_command_help(int argc, const char *const *argv, const char *buff)
 {
   if (argc!=2) {
@@ -1015,8 +1015,8 @@
 }
 
-char *owl_command_zlist(int argc, char **argv, char *buff)
+char *owl_command_zlist(int argc, const char *const *argv, const char *buff)
 {
   int elapsed=0, timesort=0;
-  char *file=NULL;
+  const char *file=NULL;
 
   argc--;
@@ -1076,5 +1076,5 @@
 }
 
-char *owl_command_aim(int argc, char **argv, char *buff)
+char *owl_command_aim(int argc, const char *const *argv, const char *buff)
 {
   if (argc<2) {
@@ -1096,5 +1096,5 @@
 }
 
-char *owl_command_addbuddy(int argc, char **argv, char *buff)
+char *owl_command_addbuddy(int argc, const char *const *argv, const char *buff)
 {
   if (argc!=3) {
@@ -1124,5 +1124,5 @@
 }
 
-char *owl_command_delbuddy(int argc, char **argv, char *buff)
+char *owl_command_delbuddy(int argc, const char *const *argv, const char *buff)
 {
   if (argc!=3) {
@@ -1148,5 +1148,5 @@
 }
 
-char *owl_command_join(int argc, char **argv, char *buff)
+char *owl_command_join(int argc, const char *const *argv, const char *buff)
 {
   if (argc!=3 && argc!=4) {
@@ -1172,7 +1172,7 @@
 }
 
-char *owl_command_startup(int argc, char **argv, char *buff)
-{
-  char *ptr;
+char *owl_command_startup(int argc, const char *const *argv, const char *buff)
+{
+  const char *ptr;
 
   if (argc<2) {
@@ -1193,7 +1193,7 @@
 }
 
-char *owl_command_unstartup(int argc, char **argv, char *buff)
-{
-  char *ptr;
+char *owl_command_unstartup(int argc, const char *const *argv, const char *buff)
+{
+  const char *ptr;
 
   if (argc<2) {
@@ -1213,5 +1213,5 @@
 }
 
-char *owl_command_dump(int argc, char **argv, char *buff)
+char *owl_command_dump(int argc, const char *const *argv, const char *buff)
 {
   char *filename;
@@ -1227,5 +1227,5 @@
 }
 
-char *owl_command_source(int argc, char **argv, char *buff)
+char *owl_command_source(int argc, const char *const *argv, const char *buff)
 {
   if (argc!=2) {
@@ -1238,5 +1238,5 @@
 }
 
-char *owl_command_next(int argc, char **argv, char *buff)
+char *owl_command_next(int argc, const char *const *argv, const char *buff)
 {
   char *filter=NULL;
@@ -1268,5 +1268,5 @@
 }
 
-char *owl_command_prev(int argc, char **argv, char *buff)
+char *owl_command_prev(int argc, const char *const *argv, const char *buff)
 {
   char *filter=NULL;
@@ -1298,5 +1298,5 @@
 }
 
-char *owl_command_smartnarrow(int argc, char **argv, char *buff)
+char *owl_command_smartnarrow(int argc, const char *const *argv, const char *buff)
 {
   char *filtname = NULL;
@@ -1316,5 +1316,5 @@
 }
 
-char *owl_command_smartfilter(int argc, char **argv, char *buff)
+char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)
 {
   char *filtname = NULL;
@@ -1372,5 +1372,5 @@
 }
 
-char *owl_command_loadsubs(int argc, char **argv, char *buff)
+char *owl_command_loadsubs(int argc, const char *const *argv, const char *buff)
 {
   if (argc == 2) {
@@ -1386,5 +1386,5 @@
 
 
-char *owl_command_loadloginsubs(int argc, char **argv, char *buff)
+char *owl_command_loadloginsubs(int argc, const char *const *argv, const char *buff)
 {
   if (argc == 2) {
@@ -1404,5 +1404,5 @@
 }
 
-char *owl_command_start_command(int argc, char **argv, char *buff)
+char *owl_command_start_command(int argc, const char *const *argv, const char *buff)
 {
   buff = skiptokens(buff, 1);
@@ -1411,5 +1411,5 @@
 }
 
-char *owl_command_zaway(int argc, char **argv, char *buff)
+char *owl_command_zaway(int argc, const char *const *argv, const char *buff)
 {
   if ((argc==1) ||
@@ -1437,5 +1437,5 @@
 
 
-char *owl_command_aaway(int argc, char **argv, char *buff)
+char *owl_command_aaway(int argc, const char *const *argv, const char *buff)
 {
   if ((argc==1) ||
@@ -1463,5 +1463,5 @@
 
 
-char *owl_command_away(int argc, char **argv, char *buff)
+char *owl_command_away(int argc, const char *const *argv, const char *buff)
 {
   if ((argc==1) ||
@@ -1506,7 +1506,7 @@
 }
 
-char *owl_command_set(int argc, char **argv, char *buff)
-{
-  char *var, *val;
+char *owl_command_set(int argc, const char *const *argv, const char *buff)
+{
+  const char *var, *val;
   int  silent=0;
   int requirebool=0;
@@ -1537,7 +1537,7 @@
 }
 
-char *owl_command_unset(int argc, char **argv, char *buff)
-{
-  char *var, *val;
+char *owl_command_unset(int argc, const char *const *argv, const char *buff)
+{
+  const char *var, *val;
   int  silent=0;
 
@@ -1557,7 +1557,7 @@
 }
 
-char *owl_command_print(int argc, char **argv, char *buff)
-{
-  char *var;
+char *owl_command_print(int argc, const char *const *argv, const char *buff)
+{
+  const char *var;
   char valbuff[1024];
 
@@ -1582,35 +1582,35 @@
 
 
-char *owl_command_exec(int argc, char **argv, char *buff)
+char *owl_command_exec(int argc, const char *const *argv, const char *buff)
 {
   return owl_function_exec(argc, argv, buff, 0);
 }
 
-char *owl_command_pexec(int argc, char **argv, char *buff)
+char *owl_command_pexec(int argc, const char *const *argv, const char *buff)
 {
   return owl_function_exec(argc, argv, buff, 1);
 }
 
-char *owl_command_aexec(int argc, char **argv, char *buff)
+char *owl_command_aexec(int argc, const char *const *argv, const char *buff)
 {
   return owl_function_exec(argc, argv, buff, 2);
 }
 
-char *owl_command_perl(int argc, char **argv, char *buff)
+char *owl_command_perl(int argc, const char *const *argv, const char *buff)
 {
   return owl_function_perl(argc, argv, buff, 0);
 }
 
-char *owl_command_pperl(int argc, char **argv, char *buff)
+char *owl_command_pperl(int argc, const char *const *argv, const char *buff)
 {
   return owl_function_perl(argc, argv, buff, 1);
 }
 
-char *owl_command_aperl(int argc, char **argv, char *buff)
+char *owl_command_aperl(int argc, const char *const *argv, const char *buff)
 {
   return owl_function_perl(argc, argv, buff, 2);
 }
 
-char *owl_command_multi(int argc, char **argv, char *buff)
+char *owl_command_multi(int argc, const char *const *argv, const char *buff)
 {
   char *lastrv = NULL, *newbuff;
@@ -1647,5 +1647,5 @@
 
 
-char *owl_command_alias(int argc, char **argv, char *buff)
+char *owl_command_alias(int argc, const char *const *argv, const char *buff)
 {
   if (argc < 3) {
@@ -1659,5 +1659,5 @@
 
 
-char *owl_command_bindkey(int argc, char **argv, char *buff)
+char *owl_command_bindkey(int argc, const char *const *argv, const char *buff)
 {
   owl_keymap *km;
@@ -1688,5 +1688,5 @@
 }
 
-char *owl_command_debug(int argc, char **argv, char *buff)
+char *owl_command_debug(int argc, const char *const *argv, const char *buff)
 {
   if (argc<2) {
@@ -1704,5 +1704,5 @@
 }
 
-char *owl_command_term(int argc, char **argv, char *buff)
+char *owl_command_term(int argc, const char *const *argv, const char *buff)
 {
   if (argc<2) {
@@ -1721,5 +1721,5 @@
 }
 
-char *owl_command_zlog(int argc, char **argv, char *buff)
+char *owl_command_zlog(int argc, const char *const *argv, const char *buff)
 {
   if ((argc<2) || (argc>3)) {
@@ -1745,7 +1745,7 @@
 }
 
-char *owl_command_subscribe(int argc, char **argv, char *buff)
-{
-  char *class, *instance, *recip="";
+char *owl_command_subscribe(int argc, const char *const *argv, const char *buff)
+{
+  const char *class, *instance, *recip="";
   int temp=0;
   int ret=0;
@@ -1795,7 +1795,7 @@
 
 
-char *owl_command_unsubscribe(int argc, char **argv, char *buff)
-{
-  char *class, *instance, *recip="";
+char *owl_command_unsubscribe(int argc, const char *const *argv, const char *buff)
+{
+  const char *class, *instance, *recip="";
   int temp=0;
 
@@ -1843,5 +1843,5 @@
 }
 
-char *owl_command_echo(int argc, char **argv, char *buff)
+char *owl_command_echo(int argc, const char *const *argv, const char *buff)
 {
   buff = skiptokens(buff, 1);
@@ -1860,5 +1860,5 @@
 }
 
-char *owl_command_zwrite(int argc, char **argv, char *buff)
+char *owl_command_zwrite(int argc, const char *const *argv, const char *buff)
 {
   owl_zwrite z;
@@ -1884,8 +1884,8 @@
 }
 
-char *owl_command_aimwrite(int argc, char **argv, char *buff)
+char *owl_command_aimwrite(int argc, const char *const *argv, const char *buff)
 {
   char *newbuff, *recip;
-  char **myargv;
+  const char *const *myargv;
   int i, j, myargc;
   owl_message *m;
@@ -1964,5 +1964,5 @@
 }
 
-char *owl_command_loopwrite(int argc, char **argv, char *buff)
+char *owl_command_loopwrite(int argc, const char *const *argv, const char *buff)
 {
   owl_function_loopwrite_setup();
@@ -1970,5 +1970,5 @@
 }
 
-char *owl_command_zcrypt(int argc, char **argv, char *buff)
+char *owl_command_zcrypt(int argc, const char *const *argv, const char *buff)
 {
 #ifdef OWL_ENABLE_ZCRYPT
@@ -1998,5 +1998,5 @@
 }
 
-char *owl_command_reply(int argc, char **argv, char *buff)
+char *owl_command_reply(int argc, const char *const *argv, const char *buff)
 {
   int edit=0;
@@ -2024,5 +2024,5 @@
 }
 
-char *owl_command_filter(int argc, char **argv, char *buff)
+char *owl_command_filter(int argc, const char *const *argv, const char *buff)
 {
   owl_function_create_filter(argc, argv);
@@ -2030,5 +2030,5 @@
 }
 
-char *owl_command_zlocate(int argc, char **argv, char *buff)
+char *owl_command_zlocate(int argc, const char *const *argv, const char *buff)
 {
   int auth;
@@ -2064,5 +2064,5 @@
  * view --home
  */
-char *owl_command_view(int argc, char **argv, char *buff)
+char *owl_command_view(int argc, const char *const *argv, const char *buff)
 {
   /* First take the 'view --home' and 'view -r' cases */
@@ -2088,8 +2088,8 @@
   /* Now get 'view -d <expression>' */
   if (argc>=3 && !strcmp(argv[1], "-d")) {
-    char **myargv;
+    const char **myargv;
     int i;
 
-    myargv=owl_malloc((argc*sizeof(char *))+50);
+    myargv=owl_malloc((argc*sizeof(const char *))+50);
     myargv[0]="";
     myargv[1]="owl-dynamic";
@@ -2136,5 +2136,5 @@
       argv++;
     } else if (!strcmp(argv[0], "-r")) {
-      char *foo;
+      const char *foo;
       foo=owl_function_create_negative_filter(owl_view_get_filtname(owl_global_get_current_view(&g)));
       owl_function_change_currentview_filter(foo);
@@ -2156,5 +2156,5 @@
 }
 
-char *owl_command_show(int argc, char **argv, char *buff)
+char *owl_command_show(int argc, const char *const *argv, const char *buff)
 {
   if (argc<2) {
@@ -2213,5 +2213,5 @@
     owl_function_show_quickstart();
   } else if (!strcmp(argv[1], "startup")) {
-    char *filename;
+    const char *filename;
     
     filename=owl_global_get_startupfile(&g);
@@ -2226,5 +2226,5 @@
 }
 
-char *owl_command_viewclass(int argc, char **argv, char *buff)
+char *owl_command_viewclass(int argc, const char *const *argv, const char *buff)
 {
   char *filtname;
@@ -2239,5 +2239,5 @@
 }
 
-char *owl_command_viewuser(int argc, char **argv, char *buff)
+char *owl_command_viewuser(int argc, const char *const *argv, const char *buff)
 {
   char *filtname;
@@ -2258,5 +2258,5 @@
 }
 
-char *owl_command_delete(int argc, char **argv, char *buff)
+char *owl_command_delete(int argc, const char *const *argv, const char *buff)
 {
   int move_after = 1;
@@ -2292,5 +2292,5 @@
 }
 
-char *owl_command_undelete(int argc, char **argv, char *buff)
+char *owl_command_undelete(int argc, const char *const *argv, const char *buff)
 {
   int move_after = 1;
@@ -2326,5 +2326,5 @@
 }
 
-char *owl_command_colorview(int argc, char **argv, char *buff)
+char *owl_command_colorview(int argc, const char *const *argv, const char *buff)
 {
   if (argc < 2 || argc > 3) {
@@ -2336,7 +2336,7 @@
 }
 
-char *owl_command_colorclass(int argc, char **argv, char *buff)
-{
-  char *filtname;
+char *owl_command_colorclass(int argc, const char *const *argv, const char *buff)
+{
+  const char *filtname;
   
   if (argc < 3 || argc > 4) {
@@ -2350,5 +2350,5 @@
 }
 
-char *owl_command_zpunt(int argc, char **argv, char *buff)
+char *owl_command_zpunt(int argc, const char *const *argv, const char *buff)
 {
   owl_command_zpunt_and_zunpunt(argc, argv, 0);
@@ -2356,5 +2356,5 @@
 }
 
-char *owl_command_zunpunt(int argc, char **argv, char *buff)
+char *owl_command_zunpunt(int argc, const char *const *argv, const char *buff)
 {
   owl_command_zpunt_and_zunpunt(argc, argv, 1);
@@ -2362,10 +2362,10 @@
 }
 
-void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type)
+void owl_command_zpunt_and_zunpunt(int argc, const char *const *argv, int type)
 {
   /* if type==0 then zpunt
    * if type==1 then zunpunt
    */
-  char *class, *inst, *recip;
+  const char *class, *inst, *recip;
 
   class="message";
@@ -2399,5 +2399,5 @@
 }
 
-char *owl_command_smartzpunt(int argc, char **argv, char *buff)
+char *owl_command_smartzpunt(int argc, const char *const *argv, const char *buff)
 {
   if (argc == 1) {
@@ -2411,5 +2411,5 @@
 }
 
-char *owl_command_punt(int argc, char **argv, char *buff)
+char *owl_command_punt(int argc, const char *const *argv, const char *buff)
 {
   owl_command_punt_unpunt(argc, argv, buff, 0);
@@ -2417,5 +2417,5 @@
 }
 
-char *owl_command_unpunt(int argc, char **argv, char *buff)
+char *owl_command_unpunt(int argc, const char *const *argv, const char *buff)
 {
   owl_command_punt_unpunt(argc, argv, buff, 1);
@@ -2423,5 +2423,5 @@
 }
 
-void owl_command_punt_unpunt(int argc, char ** argv, char *buff, int unpunt)
+void owl_command_punt_unpunt(int argc, const char *const * argv, const char *buff, int unpunt)
 {
   owl_list * fl;
@@ -2457,7 +2457,7 @@
 
 
-char *owl_command_getview(int argc, char **argv, char *buff)
-{
-  char *filtname;
+char *owl_command_getview(int argc, const char *const *argv, const char *buff)
+{
+  const char *filtname;
   if (argc != 1) {
     owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
@@ -2469,5 +2469,5 @@
 }
 
-char *owl_command_getvar(int argc, char **argv, char *buff)
+char *owl_command_getvar(int argc, const char *const *argv, const char *buff)
 {
   char tmpbuff[1024];
@@ -2483,5 +2483,5 @@
 }
 
-char *owl_command_getfilter(int argc, char **argv, char *buf)
+char *owl_command_getfilter(int argc, const char *const *argv, const char *buf)
 {
   owl_filter *f;
@@ -2497,8 +2497,8 @@
 }
 
-char *owl_command_search(int argc, char **argv, char *buff)
+char *owl_command_search(int argc, const char *const *argv, const char *buff)
 {
   int direction;
-  char *buffstart;
+  const char *buffstart;
 
   direction=OWL_DIRECTION_DOWNWARDS;
@@ -2518,7 +2518,7 @@
 }
 
-char *owl_command_setsearch(int argc, char **argv, char *buff)
-{
-  char *buffstart;
+char *owl_command_setsearch(int argc, const char *const *argv, const char *buff)
+{
+  const char *buffstart;
 
   buffstart=skiptokens(buff, 1);
@@ -2528,5 +2528,5 @@
 }
 
-char *owl_command_aimlogin(int argc, char **argv, char *buff)
+char *owl_command_aimlogin(int argc, const char *const *argv, const char *buff)
 {
   if ((argc<2) || (argc>3)) {
@@ -2549,5 +2549,5 @@
 }
 
-char *owl_command_aimlogout(int argc, char **argv, char *buff)
+char *owl_command_aimlogout(int argc, const char *const *argv, const char *buff)
 {
   /* clear the buddylist */
@@ -2558,7 +2558,7 @@
 }
 
-char *owl_command_getstyle(int argc, char **argv, char *buff)
-{
-  char *stylename;
+char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)
+{
+  const char *stylename;
   if (argc != 1) {
     owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
@@ -2570,5 +2570,5 @@
 }
 
-char *owl_command_error(int argc, char **argv, char *buff)
+char *owl_command_error(int argc, const char *const *argv, const char *buff)
 {
     buff = skiptokens(buff, 1);
@@ -2577,5 +2577,5 @@
 }
 
-char *owl_command_message(int argc, char **argv, char *buff)
+char *owl_command_message(int argc, const char *const *argv, const char *buff)
 {
     buff = skiptokens(buff, 1);
@@ -2588,5 +2588,5 @@
   owl_message *m;
   owl_view *v;
-  char *cmd;
+  const char *cmd;
 
   v = owl_global_get_current_view(&g);
@@ -2622,5 +2622,5 @@
   owl_message *m;
   owl_view *v;
-  char *cmd;
+  const char *cmd;
 
   v = owl_global_get_current_view(&g);
@@ -2680,5 +2680,5 @@
 {
   owl_history *hist;
-  char *ptr;
+  const char *ptr;
 
   hist=owl_editwin_get_history(e);
@@ -2701,5 +2701,5 @@
 {
   owl_history *hist;
-  char *ptr;
+  const char *ptr;
 
   hist=owl_editwin_get_history(e);
@@ -2715,5 +2715,5 @@
 }
 
-char *owl_command_edit_insert_text(owl_editwin *e, int argc, char **argv, char *buff)
+char *owl_command_edit_insert_text(owl_editwin *e, int argc, const char *const *argv, const char *buff)
 {
   buff = skiptokens(buff, 1);
