* src/mcs51/rtrack.c,
[fw/sdcc] / src / SDCCmain.c
index e6c867f804fde3906a10072f31901d5854ed04b5..6e626c8bb3fa6fb52c2dd8211f5b142a2c96a726 100644 (file)
@@ -144,6 +144,7 @@ char buffer[PATH_MAX * 2];
 #define OPTION_CODE_SEG         "--codeseg"
 #define OPTION_CONST_SEG        "--constseg"
 #define OPTION_DOLLARS_IN_IDENT "--fdollars-in-identifiers"
+#define OPTION_UNSIGNED_CHAR    "--funsigned-char"
 
 static const OPTION
 optionsTable[] = {
@@ -179,6 +180,7 @@ optionsTable[] = {
     { 0,    OPTION_STD_C99,         NULL, "Use C99 standard only (incomplete)" },
     { 0,    OPTION_STD_SDCC99,      NULL, "Use C99 standard with SDCC extensions (incomplete)" },
     { 0,    OPTION_DOLLARS_IN_IDENT, &options.dollars_in_ident, "Permit '$' as an identifier character" },
+    { 0,    OPTION_UNSIGNED_CHAR,   &options.unsigned_char, "Make \"char\" unsigned by default" },
 
     { 0,    NULL,                   NULL, "Code generation options"},
     { 'm',  NULL,                   NULL, "Set the port to use e.g. -mz80." },
@@ -628,9 +630,9 @@ processFile (char *s)
 
   /* otherwise depending on the file type */
   extp = dbuf_c_str (&ext);
-  if (extp[1] == '\0' && (extp[0] == 'c' || extp[0] == 'C'))
+  if (STRCASECMP (extp, ".c") == 0)
     {
-      unsigned char *p;
+      char *p;
 
       dbuf_destroy (&ext);
 
@@ -667,15 +669,14 @@ processFile (char *s)
       moduleName = dbuf_detach (&ext);
 
       for (p = moduleName; *p; ++p)
-        if (!isalnum(*p))
+        if (!isalnum ((unsigned char)*p))
           *p = '_';
       return;
     }
 
   /* if the extention is type .rel or .r or .REL or .R
      additional object file will be passed to the linker */
-  if ((extp[1] == '\0' && (extp[0] == 'r' || extp[0] == 'R')) ||
-      strcmp (extp, "rel") == 0 || strcmp (extp, "REL") == 0 ||
+  if (STRCASECMP (extp, ".r") == 0 || STRCASECMP (extp, ".rel") == 0 ||
       strcmp (extp, port->linker.rel_ext) == 0)
     {
       dbuf_destroy (&ext);
@@ -686,7 +687,7 @@ processFile (char *s)
     }
 
   /* if .lib or .LIB */
-  if (strcmp (extp, "lib") == 0 || strcmp (extp, ".LIB") == 0)
+  if (STRCASECMP (extp, ".lib") == 0)
     {
       dbuf_destroy (&ext);
       dbuf_destroy (&path);
@@ -1402,8 +1403,9 @@ parseCmdLine (int argc, char **argv)
         {
           struct dbuf_s path;
 
-          if (*dstPath != '\0')
+                 if (*dstPath != '\0')
             {
+              dbuf_init(&path, 128);
               dbuf_makePath (&path, dstPath, moduleNameBase);
               dbuf_c_str (&path);
               dstFileName = dbuf_detach (&path);