[BACK]Return to csh.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / bin / csh

Annotation of src/bin/csh/csh.h, Revision 1.26.28.4

1.26.28.4! martin      1: /* $NetBSD: csh.h,v 1.29 2020/04/03 18:11:29 joerg Exp $ */
1.9       cgd         2:
1.1       cgd         3: /*-
1.6       mycroft     4:  * Copyright (c) 1980, 1991, 1993
                      5:  *     The Regents of the University of California.  All rights reserved.
1.1       cgd         6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
1.15      agc        15:  * 3. Neither the name of the University nor the names of its contributors
1.1       cgd        16:  *    may be used to endorse or promote products derived from this software
                     17:  *    without specific prior written permission.
                     18:  *
                     19:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     20:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     21:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     22:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     23:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     24:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     25:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     26:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     27:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     28:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     29:  * SUCH DAMAGE.
                     30:  *
1.9       cgd        31:  *     @(#)csh.h       8.1 (Berkeley) 5/31/93
1.1       cgd        32:  */
                     33:
1.14      wiz        34: #ifndef _CSH_H_
                     35: #define _CSH_H_
                     36:
1.1       cgd        37: /*
                     38:  * Fundamental definitions which may vary from system to system.
                     39:  *
1.12      christos   40:  *     BUFSIZE         The i/o buffering size; also limits word size
1.1       cgd        41:  *     MAILINTVL       How often to mailcheck; more often is more expensive
                     42:  */
1.12      christos   43: #ifndef BUFSIZE
                     44: #define        BUFSIZE 4096            /* default buffer size */
                     45: #endif                         /* BUFSIZE */
1.1       cgd        46:
1.14      wiz        47: #define FORKSLEEP 10           /* delay loop on non-interactive fork failure */
                     48: #define        MAILINTVL 600           /* 10 minutes */
1.1       cgd        49:
                     50: /*
                     51:  * The shell moves std in/out/diag and the old std input away from units
                     52:  * 0, 1, and 2 so that it is easy to set up these standards for invoked
                     53:  * commands.
                     54:  */
1.14      wiz        55: #define        FSHTTY 15               /* /dev/tty when manip pgrps */
                     56: #define        FSHIN 16                /* Preferred desc for shell input */
                     57: #define        FSHOUT 17               /* ... shell output */
                     58: #define        FSHERR 18               /* ... shell diagnostics */
1.1       cgd        59: #define        FOLDSTD 19              /* ... old std input */
                     60:
                     61: #ifdef PROF
1.14      wiz        62: #define        xexit(n) done(n)
1.1       cgd        63: #endif
                     64:
                     65: #ifdef SHORT_STRINGS
                     66: typedef short Char;
                     67:
                     68: #define SAVE(a) (Strsave(str2short(a)))
                     69: #else
                     70: typedef char Char;
                     71:
                     72: #define SAVE(a) (strsave(a))
                     73: #endif
                     74:
1.6       mycroft    75: /*
                     76:  * Make sure a variable is not stored in a register by taking its address
                     77:  * This is used where variables might be clobbered by longjmp.
                     78:  */
                     79: #define UNREGISTER(a)  (void) &a
                     80:
1.1       cgd        81: typedef void *ioctl_t;         /* Third arg of ioctl */
                     82:
                     83: #include "const.h"
                     84: #include "char.h"
1.10      christos   85: #include "errnum.h"
1.1       cgd        86:
1.14      wiz        87: #define xmalloc(i) Malloc(i)
                     88: #define xrealloc(p, i) Realloc(p, i)
                     89: #define xcalloc(n, s) Calloc(n, s)
1.6       mycroft    90:
                     91: #include <stdio.h>
1.26.28.2  martin     92: extern FILE *cshin, *cshout, *csherr;
1.1       cgd        93:
1.14      wiz        94: #define        isdir(d) (S_ISDIR(d.st_mode))
1.1       cgd        95:
1.14      wiz        96: #define        eq(a, b) (Strcmp(a, b) == 0)
1.1       cgd        97:
                     98: /* globone() flags */
