main.cc
changeset 521 3127ddda2be2
parent 516 8591746fa134
child 596 4efb11e44065
equal deleted inserted replaced
520:fb381d2cd25b 521:3127ddda2be2
   122 int main(int argc, char **argv) {
   122 int main(int argc, char **argv) {
   123   symbol_c *tree_root;
   123   symbol_c *tree_root;
   124   char * builddir = NULL;
   124   char * builddir = NULL;
   125   stage1_2_options_t stage1_2_options = {false, false, NULL};
   125   stage1_2_options_t stage1_2_options = {false, false, NULL};
   126   int optres, errflg = 0;
   126   int optres, errflg = 0;
       
   127   int path_len;
   127 /*
   128 /*
   128   extern char *optarg;
   129   extern char *optarg;
   129   extern int optind, optopt;
   130   extern int optind, optopt;
   130 */
   131 */
   131 
   132 
   146       break;
   147       break;
   147     case 's':
   148     case 's':
   148       stage1_2_options.safe_extensions = true;
   149       stage1_2_options.safe_extensions = true;
   149       break;
   150       break;
   150     case 'I':
   151     case 'I':
       
   152       /* NOTE: To improve the usability under windows:
       
   153        *       We delete last char's path if it ends with "\".
       
   154        *       In this way compiler front-end accepts paths with or without
       
   155        *       slash terminator.
       
   156        */
       
   157       path_len = strlen(optarg) - 1;
       
   158       if (optarg[path_len] == '\\') optarg[path_len]= '\0';
   151       stage1_2_options.includedir = optarg;
   159       stage1_2_options.includedir = optarg;
   152       break;
   160       break;
   153     case 'T':
   161     case 'T':
       
   162       /* NOTE: see note above */
       
   163       path_len = strlen(optarg) - 1;
       
   164       if (optarg[path_len] == '\\') optarg[path_len]= '\0';
   154       builddir = optarg;
   165       builddir = optarg;
   155       break;
   166       break;
   156     case ':':       /* -I or -T without operand */
   167     case ':':       /* -I or -T without operand */
   157       fprintf(stderr, "Option -%c requires an operand\n", optopt);
   168       fprintf(stderr, "Option -%c requires an operand\n", optopt);
   158       errflg++;
   169       errflg++;