another four next_token() removals (using getopt instead)
authorLuke Leighton <lkcl@samba.org>
Mon, 22 Nov 1999 19:46:26 +0000 (19:46 +0000)
committerLuke Leighton <lkcl@samba.org>
Mon, 22 Nov 1999 19:46:26 +0000 (19:46 +0000)
(This used to be commit 3e76ca9b172e1a6886e714d6a36453f30ff3e771)

source3/rpcclient/cmd_atsvc.c
source3/rpcclient/cmd_brs.c
source3/rpcclient/cmd_eventlog.c
source3/rpcclient/cmd_netlogon.c

index b10c55ad8aa73b710b8a12de6b0725bfa7e62821..5c5986eaa03fb214756a0093960e6c805ef8ce32 100644 (file)
@@ -169,7 +169,6 @@ scheduler add job
 void cmd_at(struct client_info *info, int argc, char *argv[])
 {
        uint16 nt_pipe_fnum;
-       pstring temp;
        fstring dest_wks;
        BOOL add = False;
        BOOL del = False;
@@ -182,33 +181,36 @@ void cmd_at(struct client_info *info, int argc, char *argv[])
        uint8 flags = JOB_NONINTERACTIVE;
        pstring command;
 
-        while (next_token(NULL, temp, NULL, sizeof(temp)))
+        while (argc > 1)
        {
-               if (checkopt(temp, "DELETE", NULL))
+               argc--;
+               argv++;
+
+               if (checkopt(argv[0], "DELETE", NULL))
                {
                        del = True;
                        continue;
                }
-               else if (checkopt(temp, "YES", NULL))
+               else if (checkopt(argv[0], "YES", NULL))
                {
                        /* Compatibility */
                        continue;
                }
 
-               jobid = strtol(temp, &p, 10);
+               jobid = strtol(argv[0], &p, 10);
                if (*p == 0)   /* Entirely numeric field */
                        continue;
 
-               if (!strcasecmp(temp, "NOW"))
+               if (!strcasecmp(argv[0], "NOW"))
                {
                        if (!at_soon(dest_wks, &hours, &minutes, &seconds))
                        {
                                return;
                        }
                }
-               else if (sscanf(temp, "%d:%d:%d", &hours, &minutes, &seconds) >= 2)
+               else if (sscanf(argv[0], "%d:%d:%d", &hours, &minutes, &seconds) >= 2)
                {
-                       p = strchr(temp, 0);
+                       p = strchr(argv[0], 0);
 
                        if (!strcasecmp(p-2, "AM"))
                        {
@@ -236,24 +238,26 @@ void cmd_at(struct client_info *info, int argc, char *argv[])
                command[0] = 0;
                p = NULL;
 
-               if (!next_token(NULL, temp, NULL, sizeof(temp)))
-                       break;
+               if (argc <= 1) break;
+               argc--;
+               argv++;
 
-               if (checkopt(temp, "INTERACTIVE", NULL))
+               if (checkopt(argv[0], "INTERACTIVE", NULL))
                {
                        flags &= ~JOB_NONINTERACTIVE;
 
-                       if (!next_token(NULL, temp, NULL, sizeof(temp)))
-                               break;
+                       if (argc <= 1) break;
+                       argc--;
+                       argv++;
                }
 
-               if (checkopt(temp, "EVERY", &p))
+               if (checkopt(argv[0], "EVERY", &p))
                {
                        flags |= JOB_PERIODIC;
                }
                else
                {
-                       checkopt(temp, "NEXT", &p);
+                       checkopt(argv[0], "NEXT", &p);
                }
 
                if (p != NULL)
@@ -268,16 +272,18 @@ void cmd_at(struct client_info *info, int argc, char *argv[])
                                weekdays = 0x7F;
                        }
 
-                       if (!next_token(NULL, temp, NULL, sizeof(temp)))
-                               break;
+                       if (argc <= 1) break;
+                       argc--;
+                       argv++;
                }
 
                while (True)
                {
-                       safe_strcat(command, temp, sizeof(command));
+                       safe_strcat(command, argv[0], sizeof(command));
 
-                       if (!next_token(NULL, temp, NULL, sizeof(temp)))
-                               break;
+                       if (argc <= 1) break;
+                       argc--;
+                       argv++;
 
                        safe_strcat(command, " ", sizeof(command));
                }
index 428a5c93ba1a37d4827afe76a8b870d99153568f..ff8e1cf66a8db4242e972187cfad47aa5b3eb43f 100644 (file)
@@ -45,7 +45,6 @@ void cmd_brs_query_info(struct client_info *info, int argc, char *argv[])
 {
        uint16 nt_pipe_fnum;
        fstring dest_brs;
-       fstring tmp;
        BRS_INFO_100 ctr;
        uint32 info_level = 100;
 
@@ -57,9 +56,9 @@ void cmd_brs_query_info(struct client_info *info, int argc, char *argv[])
        fstrcat(dest_brs, info->dest_host);
        strupper(dest_brs);
 
-       if (next_token(NULL, tmp, NULL, sizeof(tmp)))
+       if (argc > 1)
        {
-               info_level = (uint32)strtol(tmp, (char**)NULL, 10);
+               info_level = (uint32)strtol(argv[1], (char**)NULL, 10);
        }
 
        DEBUG(4,("cmd_brs_query_info: server:%s info level: %d\n",
index c836564007a87938626d581cab3843ec35b1783f..2a18645196cea9c1c1dca0d7f30bce505a340ae6 100644 (file)
@@ -50,14 +50,13 @@ void cmd_eventlog(struct client_info *info, int argc, char *argv[])
        uint32 num_of_bytes;
        EVENTLOGRECORD ev;
        
-       fstring journal;
-       fstring temp;
+       char *journal = NULL;
        
        flags=EVENTLOG_READ_SEQUENTIAL|EVENTLOG_READ_BACKWARD;
 
-       while (next_token(NULL, temp, NULL, sizeof(temp)))
+       if (argc > 1)
        {
-               fstrcpy(journal, temp);
+               journal = argv[1];
        }
 
        /* open scheduler session. */
index ed30a3122a652c3145f19b12fd85ebc73320e654..c255ff5370d9ce413ec2f37abb59f1b2042dd07c 100644 (file)
@@ -63,7 +63,10 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[])
        new_mach_pwd[0] = 0;
 #endif
 
-       if (!next_token(NULL, nt_user_name, NULL, sizeof(nt_user_name)))
+       argc--;
+       argv++;
+
+       if (argc < 1)
        {
                fstrcpy(nt_user_name, smb_cli->user_name);
                if (nt_user_name[0] == 0)
@@ -72,10 +75,17 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[])
                        return;
                }
        }
+       else
+       {
+               fstrcpy(nt_user_name, argv[0]);
+       }
+
+       argc--;
+       argv++;
 
-       if (next_token(NULL, password, NULL, sizeof(password)))
+       if (argc < 2)
        {
-               nt_password = password;
+               nt_password = argv[0];
        }
        else
        {
@@ -146,17 +156,19 @@ void cmd_netlogon_domain_test(struct client_info *info, int argc, char *argv[])
 {
        uint16 nt_pipe_fnum;
 
-       fstring nt_trust_dom;
+       char *nt_trust_dom;
        BOOL res = True;
        unsigned char trust_passwd[16];
        fstring inter_dom_acct;
 
-       if (!next_token(NULL, nt_trust_dom, NULL, sizeof(nt_trust_dom)))
+       if (argc < 2)
        {
                report(out_hnd,"domtest: must specify domain name\n");
                return;
        }
 
+       nt_trust_dom = argv[1];
+
        DEBUG(5,("do_nt_login_test: domain %s\n", nt_trust_dom));
 
        fstrcpy(inter_dom_acct, nt_trust_dom);