1.14      wiz        99: #define G_ERROR        0               /* default action: error if multiple words */
                    100: #define G_IGNORE 1             /* ignore the rest of the words */
                    101: #define G_APPEND 2             /* make a sentence by cat'ing the words */
1.1       cgd       102:
                    103: /*
                    104:  * Global flags
                    105:  */
1.26.28.2  martin    106: extern int child;              /* Child shell ... errors cause exit */
                    107: extern int chkstop;            /* Warned of stopped jobs... allow exit */
                    108: extern int didfds;             /* Have setup i/o fd's for child */
                    109: extern int doneinp;            /* EOF indicator after reset from readc */
                    110: extern int exiterr;            /* Exit if error or non-zero exit status */
                    111: extern int haderr;             /* Reset was because of an error */
                    112: extern int havhash;            /* path hashing is available */
                    113: extern int intact;             /* We are interactive... therefore prompt */
                    114: extern int intty;              /* Input is a tty */
                    115: extern int justpr;             /* Just print because of :p hist mod */
                    116: extern int loginsh;            /* We are a loginsh -> .login/.logout */
                    117: extern int neednote;           /* Need to pnotify() */
                    118: extern int noexec;             /* Don't execute, just syntax check */
                    119: extern int pjobs;              /* want to print jobs if interrupted */
                    120: extern int setintr;            /* Set interrupts on/off -> Wait intr... */
                    121: extern int timflg;             /* Time the next waited for command */
1.1       cgd       122:
                    123: #ifdef FILEC
1.21      christos  124: extern int filec;              /* doing filename expansion */
1.1       cgd       125: #endif
                    126:
                    127: /*
                    128:  * Global i/o info
                    129:  */
1.26.28.2  martin    130: extern Char *arginp;           /* Argument input for sh -c and internal `xx` */
                    131: extern Char *ffile;            /* Name of shell file for $0 */
                    132: extern int onelflg;            /* 2 -> need line for -t, 1 -> exit on read */
1.1       cgd       133:
1.14      wiz       134: extern char *seterr;           /* Error message from scanner/parser */
1.26.28.2  martin    135: extern Char *shtemp;           /* Temp name for << shell files in /tmp */
1.1       cgd       136:
1.14      wiz       137: #include <sys/resource.h>
                    138: #include <sys/time.h>
1.6       mycroft   139: #include <sys/types.h>
1.1       cgd       140:
1.26.28.2  martin    141: extern struct timespec time0;  /* Time at which the shell started */
                    142: extern struct rusage ru0;
1.1       cgd       143:
                    144: /*
                    145:  * Miscellany
                    146:  */
1.26.28.2  martin    147: extern time_t chktim;          /* Time mail last checked */
                    148: extern Char *doldol;           /* Character pid for $$ */
                    149: extern pid_t backpid;          /* Pid of the last background process */
                    150: extern gid_t egid, gid;                /* Invokers gid */
                    151: extern uid_t euid, uid;                /* Invokers uid */
                    152: extern int shpgrp;             /* Pgrp of shell */
                    153: extern int tpgrp;              /* Terminal process group */
1.1       cgd       154:
                    155: /* If tpgrp is -1, leave tty alone! */
1.26.28.2  martin    156: extern int opgrp;              /* Initial pgrp and tty pgrp */
1.1       cgd       157:
                    158:
                    159: /*
                    160:  * To be able to redirect i/o for builtins easily, the shell moves the i/o
                    161:  * descriptors it uses away from 0,1,2.
                    162:  * Ideally these should be in units which are closed across exec's
                    163:  * (this saves work) but for version 6, this is not usually possible.
1.6       mycroft   164:  * The desired initial values for these descriptors are F{SHIN,...}.
1.1       cgd       165:  */
1.26.28.2  martin    166: extern int SHIN;               /* Current shell input (script) */
                    167: extern int SHOUT;              /* Shell output */
                    168: extern int SHERR;              /* Diagnostic output... shell errs go here */
                    169: extern int OLDSTD;             /* Old standard input (def for cmds) */
