mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	* pythonmain.c: -k option, usage message, more environment flags.
(the latter also in frozenmain.c) * ceval.c: global 'killprint' flag raises exception when printing an expression statement's value (useful for finding stray output) * timemodule.c: add asctime() and ctime(). Change julian date to 1-based origin (as intended and documented). * Removed unused DO_TIMES stuff from timemodule.c. Added 'epoch' and 'day0' globals (year where time.time() == 0 and day of the week the epoch started).
This commit is contained in:
		
							parent
							
								
									5ef74b8f8e
								
							
						
					
					
						commit
						9e90a672b4
					
				
					 5 changed files with 118 additions and 59 deletions
				
			
		|  | @ -30,28 +30,43 @@ extern char *getenv(); | |||
| 
 | ||||
| extern int debugging; | ||||
| extern int verbose; | ||||
| extern int killprint; | ||||
| 
 | ||||
| main(argc, argv) | ||||
| 	int argc; | ||||
| 	char **argv; | ||||
| { | ||||
| 	char *p; | ||||
| 	int n, inspect, sts; | ||||
| 	int n; | ||||
| 
 | ||||
| 	if ((p = getenv("PYTHONDEBUG")) && *p != '\0') | ||||
| 		debugging = 1; | ||||
| 	if ((p = getenv("PYTHONVERBOSE")) && *p != '\0') | ||||
| 		verbose = 1; | ||||
| 	initargs(&argc, &argv); /* Defined in config*.c */ | ||||
| 	if ((p = getenv("PYTHONINSPECT")) && *p != '\0') | ||||
| 		inspect = 1; | ||||
| 	if ((p = getenv("PYTHONKILLPRINT")) && *p != '\0') | ||||
| 		killprint = 1; | ||||
| 
 | ||||
| 	initargs(&argc, &argv); | ||||
| 	initall(); | ||||
| 	setpythonargv(argc, argv); | ||||
| 
 | ||||
| 	n = init_frozen("__main__"); | ||||
| 	if (n == 0) | ||||
| 		fatal("__main__ not frozen"); | ||||
| 	if (n < 0) { | ||||
| 		print_error(); | ||||
| 		goaway(1); | ||||
| 		sts = 1; | ||||
| 	} | ||||
| 	else | ||||
| 		goaway(0); | ||||
| 		sts = 0; | ||||
| 
 | ||||
| 	if (inspect && isatty((int)fileno(stdin)) && | ||||
| 	    (filename != NULL || command != NULL)) | ||||
| 		sts = run(stdin, "<stdin>") != 0; | ||||
| 
 | ||||
| 	goaway(sts); | ||||
| 	/*NOTREACHED*/ | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum