merge from 2.2 - fix parsing of options
authorHerb Lewis <herb@samba.org>
Tue, 26 Feb 2002 20:04:54 +0000 (20:04 +0000)
committerHerb Lewis <herb@samba.org>
Tue, 26 Feb 2002 20:04:54 +0000 (20:04 +0000)
(This used to be commit c849e93392e3206b010949566a65a339f5064031)

source3/rpcclient/rpcclient.c

index 47a36b6ddac23c3faa8e55f8baed2f7ae1529b38..7cb56fe5e4fcb1a7cce3002868bafce4c7e50765 100644 (file)
@@ -566,10 +566,26 @@ static void usage(void)
        struct cmd_set **cmd_set;
        struct in_addr server_ip;
        NTSTATUS nt_status;
+       extern BOOL AllowDebugChange;
 
        setlinebuf(stdout);
 
        DEBUGLEVEL = 1;
+       AllowDebugChange = False;
+
+       /* Parse options */
+       if (argc == 0) {
+               usage();
+               return 0;
+       }
+       
+       if (strncmp("//", argv[1], 2) == 0 || strncmp("\\\\", argv[1], 2) == 0)
+               argv[1] += 2;
+
+       pstrcpy(server, argv[1]);
+
+       argv++;
+       argc--;
 
        while ((opt = getopt(argc, argv, "A:s:Nd:U:W:c:l:h")) != EOF) {
                switch (opt) {
@@ -625,20 +641,6 @@ static void usage(void)
                }
        }
 
-       argv += optind;
-       argc -= optind;
-
-       /* Parse options */
-       if (argc == 0) {
-               usage();
-               return 0;
-       }
-       
-       if (strncmp("//", argv[0], 2) == 0 || strncmp("\\\\", argv[0], 2) == 0)
-               argv[0] += 2;
-
-       pstrcpy(server, argv[0]);
-
        /* the following functions are part of the Samba debugging
           facilities.  See lib/debug.c */
        setup_logging("rpcclient", interactive);