1.1       cgd       170:
                    171: /*
                    172:  * Error control
                    173:  *
                    174:  * Errors in scanning and parsing set up an error message to be printed
                    175:  * at the end and complete.  Other errors always cause a reset.
                    176:  * Because of source commands and .cshrc we need nested error catches.
                    177:  */
                    178:
                    179: #include <setjmp.h>
1.26.28.2  martin    180: extern jmp_buf reslab;
1.1       cgd       181:
1.14      wiz       182: #define        setexit() (setjmp(reslab))
                    183: #define        reset() longjmp(reslab, 1)
1.1       cgd       184:  /* Should use structure assignment here */
1.14      wiz       185: #define        getexit(a) (void)memcpy((a), reslab, sizeof reslab)
                    186: #define        resexit(a) (void)memcpy(reslab, (a), sizeof reslab)
1.1       cgd       187:
1.26.28.2  martin    188: extern Char *gointr;           /* Label for an onintr transfer */
1.1       cgd       189:
                    190: #include <signal.h>
1.26.28.2  martin    191: extern sig_t parintr;          /* Parents interrupt catch */
                    192: extern sig_t parterm;          /* Parents terminate catch */
1.1       cgd       193:
                    194: /*
                    195:  * Lexical definitions.
                    196:  *
                    197:  * All lexical space is allocated dynamically.
1.6       mycroft   198:  * The eighth/sixteenth bit of characters is used to prevent recognition,
1.1       cgd       199:  * and eventually stripped.
                    200:  */
1.26      christos  201: #define        META 0x80
                    202: #define        ASCII 0x7f
1.1       cgd       203: #ifdef SHORT_STRINGS
1.26      christos  204: #define        CHAR ((Char)0xff)
                    205: #define        QUOTE ((Char)0x8000)    /* 16nth char bit used for 'ing */
                    206: #define        TRIM ((Char)0x7fff)     /* Mask to strip quote bit */
1.1       cgd       207: #else
1.26      christos  208: #define        CHAR ((Char)0x7f)
                    209: #define        QUOTE ((Char)0x80)      /* Eighth char bit used for 'ing */
                    210: #define        TRIM ((Char)0x7f)       /* Mask to strip quote bit */
1.1       cgd       211: #endif
                    212:
1.26.28.2  martin    213: extern int AsciiOnly;                  /* If set only 7 bits is expected in characters */
1.1       cgd       214:
                    215: /*
                    216:  * Each level of input has a buffered input structure.
                    217:  * There are one or more blocks of buffered input for each level,
                    218:  * exactly one if the input is seekable and tell is available.
                    219:  * In other cases, the shell buffers enough blocks to keep all loops
                    220:  * in the buffer.
                    221:  */
1.26.28.2  martin    222: extern struct Bin {
1.14      wiz       223:     off_t Bfseekp;             /* Seek pointer */
                    224:     off_t Bfbobp;              /* Seekp of beginning of buffers */
                    225:     off_t Bfeobp;              /* Seekp of end of buffers */
                    226:     int Bfblocks;              /* Number of buffer blocks */
                    227:     Char **Bfbuf;              /* The array of buffer blocks */
1.26.28.2  martin    228: } B;
1.1       cgd       229:
1.6       mycroft   230: /*
                    231:  * This structure allows us to seek inside aliases
                    232:  */
                    233: struct Ain {
                    234:     int type;
                    235: #define I_SEEK -1              /* Invalid seek */
1.14      wiz       236: #define A_SEEK 0               /* Alias seek */
                    237: #define F_SEEK 1               /* File seek */
                    238: #define E_SEEK 2               /* Eval seek */
1.6       mycroft   239:     union {
                    240:        off_t _f_seek;
                    241:        Char* _c_seek;
                    242:     } fc;
                    243: #define f_seek fc._f_seek
                    244: #define c_seek fc._c_seek
                    245:     Char **a_seek;
1.26.28.2  martin    246: };
1.6       mycroft   247: extern int aret;               /* What was the last character returned */
                    248: #define SEEKEQ(a, b) ((a)->type == (b)->type && \
                    249:                      (a)->f_seek == (b)->f_seek && \
                    250:                      (a)->a_seek == (b)->a_seek)
                    251:
