[885] in Zephyr_Bugs

home help back first fref pref prev next nref lref last post

revised zctl.c patch

daemon@ATHENA.MIT.EDU (Derrick J Brashear)
Mon Aug 4 13:37:41 1997

Date: Mon, 4 Aug 1997 13:37:27 -0400 (EDT)
From: Derrick J Brashear <shadow@DEMENTIA.ORG>
Reply-To: Derrick J Brashear <shadow@DEMENTIA.ORG>
To: bug-zephyr@MIT.EDU

This diff should make everyone happy. It takes advantage of the fact that if
you say zctl add 'foo * *' that's still only 3 arguments and hence it doesn't
(can't) be broken to do it the old way.

*** /usr/tmp/zsrc/zephyr/clients/zctl/zctl.c	Thu Apr  4 19:30:34 1996
--- zctl.c	Mon Aug  4 12:02:24 1997
***************
*** 120,125 ****
--- 120,126 ----
          }
  
          if (argc > 1) {
+           if (argc <= 3) {
              *ssline = '\0';
              for (i=1;i<argc;i++)
                (void) sprintf(ssline+strlen(ssline),"%s ",argv[i]);
***************
*** 128,137 ****
                  if (code)
                      fprintf (stderr, "%s: %s: %s\n",
                               argv[0], error_message (code), ssline);
                  exit((code != 0));
          } 
  
         printf("ZCTL $Revision: 1.28 $ (Protocol %s%d.%d) - Type '?' for a
list of commands.\n\n",
                 ZVERSIONHDR,
                 ZVERSIONMAJOR,ZVERSIONMINOR);
          
--- 129,144 ----
              if (code)
                fprintf (stderr, "%s: %s: %s\n",
                         argv[0], error_message (code), ssline);
+           } else {
+             code = ss_execute_command(sci_idx,&argv[1]);
+             if (code)
+               fprintf (stderr, "%s: %s: %s\n",
+                        argv[0], error_message (code), argv[1]);
+           }
                  exit((code != 0));
          } 
  
		printf("ZCTL $Revision: 1.28 $ (Protocol %s%d.%d) - Type '?'
for a list of commands.\n\n",
                 ZVERSIONHDR,
                 ZVERSIONMAJOR,ZVERSIONMINOR);
          


home help back first fref pref prev next nref lref last post