home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: sjg@zen.void.oz.au (Simon J. Gerraty)
- Subject: v31i076: pdksh - Public Domain Korn Shell, Patch07
- Message-ID: <1992Aug14.144711.22203@sparky.imd.sterling.com>
- X-Md4-Signature: 97f4102ec2d3f48207ba544b27dd015d
- Date: Fri, 14 Aug 1992 14:47:11 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: sjg@zen.void.oz.au (Simon J. Gerraty)
- Posting-number: Volume 31, Issue 76
- Archive-name: pdksh/patch07
- Environment: UNIX
- Patch-To: pdksh: Volume 25, Issue 47-55
-
- This is patch07.
-
- It fixes a build problem if COMPLEX_HISTORY is not defined.
- This patch also prevents a core dump caused by an underlying
- (unfixed) bug.
-
- Apply this patch by changing directory to the root
- of the source tree and using the command:
-
- patch -p0 < this_file
-
- The following is a complete list of patches to date.
-
- Prereq: 09-Nov-91
- Prereq: 10-Nov-91
- Prereq: 25-Nov-91
- Prereq: 25-Apr-92
- Prereq: 26-Apr-92
- Prereq: 27-Apr-92
- Prereq: 12-May-92
- Prereq: 02-Aug-92
- *** PATCHDATES.old Mon Aug 10 21:59:12 1992
- --- PATCHDATES Thu Aug 13 00:14:06 1992
- ***************
- *** 7,9 ****
- --- 7,10 ----
- 27-Apr-92
- 12-May-92
- 02-Aug-92
- + 12-Aug-92
- *** bug-report.old Mon Aug 10 22:59:11 1992
- --- bug-report Thu Aug 13 00:14:09 1992
- ***************
- *** 2,8 ****
- Subject: [area]: [synopsis] [replace with actual area and short description]
-
- VERSION:
- ! PD KSH: 4.6 02-Aug-92
- [Official patches will edit this line to indicate the patch level]
-
- MACHINE and OPERATING SYSTEM:
- --- 2,8 ----
- Subject: [area]: [synopsis] [replace with actual area and short description]
-
- VERSION:
- ! PD KSH: 4.7 12-Aug-92
- [Official patches will edit this line to indicate the patch level]
-
- MACHINE and OPERATING SYSTEM:
- *** sh/ChangeLog.old Mon Aug 10 22:02:13 1992
- --- sh/ChangeLog Thu Aug 13 00:15:18 1992
- ***************
- *** 1,3 ****
- --- 1,15 ----
- + Thu Aug 13 00:00:42 1992 Simon J. Gerraty (sjg@zen)
- +
- + * setstr(), varsub(): be robust when given dud args.
- +
- + Wed Aug 12 23:56:29 1992 Simon J. Gerraty (sjg@zen)
- +
- + * Fixed build problem when COMPLEX_HISTORY is not defined.
- + * don't make COMPLETE_LIST the default, add
- + bind '^[^['=complete-list
- + in .kshrc if desired.
- +
- +
- Mon Aug 3 22:41:17 1992 Simon J. Gerraty (sjg@zen)
-
- * emacs.c: correctly bind <ESC><erase>.
- *** sh/config.h.old Mon Aug 10 22:02:20 1992
- --- sh/config.h Thu Aug 13 00:15:22 1992
- ***************
- *** 1,7 ****
- /*
- * Configuration file for the PD ksh
- *
- ! * RCSid: $Id: config.h,v 1.4 1992/08/10 12:02:20 sjg Exp $
- */
-
- #ifndef _CONFIG_H
- --- 1,7 ----
- /*
- * Configuration file for the PD ksh
- *
- ! * RCSid: $Id: config.h,v 1.5 1992/08/12 14:15:22 sjg Exp $
- */
-
- #ifndef _CONFIG_H
- ***************
- *** 49,55 ****
- /* #define SILLY /* Game of life in EMACS mode */
- /* #define SWTCH /* Handle SWTCH for shl(1) */
-
- ! #define COMPLETE_LIST /* default to Emacs style completion */
- /*
- * ALTERNATIONS is csh not ksh, but it is such a nice feature...
- */
- --- 49,61 ----
- /* #define SILLY /* Game of life in EMACS mode */
- /* #define SWTCH /* Handle SWTCH for shl(1) */
-
- ! /*
- ! * better to leave this one out, and let users that
- ! * like it add
- ! * bind '^[^['=complete-list
- ! * to their .kshrc
- ! */
- ! /*#define COMPLETE_LIST /* default to Emacs style completion */
- /*
- * ALTERNATIONS is csh not ksh, but it is such a nice feature...
- */
- *** sh/edit.h.old Mon Aug 10 22:02:28 1992
- --- sh/edit.h Thu Aug 13 00:15:25 1992
- ***************
- *** 8,14 ****
- *
- *
- * RCSid:
- ! * $Id: edit.h,v 1.3 1992/08/10 12:02:28 sjg Exp $
- *
- */
-
- --- 8,14 ----
- *
- *
- * RCSid:
- ! * $Id: edit.h,v 1.4 1992/08/12 14:15:25 sjg Exp $
- *
- */
-
- ***************
- *** 77,82 ****
- --- 77,83 ----
- # undef EXTERN_DEFINED
- # undef EXTERN
- #endif
- + #undef _I_
- /*
- * Local Variables:
- * version-control:t
- *** sh/eval.c.old Mon Aug 10 22:02:35 1992
- --- sh/eval.c Thu Aug 13 00:15:28 1992
- ***************
- *** 3,9 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: eval.c,v 1.3 1992/08/10 12:02:35 sjg Exp $";
- #endif
-
- #include "stdh.h"
- --- 3,9 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: eval.c,v 1.4 1992/08/12 14:15:28 sjg Exp $";
- #endif
-
- #include "stdh.h"
- ***************
- *** 420,426 ****
- type = XARG;
- }
- } else {
- ! xp->str = strval(global(sp));
- type = XSUB;
- }
-
- --- 420,427 ----
- type = XARG;
- }
- } else {
- ! if ((xp->str = strval(global(sp))) == NULL)
- ! xp->str = null;
- type = XSUB;
- }
-
- *** sh/history.c.old Mon Aug 10 22:02:44 1992
- --- sh/history.c Thu Aug 13 00:15:33 1992
- ***************
- *** 5,11 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: history.c,v 1.3 1992/08/10 12:02:44 sjg Exp $";
- #endif
- /*
- * This file contains
- --- 5,11 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: history.c,v 1.4 1992/08/12 14:15:33 sjg Exp $";
- #endif
- /*
- * This file contains
- ***************
- *** 17,25 ****
- * things. You need to have the mmap system call for this
- * to work on your system
- */
- - #ifdef EASY_HISTORY
-
- #include "stdh.h"
- #include <errno.h>
- #include <setjmp.h>
- #include "sh.h"
- --- 17,28 ----
- * things. You need to have the mmap system call for this
- * to work on your system
- */
-
- + #include "config.h"
- #include "stdh.h"
- +
- + #ifdef EASY_HISTORY
- +
- #include <errno.h>
- #include <setjmp.h>
- #include "sh.h"
- ***************
- *** 33,39 ****
- #else
- /* Defines and includes for the complicated case */
-
- - #include "stdh.h"
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/file.h>
- --- 36,41 ----
- ***************
- *** 42,51 ****
- #include <setjmp.h>
- #include "sh.h"
-
- - int histsize = HISTORY; /* size of saved history */
- - char **history; /* saved commands */
- - char **histptr; /* last history item */
- - int histpush; /* number of pushed fc commands */
- /*
- * variables for handling the data file
- */
- --- 44,49 ----
- *** sh/lex.h.old Mon Aug 10 22:02:58 1992
- --- sh/lex.h Thu Aug 13 00:15:37 1992
- ***************
- *** 2,8 ****
- * Source input, lexer and parser
- */
-
- ! /* $Id: lex.h,v 1.3 1992/08/10 12:02:58 sjg Exp $ */
-
- #define IDENT 64
-
- --- 2,8 ----
- * Source input, lexer and parser
- */
-
- ! /* $Id: lex.h,v 1.4 1992/08/12 14:15:37 sjg Exp $ */
-
- #define IDENT 64
-
- ***************
- *** 47,53 ****
- #define SPAREN 4 /* inside $() */
- #define SBQUOTE 5 /* inside `` */
-
- ! Extern int multiline; /* \n changed to ; */
-
- typedef union {
- int i;
- --- 47,53 ----
- #define SPAREN 4 /* inside $() */
- #define SBQUOTE 5 /* inside `` */
-
- ! EXTERN int multiline; /* \n changed to ; */
-
- typedef union {
- int i;
- ***************
- *** 92,103 ****
- #define SYNTAXERR zzerr()
- #define HERES 10 /* max << in line */
-
- ! Extern char line [LINE+1]; /* input line */
- ! Extern Source *source; /* yyparse/yylex source */
- ! Extern YYSTYPE yylval; /* result from yylex */
- ! Extern int yynerrs;
- ! Extern struct ioword *heres [HERES], **herep;
- ! Extern char ident [IDENT+1];
-
- extern int yylex ARGS((int flags));
- extern void yyerror ARGS((const char *msg));
- --- 92,103 ----
- #define SYNTAXERR zzerr()
- #define HERES 10 /* max << in line */
-
- ! EXTERN char line [LINE+1]; /* input line */
- ! EXTERN Source *source; /* yyparse/yylex source */
- ! EXTERN YYSTYPE yylval; /* result from yylex */
- ! EXTERN int yynerrs;
- ! EXTERN struct ioword *heres [HERES], **herep;
- ! EXTERN char ident [IDENT+1];
-
- extern int yylex ARGS((int flags));
- extern void yyerror ARGS((const char *msg));
- ***************
- *** 105,117 ****
- #define HISTORY 100 /* size of saved history */
-
- #ifdef EASY_HISTORY
- ! extern char *history [HISTORY]; /* saved commands */
- #else
- ! extern int histsize; /* history size */
- ! extern char **history; /* saved commands */
- #endif
- ! extern char **histptr; /* last history item */
- ! extern int histpush; /* number of pushed fc commands */
-
- extern char **histget();
- extern char **histpos();
- --- 105,118 ----
- #define HISTORY 100 /* size of saved history */
-
- #ifdef EASY_HISTORY
- ! EXTERN char *history [HISTORY]; /* saved commands */
- #else
- ! EXTERN char **history; /* saved commands */
- ! EXTERN int histsize; /* history size */
- ! EXTERN char **history; /* saved commands */
- #endif
- ! EXTERN char **histptr; /* last history item */
- ! EXTERN int histpush; /* number of pushed fc commands */
-
- extern char **histget();
- extern char **histpos();
- *** sh/main.c.old Mon Aug 10 22:03:00 1992
- --- sh/main.c Thu Aug 13 00:15:39 1992
- ***************
- *** 3,12 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: main.c,v 1.5 1992/08/10 12:03:00 sjg Exp $";
- #endif
-
- ! #define Extern /* define Externs in sh.h */
-
- #include "stdh.h"
- #include <unistd.h>
- --- 3,12 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: main.c,v 1.6 1992/08/12 14:15:39 sjg Exp $";
- #endif
-
- ! #define EXTERN /* define EXTERNs in sh.h */
-
- #include "stdh.h"
- #include <unistd.h>
- *** sh/misc.c.old Sat Apr 25 18:33:28 1992
- --- sh/misc.c Thu Aug 13 00:15:42 1992
- ***************
- *** 3,9 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: misc.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
- #endif
-
- #include "stdh.h"
- --- 3,9 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: misc.c,v 1.3 1992/08/12 14:15:42 sjg Exp $";
- #endif
-
- #include "stdh.h"
- ***************
- *** 82,88 ****
- register char *s;
- Area *ap;
- {
- ! return strcpy((char*) alloc((size_t)strlen(s)+1, ap), s);
- }
-
- static struct option {
- --- 82,88 ----
- register char *s;
- Area *ap;
- {
- ! return s ? strcpy((char*) alloc((size_t)strlen(s)+1, ap), s) : NULL;
- }
-
- static struct option {
- *** sh/patchlevel.h.old Mon Aug 10 22:03:03 1992
- --- sh/patchlevel.h Thu Aug 13 00:15:45 1992
- ***************
- *** 1,6 ****
- /*
- * PD KSH
- ! * $Id: patchlevel.h,v 4.6 1992/08/10 12:03:03 sjg Exp $
- */
- #define VERSION 4
- ! #define PATCHLEVEL 6
- --- 1,6 ----
- /*
- * PD KSH
- ! * $Id: patchlevel.h,v 4.7 1992/08/12 14:15:45 sjg Exp $
- */
- #define VERSION 4
- ! #define PATCHLEVEL 7
- *** sh/sh.h.old Mon Aug 10 22:03:08 1992
- --- sh/sh.h Thu Aug 13 00:15:48 1992
- ***************
- *** 2,14 ****
- * Public Domain Bourne/Korn shell
- */
-
- ! /* $Id: sh.h,v 1.4 1992/08/10 12:03:08 sjg Exp $ */
-
- #include "config.h"
-
- ! /* allow for non-Unix linkers. main.c has a "#define Extern " */
- ! #ifndef Extern
- ! # define Extern extern
- #endif
-
- #ifndef SHELL
- --- 2,18 ----
- * Public Domain Bourne/Korn shell
- */
-
- ! /* $Id: sh.h,v 1.5 1992/08/12 14:15:48 sjg Exp $ */
-
- #include "config.h"
-
- ! /* some useful #defines */
- ! #ifdef EXTERN
- ! # define _I_(i) = i
- ! #else
- ! # define _I_(i)
- ! # define EXTERN extern
- ! # define EXTERN_DEFINED
- #endif
-
- #ifndef SHELL
- ***************
- *** 61,70 ****
- #define LINE 256 /* input line size */
- #define PATH 256 /* pathname size */
-
- ! Extern int kshpid; /* $$, shell pid */
- ! Extern int exstat; /* exit status */
- ! Extern int async; /* $!, last &'d pid */
- ! Extern volatile int sigchld_caught; /* count of dead children */
-
-
- /*
- --- 65,74 ----
- #define LINE 256 /* input line size */
- #define PATH 256 /* pathname size */
-
- ! EXTERN int kshpid; /* $$, shell pid */
- ! EXTERN int exstat; /* exit status */
- ! EXTERN int async; /* $!, last &'d pid */
- ! EXTERN volatile int sigchld_caught; /* count of dead children */
-
-
- /*
- ***************
- *** 82,88 ****
- /*
- * parsing & execution environment
- */
- ! Extern struct env {
- int type; /* enviroment type - see below */
- Area area; /* temporary allocation area */
- struct block *loc; /* local variables and functions */
- --- 86,92 ----
- /*
- * parsing & execution environment
- */
- ! EXTERN struct env {
- int type; /* enviroment type - see below */
- Area area; /* temporary allocation area */
- struct block *loc; /* local variables and functions */
- ***************
- *** 126,132 ****
-
- #define FLAG(c) (1 + c - 'a') /* map char to flags index */
- #define FLAGS 32
- ! Extern char flag [FLAGS];
- int option ARGS((const char *name));
- char *getoptions ARGS((void));
- void printoptions ARGS((void));
- --- 130,136 ----
-
- #define FLAG(c) (1 + c - 'a') /* map char to flags index */
- #define FLAGS 32
- ! EXTERN char flag [FLAGS];
- int option ARGS((const char *name));
- char *getoptions ARGS((void));
- void printoptions ARGS((void));
- ***************
- *** 235,244 ****
- #ifndef SA_NOCLDSTOP
- # include "sigact.h" /* use sjg's fake sigaction() */
- #endif
- ! Extern struct sigaction Sigact, Sigact_dfl, Sigact_ign, Sigact_trap;
- #endif
-
- ! Extern int volatile trap; /* traps pending? */
- extern Trap sigtraps[SIGNALS];
- Trap *gettrap ARGS((char *)); /* search for struct trap by number or name */
- void trapsig ARGS((int sig)); /* trap signal handler */
- --- 239,248 ----
- #ifndef SA_NOCLDSTOP
- # include "sigact.h" /* use sjg's fake sigaction() */
- #endif
- ! EXTERN struct sigaction Sigact, Sigact_dfl, Sigact_ign, Sigact_trap;
- #endif
-
- ! EXTERN int volatile trap; /* traps pending? */
- extern Trap sigtraps[SIGNALS];
- Trap *gettrap ARGS((char *)); /* search for struct trap by number or name */
- void trapsig ARGS((int sig)); /* trap signal handler */
- ***************
- *** 277,279 ****
- --- 281,296 ----
- #ifndef fileno
- #define fileno(p) ((p)->_file)
- #endif
- +
- + /* be sure not to interfere with anyone else's idea about EXTERN */
- + #ifdef EXTERN_DEFINED
- + # undef EXTERN_DEFINED
- + # undef EXTERN
- + #endif
- + #undef _I_
- + /*
- + * Local Variables:
- + * version-control:t
- + * comment-column:40
- + * End:
- + */
- *** sh/table.h.old Mon Aug 10 22:03:13 1992
- --- sh/table.h Thu Aug 13 00:15:50 1992
- ***************
- *** 1,4 ****
- ! /* $Id: table.h,v 1.3 1992/08/10 12:03:13 sjg Exp $ */
-
- /*
- * generic hashed associative table for commands and variables.
- --- 1,4 ----
- ! /* $Id: table.h,v 1.4 1992/08/12 14:15:50 sjg Exp $ */
-
- /*
- * generic hashed associative table for commands and variables.
- ***************
- *** 70,80 ****
- struct block *next; /* enclosing block */
- };
-
- ! Extern struct block globals; /* global variables and functions */
- ! Extern struct table commands; /* hashed commands */
- ! Extern struct table builtins; /* built-in commands */
- ! Extern struct table lexicals; /* keywords and aliases */
- ! Extern struct table homedirs; /* homedir() cache */
-
- struct builtin {
- char *name;
- --- 70,80 ----
- struct block *next; /* enclosing block */
- };
-
- ! EXTERN struct block globals; /* global variables and functions */
- ! EXTERN struct table commands; /* hashed commands */
- ! EXTERN struct table builtins; /* built-in commands */
- ! EXTERN struct table lexicals; /* keywords and aliases */
- ! EXTERN struct table homedirs; /* homedir() cache */
-
- struct builtin {
- char *name;
- ***************
- *** 101,109 ****
- #define V_FCEDIT 10
- #define V_COLUMNS 11
-
- ! Extern Area *lastarea; /* area of last variable/function looked up */
- ! Extern char *path; /* PATH value */
- ! Extern char *prompt; /* PS1 or PS2 */
-
- void newblock();
- void popblock();
- --- 101,109 ----
- #define V_FCEDIT 10
- #define V_COLUMNS 11
-
- ! EXTERN Area *lastarea; /* area of last variable/function looked up */
- ! EXTERN char *path; /* PATH value */
- ! EXTERN char *prompt; /* PS1 or PS2 */
-
- void newblock();
- void popblock();
- *** sh/version.c.old Mon Aug 10 22:03:29 1992
- --- sh/version.c Thu Aug 13 00:15:53 1992
- ***************
- *** 3,9 ****
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: version.c,v 1.5 1992/08/10 12:03:29 sjg Exp $";
- #endif
-
- #include "stdh.h"
- --- 3,9 ----
- */
-
- #ifndef lint
- ! static char *RCSid = "$Id: version.c,v 1.6 1992/08/12 14:15:53 sjg Exp $";
- #endif
-
- #include "stdh.h"
- ***************
- *** 12,21 ****
- #include "patchlevel.h"
-
- char ksh_version [] =
- ! "KSH_VERSION=@(#)PD KSH v4.6 92/08/10";
-
- /***
- $Log: version.c,v $
- * Revision 1.5 1992/08/10 12:03:29 sjg
- * Update for patch06.
- * Contributions from Peter Collinson, Neil Smithline and sjg
- --- 12,25 ----
- #include "patchlevel.h"
-
- char ksh_version [] =
- ! "KSH_VERSION=@(#)PD KSH v4.7 92/08/12";
-
- /***
- $Log: version.c,v $
- + * Revision 1.6 1992/08/12 14:15:53 sjg
- + * Patch07: fix some build problems,
- + * and avoid core dump from arg processing bug.
- + *
- * Revision 1.5 1992/08/10 12:03:29 sjg
- * Update for patch06.
- * Contributions from Peter Collinson, Neil Smithline and sjg
- *** sh/lex.h.~1~ Thu Aug 13 12:07:03 1992
- --- sh/lex.h Thu Aug 13 12:32:08 1992
- ***************
- *** 108,114 ****
- EXTERN char *history [HISTORY]; /* saved commands */
- #else
- EXTERN char **history; /* saved commands */
- ! EXTERN int histsize; /* history size */
- EXTERN char **history; /* saved commands */
- #endif
- EXTERN char **histptr; /* last history item */
- --- 108,114 ----
- EXTERN char *history [HISTORY]; /* saved commands */
- #else
- EXTERN char **history; /* saved commands */
- ! EXTERN int histsize _I_(HISTORY); /* history size */
- EXTERN char **history; /* saved commands */
- #endif
- EXTERN char **histptr; /* last history item */
-
- exit 0 # Just in case...
-