1.14      wiz       252: #define        fseekp B.Bfseekp
                    253: #define        fbobp B.Bfbobp
                    254: #define        feobp B.Bfeobp
1.1       cgd       255: #define        fblocks B.Bfblocks
1.14      wiz       256: #define        fbuf B.Bfbuf
1.1       cgd       257:
                    258: /*
                    259:  * The shell finds commands in loops by reseeking the input
                    260:  * For whiles, in particular, it reseeks to the beginning of the
                    261:  * line the while was on; hence the while placement restrictions.
                    262:  */
1.26.28.2  martin    263: extern struct Ain lineloc;
1.1       cgd       264:
1.26.28.2  martin    265: extern int cantell;    /* Is current source tellable ? */
1.1       cgd       266:
                    267: /*
                    268:  * Input lines are parsed into doubly linked circular
                    269:  * lists of words of the following form.
                    270:  */
                    271: struct wordent {
1.14      wiz       272:     Char *word;
1.1       cgd       273:     struct wordent *prev;
                    274:     struct wordent *next;
                    275: };
                    276:
                    277: /*
                    278:  * During word building, both in the initial lexical phase and
                    279:  * when expanding $ variable substitutions, expansion by `!' and `$'
                    280:  * must be inhibited when reading ahead in routines which are themselves
                    281:  * processing `!' and `$' expansion or after characters such as `\' or in
                    282:  * quotations.  The following flags are passed to the getC routines
                    283:  * telling them which of these substitutions are appropriate for the
                    284:  * next character to be returned.
                    285:  */
1.14      wiz       286: #define        DODOL 1
                    287: #define        DOEXCL 2
                    288: #define        DOALL DODOL|DOEXCL
1.1       cgd       289:
                    290: /*
                    291:  * Labuf implements a general buffer for lookahead during lexical operations.
                    292:  * Text which is to be placed in the input stream can be stuck here.
                    293:  * We stick parsed ahead $ constructs during initial input,
                    294:  * process id's from `$$', and modified variable values (from qualifiers
                    295:  * during expansion in sh.dol.c) here.
                    296:  */
