comparison Python/getopt.c @ 46406:c1fa2e758e05 legacy-trunk

Applied patch #2617 from Frank Wierzbicki wit some extras from me -J and -X are now reserved for Jython and non-standard arguments (e.g. IronPython). I've added some extra comments to make sure the reservation don't get missed in the future.
author Christian Heimes <christian@cheimes.de>
date Sat, 12 Apr 2008 13:03:03 +0000
parents c48b3a68f696
children 7c21cc14b94f
comparison
equal deleted inserted replaced
46403:a24856ba77fe 46406:c1fa2e758e05
78 opt_ptr = &argv[_PyOS_optind++][1]; 78 opt_ptr = &argv[_PyOS_optind++][1];
79 } 79 }
80 80
81 if ( (option = *opt_ptr++) == '\0') 81 if ( (option = *opt_ptr++) == '\0')
82 return -1; 82 return -1;
83 83
84 if (option == 'J') {
85 fprintf(stderr, "-J is reserved for Jython\n");
86 return '_';
87 }
88
89 if (option == 'X') {
90 fprintf(stderr,
91 "-X is reserved for non-standard arguments\n");
92 return '_';
93 }
94
84 if ((ptr = strchr(optstring, option)) == NULL) { 95 if ((ptr = strchr(optstring, option)) == NULL) {
85 if (_PyOS_opterr) 96 if (_PyOS_opterr)
86 fprintf(stderr, "Unknown option: -%c\n", option); 97 fprintf(stderr, "Unknown option: -%c\n", option);
87 98
88 return '_'; 99 return '_';