Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.148
 
1.149
 
MAIN:gmcgarry:20090310073411
 
cc.c
_>141141 void *ccmalloc(int size);
 142142 #ifdef WIN32
 143143 char *win32pathsubst(char *);
<> 144+char *win32commandline(char *, char *[]);
144145 #endif
 145146 char    *av[MAXAV];
 146147 char    *clist[MAXFIL];
     
 !
700701                         av[na++] = alist;
 701702                 for (j = 0; cppadd[j]; j++)
 702703                         av[na++] = cppadd[j];
<> 704+                av[na++] = "-D__STDC_ISO_10646__=200009L";
703705 #if WCHAR_SIZE == 2
<>704 -                av[na++] = "-D__STDC_ISO_10646__=200009L";      /* MirBSD */
 705 -                av[na++] = "-D__WCHAR_MAX__=65535U";
 706 -#ifdef os_win32
 707 -                av[na++] = "-D__WCHAR_TYPE__=short";
 708 -#else
709706                 av[na++] = "-D__WCHAR_TYPE__=short unsigned int";
<>710 -#endif
711707                 av[na++] = "-D__SIZEOF_WCHAR_T__=2";
<> 708+                av[na++] = "-D__WCHAR_MAX__=65535U";
712709 #else
<>713 -                av[na++] = "-D__STDC_ISO_10646__=200009L";      /* glibc */
 714 -                av[na++] = "-D__WCHAR_MAX__=4294967295U";
715710                 av[na++] = "-D__WCHAR_TYPE__=unsigned int";
 716711                 av[na++] = "-D__SIZEOF_WCHAR_T__=4";
<> 712+                av[na++] = "-D__WCHAR_MAX__=4294967295U";
717713 #endif
<>718 -#ifdef os_win32
 719 -                av[na++] = "-D__WINT_TYPE__=int";
 720 -#else
721714                 av[na++] = "-D__WINT_TYPE__=unsigned int";
<>722 -#endif
  715+                av[na++] = "-D__SIZE_TYPE__=unsigned long";
  716+                av[na++] = "-D__PTRDIFF_TYPE__=int";
723717                 av[na++] = "-D__SIZEOF_WINT_T__=4";
 724718 #ifdef MULTITARGET
 725719                 for (k = 0; cppmds[k].mach; k++) {
     
 !
850844                 av[na++] = as;
 851845                 for (j = 0; j < nas; j++)
 852846                         av[na++] = aslist[j];
<> 847+#if defined(os_win32) && defined(USE_YASM)
  848+                av[na++] = "-p";
  849+                av[na++] = "gnu";
  850+                av[na++] = "-f";
  851+                av[na++] = "win32";
  852+#endif
853853 #if defined(os_sunos) && defined(mach_sparc64)
 854854                 av[na++] = "-m64";
 855855 #endif
     
 !
11831183 int
 11841184 callsys(char *f, char *v[])
 11851185 {
<>1186 -        int t;
 1187 -        char cmd[MAX_CMDLINE_LENGTH];
 1188 -        int len;
  1186+        char *cmd;
11891187         STARTUPINFO si;
 11901188         PROCESS_INFORMATION pi;
 11911189         DWORD exitCode;
 11921190         BOOL ok;
 11931191 
<>1194 -        len = strlcpy(cmd, f, MAX_CMDLINE_LENGTH);
 1195 -        for (t = 1; v[t] && len < MAX_CMDLINE_LENGTH; t++) {
 1196 -                len = strlcat(cmd, " ", MAX_CMDLINE_LENGTH);
 1197 -                len = strlcat(cmd, v[t], MAX_CMDLINE_LENGTH);
 1198 -        }
 1199 -
  1192+        cmd = win32commandline(f, v);
12001193         if (vflag)
 12011194                 printf("%s\n", cmd);
 12021195 
     
 !
12221215 
 12231216         WaitForSingleObject(pi.hProcess, INFINITE);
 12241217         GetExitCodeProcess(pi.hProcess, &exitCode);
<> 1218+        CloseHandle(pi.hProcess);
  1219+        CloseHandle(pi.hThread);
  1220+
12251221         return (exitCode != 0);
 12261222 }
 12271223 
     
 !
13751371         while (env[len-1] == '/' || env[len-1] == '\\' || env[len-1] == '\0')
 13761372                 env[--len] = 0;
 13771373 
<>1378 -        len += 3;
 1379 -        rv = ccmalloc(len);
 1380 -        strlcpy(rv, "\"", len);
 1381 -        strlcat(rv, env, len);
 1382 -        strlcat(rv, "\"", len);
  1374+        rv = ccmalloc(len+1);
  1375+        strlcpy(rv, env, len+1);
13831376 
 13841377         return rv;
 13851378 }
 13861379 
<> 1380+char *
  1381+win32commandline(char *f, char *args[])
  1382+{
  1383+        char *cmd;
  1384+        char *p;
  1385+        int len;
  1386+        int i, j, k;
  1387+
  1388+        len = strlen(f) + 3;
  1389+
  1390+        for (i = 1; args[i] != NULL; i++) {
  1391+                for (j = 0; args[i][j] != '\0'; j++) {
  1392+                        len++;
  1393+                        if (args[i][j] == '\"') {
  1394+                                for (k = j-1; k >= 0 && args[i][k] == '\\'; k--)
  1395+                                        len++;
  1396+                        }
  1397+                }
  1398+                for (k = j-1; k >= 0 && args[i][k] == '\\'; k--)
  1399+                        len++;
  1400+                len += j + 3;
  1401+        }
  1402+
  1403+        p = cmd = ccmalloc(len);
  1404+        *p++ = '\"';
  1405+        p += strlcpy(p, f, len-1);
  1406+        *p++ = '\"';
  1407+        *p++ = ' ';
  1408+
  1409+        for (i = 1; args[i] != NULL; i++) {
  1410+                *p++ = '\"';
  1411+                for (j = 0; args[i][j] != '\0'; j++) {
  1412+                        if (args[i][j] == '\"') {
  1413+                                for (k = j-1; k >= 0 && args[i][k] == '\\'; k--)
  1414+                                        *p++ = '\\';
  1415+                                *p++ = '\\';
  1416+                        }
  1417+                        *p++ = args[i][j];
  1418+                }
  1419+                for (k = j-1; k >= 0 && args[i][k] == '\\'; k--)
  1420+                        *p++ = '\\';
  1421+                *p++ = '\"';
  1422+                *p++ = ' ';
  1423+        }
  1424+        p[-1] = '\0';
  1425+
  1426+        return cmd;
  1427+}
  1428+
<_13871429 #endif
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-07-11 00:54 +0200