History

fix options in C scripts after -run

grischka committed 18 years ago

Commit f2698681 parent 5247bbc1 file · +14 −17Browse files

Unified · Split

tcc.c+14−17
@@ -10761,15 +10761,8 @@ int parse_args(TCCState *s, int argc, char **argv) · 10760 unmodified lines
10761 char *r;10761 char *r;
10762 10762
10763 optind = 0;10763 optind = 0;
10764 while (1) {10764 while (optind < argc) {
10765 if (optind >= argc) {10765
10766 if (nb_files == 0 && !print_search_dirs) {
10767 if (verbose)
10768 exit(0);
10769 goto show_help;
10770 }
10771 break;
10772 }
10773 r = argv[optind++];10766 r = argv[optind++];
10774 if (r[0] != '-' || r[1] == '\0') {10767 if (r[0] != '-' || r[1] == '\0') {
10775 /* add a new file */10768 /* add a new file */
@@ -10808,15 +10801,14 @@ int parse_args(TCCState *s, int argc, char **argv) · 32 unmodified lines
10808 }10801 }
10809 } else {10802 } else {
10810 if (*r1 != '\0')10803 if (*r1 != '\0')
10811 goto show_help;10804 return 0;
10812 optarg = NULL;10805 optarg = NULL;
10813 }10806 }
10814 10807
10815 switch(popt->index) {10808 switch(popt->index) {
10816 case TCC_OPTION_HELP:10809 case TCC_OPTION_HELP:
10817 show_help:10810 return 0;
10818 help();10811
10819 exit(1);
10820 case TCC_OPTION_I:10812 case TCC_OPTION_I:
10821 if (tcc_add_include_path(s, optarg) < 0)10813 if (tcc_add_include_path(s, optarg) < 0)
10822 error("too many include paths");10814 error("too many include paths");
@@ -10963,7 +10955,7 @@ int parse_args(TCCState *s, int argc, char **argv) · 140 unmodified lines
10963 }10955 }
10964 }10956 }
10965 }10957 }
10966 return optind;10958 return optind + 1;
10967}10959}
10968 10960
10969int main(int argc, char **argv)10961int main(int argc, char **argv)
@@ -10989,14 +10981,19 @@ int main(int argc, char **argv) · 19 unmodified lines
10989 print_search_dirs = 0;10981 print_search_dirs = 0;
10990 ret = 0;10982 ret = 0;
10991 10983
10992 optind = parse_args(s, argc - 1, argv + 1) + 1;10984 optind = parse_args(s, argc - 1, argv + 1);
10993
10994 if (print_search_dirs) {10985 if (print_search_dirs) {
10995 /* enough for Linux kernel */10986 /* enough for Linux kernel */
10996 printf("install: %s/\n", tcc_lib_path);10987 printf("install: %s/\n", tcc_lib_path);
10997 return 0;10988 return 0;
10998 }10989 }
10999 10990 if (optind == 0 || nb_files == 0) {
10991 if (optind && verbose)
10992 return 0;
10993 help();
10994 return 1;
10995 }
10996
11000 nb_objfiles = nb_files - nb_libraries;10997 nb_objfiles = nb_files - nb_libraries;
11001 10998
11002 /* if outfile provided without other options, we output an10999 /* if outfile provided without other options, we output an

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t