Changeset 35 for trunk/src/kmk/main.c
- Timestamp:
- Mar 18, 2003, 4:58:49 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/main.c
r34 r35 322 322 } 323 323 case 'E': 324 p = malloc(strlen(optarg) + 1); 325 if (!p) 326 Punt("make: cannot allocate memory."); 324 p = emalloc(strlen(optarg) + 1); 327 325 (void)strcpy(p, optarg); 328 326 (void)Lst_AtEnd(envFirstVars, (ClientData)p); … … 845 843 #ifdef POSIX 846 844 #ifdef USE_KLIB 847 kEnvSet("MAKEFLAGS", p );845 kEnvSet("MAKEFLAGS", p, TRUE); 848 846 #else 849 847 setenv("MAKEFLAGS", p, 1); … … 851 849 #else 852 850 #ifdef USE_KLIB 853 kEnvSet("MAKE", p );851 kEnvSet("MAKE", p, TRUE); 854 852 #else 855 853 setenv("MAKE", p, 1); … … 887 885 path = cp + 1; 888 886 } while (savec == ':'); 889 (void) free((Address)vpath);887 (void)efree((Address)vpath); 890 888 } 891 889 … … 908 906 char *value; 909 907 if (expandVars) { 910 p1 = malloc(strlen((char *)Lst_Datum(ln)) + 1 + 3); 911 if (!p1) 912 Punt("make: cannot allocate memory."); 908 p1 = emalloc(strlen((char *)Lst_Datum(ln)) + 1 + 3); 913 909 /* This sprintf is safe, because of the malloc above */ 914 910 (void)sprintf(p1, "${%s}", (char *)Lst_Datum(ln)); … … 920 916 printf("%s\n", value ? value : ""); 921 917 if (p1) 922 free(p1);918 efree(p1); 923 919 } 924 920 } … … 961 957 Lst_Destroy(variables, NOFREE); 962 958 Lst_Destroy(makefiles, NOFREE); 963 Lst_Destroy(create, (void (*) __P((ClientData))) free);959 Lst_Destroy(create, (void (*) __P((ClientData))) efree); 964 960 965 961 /* print the graph now it's been processed if the user requested it */ … … 1093 1089 * Fork 1094 1090 */ 1091 #ifdef __EMX__ 1092 switch (cpid = fork()) { 1093 #else 1095 1094 switch (cpid = vfork()) { 1095 #endif 1096 1096 case 0: 1097 1097 /* … … 1108 1108 (void) close(fds[1]); 1109 1109 1110 #ifdef OS2 1111 { 1112 const char *psz = getenv("COMSPEC"); 1113 if (!psz) 1114 psz = getenv("OS2_SHELL"); 1115 if (!psz) 1116 psz = "c:\\os2\\cmd.exe"; 1117 (void) execv(psz, args); 1118 } 1119 #else 1110 1120 (void) execv("/bin/sh", args); 1121 #endif 1111 1122 _exit(1); 1112 1123 /*NOTREACHED*/ … … 1378 1389 1379 1390 /* 1391 * efree -- 1392 * efree, no change. 1393 */ 1394 void 1395 efree(ptr) 1396 void *ptr; 1397 { 1398 if (ptr) 1399 free(ptr); 1400 } 1401 1402 /* 1380 1403 * enomem -- 1381 1404 * die when out of memory. … … 1397 1420 struct stat st; 1398 1421 1422 #ifdef __EMX__ 1423 if (stat(file, &st) == -1) 1424 #else 1399 1425 if (lstat(file, &st) == -1) 1426 #endif 1400 1427 return -1; 1401 1428
Note:
See TracChangeset
for help on using the changeset viewer.