Changeset 35 for trunk/src/kmk/main.c


Ignore:
Timestamp:
Mar 18, 2003, 4:58:49 AM (22 years ago)
Author:
bird
Message:

emx is kind of working again...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/main.c

    r34 r35  
    322322                }
    323323                case 'E':
    324                         p = malloc(strlen(optarg) + 1);
    325                         if (!p)
    326                                 Punt("make: cannot allocate memory.");
     324                        p = emalloc(strlen(optarg) + 1);
    327325                        (void)strcpy(p, optarg);
    328326                        (void)Lst_AtEnd(envFirstVars, (ClientData)p);
     
    845843#ifdef POSIX
    846844                #ifdef USE_KLIB
    847                 kEnvSet("MAKEFLAGS", p);
     845                kEnvSet("MAKEFLAGS", p, TRUE);
    848846                #else
    849847                setenv("MAKEFLAGS", p, 1);
     
    851849#else
    852850                #ifdef USE_KLIB
    853                 kEnvSet("MAKE", p);
     851                kEnvSet("MAKE", p, TRUE);
    854852                #else
    855853                setenv("MAKE", p, 1);
     
    887885                        path = cp + 1;
    888886                } while (savec == ':');
    889                 (void)free((Address)vpath);
     887                (void)efree((Address)vpath);
    890888        }
    891889
     
    908906                        char *value;
    909907                        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);
    913909                                /* This sprintf is safe, because of the malloc above */
    914910                                (void)sprintf(p1, "${%s}", (char *)Lst_Datum(ln));
     
    920916                        printf("%s\n", value ? value : "");
    921917                        if (p1)
    922                                 free(p1);
     918                                efree(p1);
    923919                }
    924920        }
     
    961957        Lst_Destroy(variables, NOFREE);
    962958        Lst_Destroy(makefiles, NOFREE);
    963         Lst_Destroy(create, (void (*) __P((ClientData))) free);
     959        Lst_Destroy(create, (void (*) __P((ClientData))) efree);
    964960
    965961        /* print the graph now it's been processed if the user requested it */
     
    10931089     * Fork
    10941090     */
     1091#ifdef __EMX__
     1092    switch (cpid = fork()) {
     1093#else
    10951094    switch (cpid = vfork()) {
     1095#endif
    10961096    case 0:
    10971097        /*
     
    11081108        (void) close(fds[1]);
    11091109
     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
    11101120        (void) execv("/bin/sh", args);
     1121        #endif
    11111122        _exit(1);
    11121123        /*NOTREACHED*/
     
    13781389
    13791390/*
     1391 * efree --
     1392 *      efree, no change.
     1393 */
     1394void
     1395efree(ptr)
     1396      void *ptr;
     1397{
     1398    if (ptr)
     1399        free(ptr);
     1400}
     1401
     1402/*
    13801403 * enomem --
    13811404 *      die when out of memory.
     
    13971420        struct stat st;
    13981421
     1422#ifdef __EMX__
     1423        if (stat(file, &st) == -1)
     1424#else
    13991425        if (lstat(file, &st) == -1)
     1426#endif
    14001427                return -1;
    14011428
Note: See TracChangeset for help on using the changeset viewer.