1.26.28.2  martin    297: extern Char *lap;
1.1       cgd       298:
                    299: /*
                    300:  * Parser structure
                    301:  *
                    302:  * Each command is parsed to a tree of command structures and
                    303:  * flags are set bottom up during this process, to be propagated down
1.17      msaitoh   304:  * as needed during the semantics/execution pass (sh.sem.c).
1.1       cgd       305:  */
                    306: struct command {
1.26      christos  307:     int t_dtyp;                        /* Type of node                  */
1.1       cgd       308: #define        NODE_COMMAND    1       /* t_dcom <t_dlef >t_drit        */
                    309: #define        NODE_PAREN      2       /* ( t_dspr ) <t_dlef >t_drit    */
                    310: #define        NODE_PIPE       3       /* t_dlef | t_drit               */
                    311: #define        NODE_LIST       4       /* t_dlef ; t_drit               */
                    312: #define        NODE_OR         5       /* t_dlef || t_drit              */
                    313: #define        NODE_AND        6       /* t_dlef && t_drit              */
1.26      christos  314:     int t_dflg;                        /* Flags, e.g. F_AMPERSAND|...   */
1.1       cgd       315: #define        F_SAVE  (F_NICE|F_TIME|F_NOHUP) /* save these when re-doing      */
                    316:
                    317: #define        F_AMPERSAND     (1<<0)  /* executes in background        */
                    318: #define        F_APPEND        (1<<1)  /* output is redirected >>       */
                    319: #define        F_PIPEIN        (1<<2)  /* input is a pipe               */
                    320: #define        F_PIPEOUT       (1<<3)  /* output is a pipe              */
                    321: #define        F_NOFORK        (1<<4)  /* don't fork, last ()ized cmd   */
                    322: #define        F_NOINTERRUPT   (1<<5)  /* should be immune from intr's */
                    323: /* spare */
                    324: #define        F_STDERR        (1<<7)  /* redirect unit 2 with unit 1   */
                    325: #define        F_OVERWRITE     (1<<8)  /* output was !                  */
                    326: #define        F_READ          (1<<9)  /* input redirection is <<       */
                    327: #define        F_REPEAT        (1<<10) /* reexec aft if, repeat,...     */
                    328: #define        F_NICE          (1<<11) /* t_nice is meaningful          */
                    329: #define        F_NOHUP         (1<<12) /* nohup this command            */
                    330: #define        F_TIME          (1<<13) /* time this command             */
                    331:     union {
1.14      wiz       332:        Char *T_dlef;           /* Input redirect word           */
1.1       cgd       333:        struct command *T_dcar; /* Left part of list/pipe        */
                    334:     }       L;
                    335:     union {
1.14      wiz       336:        Char *T_drit;           /* Output redirect word          */
1.1       cgd       337:        struct command *T_dcdr; /* Right part of list/pipe       */
                    338:     }       R;
1.14      wiz       339: #define        t_dlef L.T_dlef
                    340: #define        t_dcar L.T_dcar
                    341: #define        t_drit R.T_drit
                    342: #define        t_dcdr R.T_dcdr
                    343:     Char **t_dcom;             /* Command/argument vector       */
1.1       cgd       344:     struct command *t_dspr;    /* Pointer to ()'d subtree       */
1.14      wiz       345:     int t_nice;
1.1       cgd       346: };
                    347:
                    348:
                    349: /*
1.6       mycroft   350:  * These are declared here because they want to be
                    351:  * initialized in sh.init.c (to allow them to be made readonly)
                    352:  */
                    353:
                    354: extern struct biltins {
1.16      christos  355:     const char *bname;
1.14      wiz       356:     void (*bfunct)(Char **, struct command *);
                    357:     short minargs, maxargs;
                    358: } bfunc[];
                    359:
1.6       mycroft   360: extern int nbfunc;
1.14      wiz       361: extern int nsrchn;
1.6       mycroft   362:
                    363: extern struct srch {
1.16      christos  364:     const char *s_name;
1.14      wiz       365:     short s_value;
                    366: } srchn[];
1.6       mycroft   367:
                    368: /*
1.1       cgd       369:  * The keywords for the parser
                    370:  */
                    371: #define        T_BREAK         0
                    372: #define        T_BRKSW         1
                    373: #define        T_CASE          2
                    374: #define        T_DEFAULT       3
                    375: #define        T_ELSE          4
                    376: #define        T_END           5
                    377: #define        T_ENDIF         6
                    378: #define        T_ENDSW         7
                    379: #define        T_EXIT          8
                    380: #define        T_FOREACH       9
                    381: #define        T_GOTO          10
                    382: #define        T_IF            11
                    383: #define        T_LABEL         12
                    384: #define        T_LET           13
                    385: #define        T_SET           14
                    386: #define        T_SWITCH        15
                    387: #define        T_TEST          16
                    388: #define        T_THEN          17
                    389: #define        T_WHILE         18
                    390:
                    391: /*
                    392:  * Structure defining the existing while/foreach loops at this
                    393:  * source level.  Loops are implemented by seeking back in the
                    394:  * input.  For foreach (fe), the word list is attached here.
                    395:  */
