1
0
Kaynağa Gözat

Don't set optind for command line options parsing. The opt parsing within query is a problem

git-svn-id: https://klish.googlecode.com/svn/trunk@590 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 12 yıl önce
ebeveyn
işleme
36567a4fbc
3 değiştirilmiş dosya ile 2 ekleme ve 4 silme
  1. 0 1
      bin/clish.cpp
  2. 0 1
      bin/konf.c
  3. 2 2
      konf/query/query.c

+ 0 - 1
bin/clish.cpp

@@ -119,7 +119,6 @@ int main(int argc, char **argv)
 	cmds = lub_list_new(NULL);
 
 	/* Parse command line options */
-	optind = 1;
 	while(1) {
 		int opt;
 #ifdef HAVE_GETOPT_H

+ 0 - 1
bin/konf.c

@@ -72,7 +72,6 @@ int main(int argc, char **argv)
 	sigaction(SIGPIPE, &sigpipe_act, NULL);
 
 	/* Parse command line options */
-	optind = 1;
 	while(1) {
 		int opt;
 #ifdef HAVE_GETOPT_H

+ 2 - 2
konf/query/query.c

@@ -107,7 +107,7 @@ int konf_query_parse(konf_query_t *this, int argc, char **argv)
 	};
 #endif
 
-	optind = 1;
+	optind = 0;
 	while(1) {
 		int opt;
 #ifdef HAVE_GETOPT_H
@@ -209,7 +209,7 @@ int konf_query_parse(konf_query_t *this, int argc, char **argv)
 	if ((pwdc = argc - optind) < 0)
 		return -1;
 
-	for (i = 0; i < pwdc; i ++)
+	for (i = 0; i < pwdc; i++)
 		konf_query_add_pwd(this, argv[optind + i]);
 
 	return 0;