Whamcloud - gitweb
b=12599
[fs/lustre-release.git] / lnet / utils / parser.c
index b91295b..ee9604e 100644 (file)
 #include <unistd.h>
 #include <sys/param.h>
 #include <assert.h>
-
-#ifdef HAVE_LIBREADLINE
-#define        READLINE_LIBRARY
-#include <readline/readline.h>
-
-/* completion_matches() is #if 0-ed out in modern glibc */
-#ifndef completion_matches
-#  define completion_matches rl_completion_matches
-#endif
-#endif
-
-extern void using_history(void);
-extern void stifle_history(int);
-extern void add_history(char *);
+#include <lnet/api-support.h>
 
 #include "parser.h"
 
@@ -346,6 +333,10 @@ int Parser_commands(void)
                 if (*s) {
                         add_history(s);
                         rc = execute_line(s);
+
+                        /* reset optind to 0 to tell getopt
+                         * to reinitialize itself */
+                        optind = 0;
                 }
                 
                 free(line);