Changeset 3438 for trunk/src/kash/main.c


Ignore:
Timestamp:
Sep 9, 2020, 10:01:39 PM (5 years ago)
Author:
bird
Message:

kash: Hammering on threaded mode.

File:
1 edited

Legend:

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

    r3435 r3438  
    4545#endif
    4646
     47#include <assert.h>
    4748#include <errno.h>
    4849#include <stdio.h>
     
    101102
    102103int
    103 #if K_OS == K_OS_WINDOWS
     104#if K_OS == K_OS_WINDOWS && defined(SH_FORKED_MODE)
    104105real_main(int argc, char **argv, char **envp)
    105106#else
     
    130131         * Create the root shell instance.
    131132         */
    132         psh = sh_create_root_shell(NULL, argc, argv, envp);
     133        psh = sh_create_root_shell(argv, envp);
    133134        if (!psh)
    134135                return 2;
    135136        shthread_set_shell(psh);
    136         shell_main(psh, argc, psh->argptr);
     137        shell_main(psh, argc, psh->orgargv);
    137138        /* Not reached. */
    138139        return 89;
     
    406407
    407408        if (argc >= 2) {                /* That's what SVR2 does */
     409                char * const savedcommandname = psh->commandname;
     410                int const savedcommandnamemalloc = psh->commandnamemalloc;
    408411                char *fullname;
    409412                struct stackmark smark;
     
    413416                setinputfile(psh, fullname, 1);
    414417                psh->commandname = fullname;
     418                psh->commandnamemalloc = 0;
    415419                cmdloop(psh, 0);
    416420                popfile(psh);
     421                psh->commandname = savedcommandname;
     422                psh->commandnamemalloc = savedcommandnamemalloc;
    417423                popstackmark(psh, &smark);
    418424        }
Note: See TracChangeset for help on using the changeset viewer.