Mercurial > cpython-lru_cache-weakref
diff Python/pythonmain.c @ 560:0614d887d10a legacy-trunk
Stop option processing immediately after "-c command",
leaving additional options for the command to handle.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 02 Jan 1992 16:16:18 +0000 |
| parents | e198cc98a4fd |
| children | 0868176365d7 |
line wrap: on
line diff
--- a/Python/pythonmain.c Wed Jan 01 19:35:13 1992 +0000 +++ b/Python/pythonmain.c Thu Jan 02 16:16:18 1992 +0000 @@ -65,8 +65,21 @@ initargs(&argc, &argv); /* Defined in config*.c */ while ((c = getopt(argc, argv, "c:")) != EOF) { + if (c == 'c') { + /* -c is the last option; following arguments + that look like options are left for the + the command to interpret. */ + command = malloc(strlen(optarg) + 2); + /* Ignore malloc errors this early... */ + strcpy(command, optarg); + strcat(command, "\n"); + break; + } + switch (c) { + /* This space reserved for other options */ + default: fprintf(stderr, "usage: %s [-c cmd | file | -] [arg] ...\n", @@ -74,18 +87,6 @@ exit(2); /*NOTREACHED*/ - case 'c': - if (command != NULL) { - fprintf(stderr, "%s: duplicate -c option\n", - argv[0]); - exit(2); - } - command = malloc(strlen(optarg) + 2); - /* Ignore malloc errors this early... */ - strcpy(command, optarg); - strcat(command, "\n"); - break; - } }