1.26.28.2  martin    396: extern struct whyle {
1.14      wiz       397:     struct Ain w_start;                /* Point to restart loop */
                    398:     struct Ain w_end;          /* End of loop (0 if unknown) */
                    399:     Char **w_fe, **w_fe0;      /* Current/initial wordlist for fe */
                    400:     Char *w_fename;            /* Name for fe */
1.1       cgd       401:     struct whyle *w_next;      /* Next (more outer) loop */
1.14      wiz       402: } *whyles;
1.1       cgd       403:
                    404: /*
                    405:  * Variable structure
                    406:  *
                    407:  * Aliases and variables are stored in AVL balanced binary trees.
                    408:  */
1.26.28.2  martin    409: extern struct varent {
1.14      wiz       410:     Char **vec;                        /* Array of words which is the value */
                    411:     Char *v_name;              /* Name of variable/alias */
1.1       cgd       412:     struct varent *v_link[3];  /* The links, see below */
1.14      wiz       413:     int v_bal;                 /* Balance factor */
                    414: } shvhed, aliases;
1.1       cgd       415:
1.14      wiz       416: #define v_left v_link[0]
                    417: #define v_right        v_link[1]
                    418: #define v_parent v_link[2]
1.1       cgd       419:
1.14      wiz       420: #define adrof(v) adrof1(v, &shvhed)
                    421: #define value(v) value1(v, &shvhed)
1.1       cgd       422:
                    423: /*
                    424:  * The following are for interfacing redo substitution in
                    425:  * aliases to the lexical routines.
                    426:  */
1.26.28.2  martin    427: extern struct wordent *alhistp;        /* Argument list (first) */
                    428: extern struct wordent *alhistt;        /* Node after last in arg list */
1.14      wiz       429: extern Char **alvec, *alvecp;  /* The (remnants of) alias vector */
1.1       cgd       430:
                    431: /*
                    432:  * Filename/command name expansion variables
                    433:  */
1.26.28.2  martin    434: extern int gflag;              /* After tglob -> is globbing needed? */
1.1       cgd       435:
                    436: #define MAXVARLEN 30           /* Maximum number of char in a variable name */
                    437:
                    438: /*
                    439:  * Variables for filename expansion
                    440:  */
1.14      wiz       441: extern long gargc;             /* Number args in gargv */
1.1       cgd       442: extern Char **gargv;           /* Pointer to the (stack) arglist */
                    443:
                    444: /*
                    445:  * Variables for command expansion.
                    446:  */
                    447: extern Char **pargv;           /* Pointer to the argv list space */
                    448: extern long pargc;             /* Count of arguments in pargv */
1.26.28.2  martin    449: extern long pnleft;            /* Number of chars left in pargs */
                    450: extern Char *pargs;            /* Pointer to start current word */
                    451: extern Char *pargcp;           /* Current index into pargs */
1.1       cgd       452:
                    453: /*
                    454:  * History list
                    455:  *
                    456:  * Each history list entry contains an embedded wordlist
                    457:  * from the scanner, a number for the event, and a reference count
                    458:  * to aid in discarding old entries.
                    459:  *
                    460:  * Essentially "invisible" entries are put on the history list
                    461:  * when history substitution includes modifiers, and thrown away
                    462:  * at the next discarding since their event numbers are very negative.
                    463:  */
1.26.28.2  martin    464: extern struct Hist {
1.1       cgd       465:     struct wordent Hlex;
1.14      wiz       466:     int Hnum;
                    467:     int Href;
1.1       cgd       468:     struct Hist *Hnext;
1.14      wiz       469: } Histlist;
1.1       cgd       470:
1.26.28.2  martin    471: extern struct wordent paraml;  /* Current lexical word list */
                    472: extern int eventno;            /* Next events number */
                    473: extern int lastev;             /* Last event reference (default) */
1.1       cgd       474:
1.26.28.2  martin    475: extern Char HIST;              /* history invocation character */
                    476: extern Char HISTSUB;           /* auto-substitute character */
1.1       cgd       477:
                    478: /*
                    479:  * strings.h:
                    480:  */
                    481: #ifndef SHORT_STRINGS
