getopt32: fix recently broken opt_complementary "--"

This commit is contained in:
Denis Vlasenko 2008-04-21 22:04:21 +00:00
parent 5a07a1d255
commit 9137341851

View File

@ -497,8 +497,9 @@ getopt32(char **argv, const char *applet_opts, ...)
if (argv[1] && argv[1][0] != '-' && argv[1][1] != '\0') { if (argv[1] && argv[1][0] != '-' && argv[1][1] != '\0') {
#if DONT_USE_PRINTF #if DONT_USE_PRINTF
char *pp = alloca(strlen(argv[1]) + 2); char *pp = alloca(strlen(argv[1]) + 2);
*pp++ = '-'; *pp = '-';
argv[1] = strcpy(pp, argv[1]); strcpy(pp + 1, argv[1]);
argv[1] = pp;
#else #else
argv[1] = xasprintf("-%s", argv[1]); argv[1] = xasprintf("-%s", argv[1]);
if (ENABLE_FEATURE_CLEAN_UP) if (ENABLE_FEATURE_CLEAN_UP)