Changeset 3476 for trunk/src


Ignore:
Timestamp:
Sep 17, 2020, 11:32:45 PM (5 years ago)
Author:
bird
Message:

kash: sh_destroy should be mostly finished now.

File:
1 edited

Legend:

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

    r3472 r3476  
    4343#include "alias.h"
    4444#include "error.h"
     45#include "input.h"
     46#include "jobs.h"
    4547#include "memalloc.h"
    4648#include "nodes.h"
     
    121123}                   g_sig_state[NSIG];
    122124
     125/*********************************************************************************************************************************
     126*   Internal Functions                                                                                                           *
     127*********************************************************************************************************************************/
     128#ifndef SH_FORKED_MODE
     129static void shsubshellstatus_signal_and_release(shinstance *psh, int iExit);
     130#endif
     131
    123132
    124133
     
    308317    sh_free(psh, psh->threadarg);
    309318    psh->threadarg = NULL;
     319    assert(!psh->subshellstatus);
     320    if (psh->subshellstatus)
     321    {
     322        shsubshellstatus_signal_and_release(psh, psh->exitstatus);
     323        psh->subshellstatus = NULL;
     324    }
    310325#endif
    311326
     
    384399    }
    385400
    386 #if 0
    387     /* input.h */
    388     int                 plinno/* = 1 */;/**< input line number */
    389     int                 parsenleft;     /**< number of characters left in input buffer */
    390     char               *parsenextc;     /**< next character in input buffer */
    391     int                 init_editline/* = 0 */;     /**< 0 == not setup, 1 == OK, -1 == failed */
    392 
    393     /* input.c */
    394     int                 parselleft;     /**< copy of parsefile->lleft */
    395     struct parsefile    basepf;         /**< top level input file */
    396     char                basebuf[BUFSIZ];/**< buffer for top level input file */
    397     struct parsefile   *parsefile/* = &basepf*/;    /**< current input file */
    398 #ifndef SMALL
    399     EditLine           *el;             /**< cookie for editline package */
    400 #endif
    401 
    402     /* jobs.h */
    403     shpid               backgndpid/* = -1 */;   /**< pid of last background process */
    404     int                 job_warning;    /**< user was warned about stopped jobs */
    405 
    406     /* jobs.c */
    407     struct job         *jobtab;         /**< array of jobs */
    408     int                 njobs;          /**< size of array */
    409     int                 jobs_invalid;   /**< set in child */
    410     shpid               initialpgrp;    /**< pgrp of shell on invocation */
    411     int                 curjob/* = -1*/;/**< current job */
    412     int                 ttyfd/* = -1*/;
    413     int                 jobctl;         /**< job control enabled / disabled */
    414     char               *cmdnextc;
    415     int                 cmdnleft;
    416 
    417 
    418     /* mail.c */
    419 #define MAXMBOXES 10
    420     int                 nmboxes;        /**< number of mailboxes */
    421     time_t              mailtime[MAXMBOXES]; /**< times of mailboxes */
     401    /* input.h/c */
     402    popallfiles(psh);
     403    while (psh->basepf.strpush)
     404        popstring(psh);
     405
     406    /* jobs.h/c */
     407    if (psh->jobtab)
     408    {
     409        int j = psh->njobs;
     410        while (j-- > 0)
     411            if (psh->jobtab[j].used && psh->jobtab[j].ps != &psh->jobtab[j].ps0)
     412            {
     413                sh_free(psh, psh->jobtab[j].ps);
     414                psh->jobtab[j].ps = &psh->jobtab[j].ps0;
     415            }
     416        sh_free(psh, psh->jobtab);
     417        psh->jobtab = NULL;
     418        psh->njobs = 0;
     419    }
    422420
    423421    /* myhistedit.h */
    424422#ifndef SMALL
     423# error FIXME
    425424    History            *hist;
    426425    EditLine           *el;
    427 #endif
    428426#endif
    429427
     
    456454    psh->argptr = NULL;
    457455    psh->minusc = NULL;
    458 
    459 #if 0
    460     /* parse.h */
    461     int                 tokpushback;
    462     int                 whichprompt;    /**< 1 == PS1, 2 == PS2 */
    463 
    464     /* parser.c */
    465     int                 noalias/* = 0*/;/**< when set, don't handle aliases */
    466     struct heredoc     *heredoclist;    /**< list of here documents to read */
    467     int                 parsebackquote; /**< nonzero if we are inside backquotes */
    468     int                 doprompt;       /**< if set, prompt the user */
    469     int                 needprompt;     /**< true if interactive and at start of line */
    470     int                 lasttoken;      /**< last token read */
    471     char               *wordtext;       /**< text of last word returned by readtoken */
    472     int                 checkkwd;       /**< 1 == check for kwds, 2 == also eat newlines */
    473     struct nodelist    *backquotelist;
    474     union node         *redirnode;
    475     struct heredoc     *heredoc;
    476     int                 quoteflag;      /**< set if (part of) last token was quoted */
    477     int                 startlinno;     /**< line # where last token started */
    478 #endif
    479456
    480457    /* redir.c */
Note: See TracChangeset for help on using the changeset viewer.