Ignore:
Timestamp:
Mar 26, 2018, 10:25:56 PM (7 years ago)
Author:
bird
Message:

kmkbuiltin: funnel output thru output.c (usually via err.c).

File:
1 edited

Legend:

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

    r3173 r3192  
    392392                    big_int nsStart = print_stats_flag ? nano_timestamp() : 0;
    393393#endif
     394                    KMKBUILTINCTX Ctx;
    394395                    int const iUmask = umask(0);        /* save umask */
    395396                    umask(iUmask);
    396397
     398                    Ctx.pszProgName = pEntry->uName.s.sz;
     399                    Ctx.pOut = pChild ? &pChild->output : NULL;
     400
    397401                    if (pEntry->uFnSignature == FN_SIG_MAIN)
    398                         rc = pEntry->u.pfnMain(argc, argv, papszEnvVars);
     402                        rc = pEntry->u.pfnMain(argc, argv, papszEnvVars, &Ctx);
    399403                    else if (pEntry->uFnSignature == FN_SIG_MAIN_SPAWNS)
    400                         rc = pEntry->u.pfnMainSpawns(argc, argv, papszEnvVars, pChild, pPidSpawned);
     404                        rc = pEntry->u.pfnMainSpawns(argc, argv, papszEnvVars, &Ctx, pChild, pPidSpawned);
    401405                    else if (pEntry->uFnSignature == FN_SIG_MAIN_TO_SPAWN)
    402406                    {
     
    406410                         * problem then (the call stack shows what's been going on).
    407411                         */
    408                         rc = pEntry->u.pfnMainToSpawn(argc, argv, papszEnvVars, ppapszArgvToSpawn);
     412                        rc = pEntry->u.pfnMainToSpawn(argc, argv, papszEnvVars, &Ctx, ppapszArgvToSpawn);
    409413                        if (   !rc
    410414                            && *ppapszArgvToSpawn
     
    429433                        rc = 99;
    430434
    431                     g_progname = "kmk";                 /* paranoia, make sure it's not pointing at a freed argv[0]. */
    432435                    umask(iUmask);                      /* restore it */
    433436
Note: See TracChangeset for help on using the changeset viewer.