[ircd-ratbox] [PATCH] getopt fix

Tomáš Janoušek tomi at nomi.cz
Mon Jun 21 12:22:16 EDT 2004


Hi,

Getopt was not moving argv pointer when used an argument.
Patch attached.
-- 
.------   Tomáš Janoušek   alias Liskni_si   ------.
| NOMI team, developer, http://{www,tomi}.nomi.cz/ |
' tomi at nomi.cz, ICQ#161807083, tel.: +420608876277 '
-------------- next part --------------
--- src/getopt.c.old	2004-04-12 18:18:51.000000000 +0200
+++ src/getopt.c	2004-06-21 18:20:15.000000000 +0200
@@ -84,6 +84,9 @@
 					}
 
 					*((int *) opts[i].argloc) = atoi((*argv)[1]);
+
+					(*argc)--;
+					(*argv)++;
 					break;
 				case STRING:
 					if(*argc < 2)
@@ -97,6 +100,9 @@
 					*((char **) opts[i].argloc) =
 						malloc(strlen((*argv)[1]) + 1);
 					strcpy(*((char **) opts[i].argloc), (*argv)[1]);
+
+					(*argc)--;
+					(*argv)++;
 					break;
 
 				case USAGE:


More information about the ircd-ratbox mailing list