1.14      wiz       482: #define Strchr(a, b)           strchr(a, b)
1.1       cgd       483: #define Strrchr(a, b)          strrchr(a, b)
                    484: #define Strcat(a, b)           strcat(a, b)
1.14      wiz       485: #define Strncat(a, b, c)       strncat(a, b, c)
1.1       cgd       486: #define Strcpy(a, b)           strcpy(a, b)
1.14      wiz       487: #define Strncpy(a, b, c)       strncpy(a, b, c)
1.1       cgd       488: #define Strlen(a)              strlen(a)
                    489: #define Strcmp(a, b)           strcmp(a, b)
                    490: #define Strncmp(a, b, c)       strncmp(a, b, c)
                    491:
                    492: #define Strspl(a, b)           strspl(a, b)
                    493: #define Strsave(a)             strsave(a)
                    494: #define Strend(a)              strend(a)
                    495: #define Strstr(a, b)           strstr(a, b)
                    496:
1.14      wiz       497: #define str2short(a)           (a)
                    498: #define blk2short(a)           saveblk(a)
                    499: #define short2blk(a)           saveblk(a)
                    500: #define short2str(a)           strip(a)
1.1       cgd       501: #else
                    502: #define Strchr(a, b)           s_strchr(a, b)
1.14      wiz       503: #define Strrchr(a, b)          s_strrchr(a, b)
1.1       cgd       504: #define Strcat(a, b)           s_strcat(a, b)
                    505: #define Strncat(a, b, c)       s_strncat(a, b, c)
                    506: #define Strcpy(a, b)           s_strcpy(a, b)
                    507: #define Strncpy(a, b, c)       s_strncpy(a, b, c)
                    508: #define Strlen(a)              s_strlen(a)
                    509: #define Strcmp(a, b)           s_strcmp(a, b)
                    510: #define Strncmp(a, b, c)       s_strncmp(a, b, c)
                    511:
                    512: #define Strspl(a, b)           s_strspl(a, b)
                    513: #define Strsave(a)             s_strsave(a)
                    514: #define Strend(a)              s_strend(a)
                    515: #define Strstr(a, b)           s_strstr(a, b)
                    516: #endif
                    517:
                    518: /*
                    519:  * setname is a macro to save space (see sh.err.c)
                    520:  */
1.26.28.2  martin    521: extern const char *bname;
1.1       cgd       522:
1.14      wiz       523: #define        setname(a) (bname = (a))
1.1       cgd       524:
1.26.28.2  martin    525: extern Char *Vsav;
                    526: extern Char *Vdp;
                    527: extern Char *Vexpath;
                    528: extern char **Vt;
1.1       cgd       529:
1.26.28.2  martin    530: extern Char **evalvec;
                    531: extern Char *evalp;
1.1       cgd       532:
                    533: /* word_chars is set by default to WORD_CHARS but can be overridden by
                    534:    the worchars variable--if unset, reverts to WORD_CHARS */
                    535:
1.26.28.2  martin    536: extern Char *word_chars;
1.1       cgd       537:
                    538: #define WORD_CHARS "*?_-.[]~=" /* default chars besides alnums in words */
                    539:
1.26.28.2  martin    540: extern Char *STR_SHELLPATH;
1.1       cgd       541:
                    542: #include <paths.h>
                    543: #ifdef _PATH_BSHELL
1.26.28.2  martin    544: extern Char *STR_BSHELL;
1.1       cgd       545: #endif
1.26.28.2  martin    546: extern Char *STR_WORD_CHARS;
                    547: extern Char **STR_environ;
1.14      wiz       548:
1.23      christos  549: #ifdef EDIT
                    550: #include <histedit.h>
1.26.28.2  martin    551: extern EditLine *el;
                    552: extern History *hi;
1.24      christos  553: #endif
1.26.28.2  martin    554: extern int editing;
1.23      christos  555:
1.14      wiz       556: #endif /* !_CSH_H_ */

CVSweb <webmaster@jp.NetBSD.org>