comparison Python/pythonmain.c @ 618:189ee3beebb5 legacy-trunk

Added -d option (increments debugging variable); mostly to get rid of a compiler warning.
author Guido van Rossum <guido@python.org>
date Sun, 19 Jan 1992 16:48:36 +0000
parents 0868176365d7
children 2f95a01d6c1f
comparison
equal deleted inserted replaced
617:755bb8efcc2d 618:189ee3beebb5
39 39
40 extern char *getpythonpath(); 40 extern char *getpythonpath();
41 41
42 extern grammar gram; /* From graminit.c */ 42 extern grammar gram; /* From graminit.c */
43 43
44 #ifdef DEBUG
45 int debugging; /* Needed by parser.c */ 44 int debugging; /* Needed by parser.c */
46 #endif
47 45
48 /* Interface to getopt(): */ 46 /* Interface to getopt(): */
49 extern int optind; 47 extern int optind;
50 extern char *optarg; 48 extern char *optarg;
51 extern int getopt PROTO((int, char **, char *)); 49 extern int getopt PROTO((int, char **, char *));
60 char *filename = NULL; 58 char *filename = NULL;
61 FILE *fp = stdin; 59 FILE *fp = stdin;
62 60
63 initargs(&argc, &argv); /* Defined in config*.c */ 61 initargs(&argc, &argv); /* Defined in config*.c */
64 62
65 while ((c = getopt(argc, argv, "c:")) != EOF) { 63 while ((c = getopt(argc, argv, "c:d")) != EOF) {
66 if (c == 'c') { 64 if (c == 'c') {
67 /* -c is the last option; following arguments 65 /* -c is the last option; following arguments
68 that look like options are left for the 66 that look like options are left for the
69 the command to interpret. */ 67 the command to interpret. */
70 command = malloc(strlen(optarg) + 2); 68 command = malloc(strlen(optarg) + 2);
74 break; 72 break;
75 } 73 }
76 74
77 switch (c) { 75 switch (c) {
78 76
77 case 'd':
78 debugging++;
79 break;
80
79 /* This space reserved for other options */ 81 /* This space reserved for other options */
80 82
81 default: 83 default:
82 fprintf(stderr, 84 fprintf(stderr,
83 "usage: %s [-c cmd | file | -] [arg] ...\n", 85 "usage: %s [-c cmd | file | -] [arg] ...\n",