summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-03-30 17:09:58 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-03-30 17:09:58 (GMT)
commit852ba7eb2a38a4d57cea73bf34b11f8e65f004e1 (patch)
tree65ee4863f4b548722fb1e85dcd54949eba624b7d /Modules/main.c
parente98922fb80a38fe9b6eb9612f92d9470f2cd2fa8 (diff)
downloadcpython-852ba7eb2a38a4d57cea73bf34b11f8e65f004e1.zip
cpython-852ba7eb2a38a4d57cea73bf34b11f8e65f004e1.tar.gz
cpython-852ba7eb2a38a4d57cea73bf34b11f8e65f004e1.tar.bz2
Patch #672053: Return a result from Py_Main, instead of exiting.
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 056a6b6..50440b3 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -88,7 +88,7 @@ PYTHONCASEOK : ignore case in 'import' statements (Windows).\n\
";
-static void
+static int
usage(int exitcode, char* program)
{
FILE *f = exitcode ? stderr : stdout;
@@ -105,14 +105,14 @@ usage(int exitcode, char* program)
#if defined(__VMS)
if (exitcode == 0) {
/* suppress 'error' message */
- exit(1);
+ return 1;
}
else {
/* STS$M_INHIB_MSG + SS$_ABORT */
- exit(0x1000002c);
+ return 0x1000002c;
}
#else
- exit(exitcode);
+ return exitcode;
#endif
/*NOTREACHED*/
}
@@ -194,7 +194,7 @@ Py_Main(int argc, char **argv)
fprintf(stderr,
"-Q option should be `-Qold', "
"`-Qwarn', `-Qwarnall', or `-Qnew' only\n");
- usage(2, argv[0]);
+ return usage(2, argv[0]);
/* NOTREACHED */
case 'i':
@@ -255,18 +255,18 @@ Py_Main(int argc, char **argv)
/* This space reserved for other options */
default:
- usage(2, argv[0]);
+ return usage(2, argv[0]);
/*NOTREACHED*/
}
}
if (help)
- usage(0, argv[0]);
+ return usage(0, argv[0]);
if (version) {
fprintf(stderr, "Python %s\n", PY_VERSION);
- exit(0);
+ return 0;
}
if (!saw_inspect_flag &&
@@ -291,7 +291,7 @@ Py_Main(int argc, char **argv)
if ((fp = fopen(filename, "r")) == NULL) {
fprintf(stderr, "%s: can't open file '%s'\n",
argv[0], filename);
- exit(2);
+ return 2;
}
else if (skipfirstline) {
int ch;