$OpenBSD: ChangeLog.0,v 1.5 2013/11/28 10:33:37 sobrado Exp $ Thu Jun 15 11:02:06 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.2.3 distribution * c_ksh.c(c_whence): search keyword table if vflag set. * tree.h(DOVACHECK): new define. * eval.c(expand): check DOVACHECK flag. * exec.c(execute): when calling eval(), or in t->evalflags. * syn.c(get_command): set evalflags to DOVACHECK instead of DOASNTILDE. Wed Jun 14 09:27:19 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * c_ksh.c(c_cd): two argument format: use current_wd, not path when appending elen bytes. (fix from Gabor Zahemszky). Tue Jun 13 15:54:11 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * history.c(c_fc): if last not specified and !-l, use first as last. * eval.c(maybe_expand_tilde): allow CSUBST to end tilde word. * misc.c(gmatch): made sc and pc unsigned. Fri Jun 2 11:55:40 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * configure.in: added flock to AC_CHECK_FUNCS call. * conf-end.h: undef COMPLEX_HISTORY if !HAVE_FLOCK. Tue May 30 20:38:47 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * sh.h(SEEK_SET,SEEK_CUR,SEEK_END): define if not defined. * history.c: change L_XTND to SEEK_END. Tue May 30 17:01:34 NDT 1995 John Rochester (jr@panda.cs.mun.ca) * shf.c(shf_seek): new function. * shf.h(shf_seek): new prototype. Tue May 30 16:42:41 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * aclocal.m4(KSH_DEV_FD): new test. * acconfig.h(HAVE_DEV_FD): new define. * configure.in: call KSH_DEV_FD. * c_test.h(TO_FILAXST): new enum. * c_test.c(test_stat,test_eaccess): new functions for /dev/fd/n handling. * c_test.c(test_evalop): call test_stat() and test_eaccess() instead of stat() and eaccess() in most places; added case for TO_FILAXST. Tue May 30 16:06:21 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * aclocal.m4(KSH_MEMMOVE): fixed test so copies overlap. Sun May 28 11:11:03 NDT 1995 John Rochester (jr@panda.cs.mun.ca) * sh.h(safe_prompt): new variable. * main.c(initsubs): removed PS1. * main.c(main): initialize safe_prompt; initialize PS1 from safe_prompt. * lex.c(set_prompt): create new env while expanding PS1 - if expansion fails, use safe_prompt. Sat May 27 20:59:02 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * exec.c: put comments around token after #endif. Thu May 25 10:10:45 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * c_test.c(test_eval): case TO_OPTION: negate test if option starts with a !, always fail if option doesn't exist. * sh.h(FNOHUP): new define. * misc.c(options[]): "nohup" new option. * jobs.c(j_stopped,j_stopped_running): name of j_stopped changed to j_stopped_running; changed all calls; check for/warn about running jobs if appropriate. * jobs.c(j_exit): check for/kill running jobs if appropriate. * main.c(shell),c_sh.c(c_exit): un-ifdef JOBS the j_stopped_running() call and really_exit initialization/clearing. Wed May 24 10:06:14 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * options.h(DEFAULT_ENV): new define. * main.c(main): if ENV isn't set and DEFAULT_ENV is defined, include the later. (based on patches from Dave Kinchlea). * sh.h(LAEXPR): new define. * expr.c(evaluate): changed return type to error indicator; added rval and error_ok arguments; changed all calls (c_sh.c(c_shift), c_ulimit.c(c_ulimit),eval.c(expand),var.c(global,local)). * expr.c(v_evaluate): added error_ok argument; changed return value to error indicator; call unwind() if !error_ok. * expr.c(evalerr): changed errorf() to warningf(); call unwind(LAEXPR). * c_test.c(test_eval): merged code for integer operations to have two calls to evaluate(). * io.c(warningf): print trailing newline; changed all calls. * history.c(hist_get): string search: use histptr, not histptr - 1. Tue May 23 11:07:50 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * sh.h(GI_NONAME): new define. * misc.c(ksh_getopts): honour GI_NONAME flag. * c_ksh.c(getopts_reset): set GI_NONAME flag. * exec.c(comexec): don't change $0 if FPOSIX flag set. * misc.c(ksh_getopt): don't use GI_DONE to allow parsing past bad options. * sh.h(GI_DONE): deleted define. * var.c(unset): added array_ref parameter; unset/free whole array if not an array_reference; changed all calls. * c_sh.c(c_unset): set array_ref parameter if there is a [ in the name. Mon May 22 10:33:14 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * history.c(hist_init): complex version: initialize hist_source (fix from Simon J. Gerraty). Sat May 20 11:06:15 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.2.2 distribution * Makefile.in: added c_test.h to HDRS. Fri May 19 12:35:18 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.2.1 distribution * emacs.c(v_version): ignore typed character if it is a space. * emacs.c(x_emacs_keys): bind erase-char to delete-back-word (was delete-back-char). * emacs.c(x_defkeybindings[]): bound list-file to ^X^Y and newline-and-next to ^O, as per man page. * c_ksh.c(c_whence): changed "is a keyword" to "is a reserved word". * sh.h: changed SVSV_PGRP to SYSV_PGRP. * vi.c(vi_cmd): uncommented case for ^[ to make it easy to enable completion. Mon May 15 15:25:22 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * history.c(c_fc): accept -40 as -- -40. * main.c(initcoms[]): take -- out of history alias. * vi.c(print_expansions): handle trailing slash correctly (don't print empty strings). * c_ksh.c(c_cd): put back ksh_get_wd() call for os/2. * misc.c(ksh_get_wd): changed buf to b in call to getcwd(). Tue May 9 13:57:31 NDT 1995 Michael Rendell (michael@dragon.cs.mun.ca) * c_test.h: new file. * c_test.c: major code restructuring: common parsing/evaluation routines call/called-by three sets of routines: one for normal test (and [..]), one for parsing [[ .. ]] one for evaluating [[ .. ]]. * c_test.c(oexpr,aexpr,nexpr,primary,is_op): renamed to test_oexpr, test_aexpr, test_nexpr, test_primary, test_isop. * c_test.c(eval_unop,eval_binop): combined into new test_eval function. * c_test.c(syntax): renamed to ptest_error, * c_test.c(ptest_isa,ptest_getopnd,ptest_eval): new functions. * syn.c(syntaxerr): added extra arg; changed all calls. * syn.c(db_parse,db_oaexpr,db_nexpr,db_primary): deleted. * syn.c(dbtestp_isa,dbtestp_getopnd,dbtestp_eval,dbtestp_error): added. * syn.c(get_command): case DBRACKET: changed to call new routines. * tree.c(ptree): case DBRACKET: changed. * exec.c(execute): case DBRACKET: changed. * exec.c(dbteste_isa,dbteste_getopnd,dbteste_eval,dbteste_error): added. Fri May 5 17:10:23 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * emacs.c(compl_file,compl_command): fixed buffer growing code. Thu May 4 22:44:01 NDT 1995 Michael Rendell (michael@garfield.cs.mun.ca) * aclocal.m4(KSH_UNISTD_H): include and only include if HAVE_DIRENT_H is defined. Thu May 4 21:19:15 NDT 1995 Michael Rendell (michael@garfield.cs.mun.ca) * c_ksh.c: include "ksh_stat.h". * c_ksh.c(c_cd): don't do physical chdir if S_ISLNK not defined. Wed May 3 10:08:32 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.2.0 distribution * misc.c: include . * misc.c(gmatch): added isfile argument; changed all calls. * sh.h(FILECHCONV): (os2 version) - use isupper. * emacs.c(strmatch): don't increment in FILECHCONV. * aclocal.m4(KSH_HEADER_SYS_WAIT): new macro. * configure.in: use KSH_HEADER_SYS_WAIT instead of AC_HEADER_SYS_WAIT. * ksh_wait.h: if POSIX_SYS_WAIT not defined, undef W* macros. Tue May 2 12:10:39 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * emacs.c,emacs-gen.sh,emacs-c.in,emacs.out,Makefile.in: changed emacs source munging to create emacs.out which is included by emacs.c rather then munging emacs.c itself. * lex.c(pprompt): flush shl_out. * vi.c(glob_word): if path has *?[, don't add * (was if last component). * emacs.c(x_search_char): renamed to x_search_char_forw. * emacs.c(x_search_char_back): new function; bound to ^[^]. * sh.h: changed SVR3_PGRP to SYSV_PGRP. (fixes from Gabor Zahemszky). Tue May 2 10:09:57 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * c_ksh.c(c_cd): deleted OS2 ifdefs. * path.c(make_path): use ISRELPATH instead of ISABSPATH * path.c(simplify_path): use ISROOTEDPATH instead of ISABSPATH. * sh.h(ISABSPATH,ISROOTEDPATH,ISRELPATH): changed/new defines. * aclocal.m4(AC_LANG_C,AC_LANG_CPLUSPLUS,AC_TRY_RUN): copied from autoconf's acgeneral.m4, changed to handle .exe suffix. * aclocal.m4(KSH_OS_TYPE): os2 case: set $ac_exe_suffix. * configure.in: substitute ac_exe_suffix. * Makefile.in: changed references to E to exe_suffix, set to ac_exe_suffix * c_ksh.c(c_cd): ifdef S_ISLNK second use of get_phys_path(). * edit.c(x_mode): removed ifndef OS2. (fixes from Dale DePriest) * exec.c(search_access1): add .sh to suffix lists. * vi.c(vi_insert,vi_hook): OS2: changes to allow arrow keys work in insert mode. Mon May 1 16:28:44 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * path.c(ksh_get_wd): getcwd() case, return alloc'd buffer, not a malloc'd one. Mon May 1 09:41:56 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * aclocal.m4: changed HAVE_SYS_RESOURCES_H to HAVE_SYS_RESOURCE_H. * aclocal.m4(KSH_OS_TYPE): new macro. * aclocal.m4(KSH_OS2_EMX): deleted. * configure.in: deleted calls to AC_AIX,AC_MINIX,AC_ISC_POSIX, KSH_OS2_EMX; replaced with KSH_OS_TYPE. * acconfig.h(OS_ISC,OS_SCO): new undefs. * sh.h: changed use of isc386 to OS_ISC * edit.c: changed use of M_UNIX to OS_SCO. Sat Apr 29 21:10:54 NDT 1995 Michael Rendell (michael@garfield.cs.mun.ca) * vi.c(glob_word): don't append * if there are unescaped globing characters in the last component of the filename; some redundant code eliminated. (based on fix from Michael Jetzer). Fri Apr 28 16:10:22 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * eval.c(globit): save/restore actual DIRSEP char - don't use DIRSEP. * c_ulimit.c: removed ARGS from declaration of ulimit to avoid portability problems (osf/1 has ulimit(int,...), os2 has ulimit(int,long)). * tty.c(tty_init): added __SCO__ defines to avoid opening /dev/tty. * configure.in,aclocal.m4,acconfig.h: added KSH_OS2_EMX test. * os2/config.h, os2/configure.cmd, os2/make.sed: updated for new autoconf. Tue Apr 25 12:20:45 NDT 1995 Michael Rendell (michael@dragon.cs.mun.ca) * configure.in: added sys/param.h test; changed getcwd test to getwd. * c_ksh.c(c_pwd): new function. * sh.h(current_wd, current_wd_size): new variables. * c_ksh.c(c_cd): changed to handle -L, -P. * main.c(main): use set_current_wd when setting $PWD; instead of changing to / when can't get pwd, print warning; deleted pwd alias; don't make PWD and OLDPWD reaedonly. * path.c(simplify_path): changed to handle relative paths. * path.c(make_path): added phys_path argument to support cd -P. * path.c(set_current_wd,get_phys_path,do_phys_path): new functions. * misc.c(ksh_get_wd): new function. * missing.c(getcwd): deleted. * misc.c(options[]),sh.h: added "physical", FPHYSICAL. Mon Apr 24 14:33:03 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * shf.c(shf_smprintf): new function. * expand.h(Xsize): new define. Fri Apr 21 21:22:44 NDT 1995 Michael Rendell (michael@garfield.cs.mun.ca) * sh.h: changed SIZEOF_long to SIZEOF_LONG. * exec.c(scriptexec): if OS2 ifdefed code, changed ISDIRSEP to explicit /. Thu Apr 20 21:18:12 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * history.c(hist_get) if n < 0, use n + 1 to account for histbackup(). * lex.c(set_prompt): added source argument; changed all calls; changed to do ! and !! substitutions when setting PS1. * lex.c(pprompt): ifdef'd out code to deal with ! and !!. * shf.c(shf_puts): new routine. * exec.c(herein), lex.c(getsc_): changed to use shf_puts. Thu Apr 20 15:50:35 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * siglist.sh: clear traps in subshell to cover for bug in bash 1.4.3 (based on fix from Fritz Heinrichmeyer). Wed Apr 19 12:04:59 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * vi.c(classify): cleaned up table; filled in U_ flag for commands that don't modify things. * vi.c(first_insert, saved_inslen): new variables. * vi.c(vi_reset): don't reset yanklen, inslen, lastcmd, lastac; set first_insert, saved_inslen. * vi.c(vi_insert): added code to handle first insertion to allow redoing commands from last edit. (based on fixes from Michael Jetzer). * vi.c(VVERSION): new state. * vi.c(classify): cleared C_ flag for 032 (^Z); set it for ^V. * vi.c(nextstate): added VVERSION. * vi.c(vi_hook): cases for VVERSION. * sh.h(ksh_version): new declaration; removed declaration from all other files. * Makefile.in: removed rcs-ci, rcs-diff targets; put RCSFILES into DISTFILES and removed former. * var.c(newblock): copy argc/argv from previous env if it exists. Tue Apr 18 23:10:32 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * jobs.c(exchild): report internal error if execute() returns in child. * exec.c(execute): case TASYNC: clear exec flag in call to execute(). Tue Apr 18 12:05:23 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * emacs.c(x_bind): added list argument. * c_ksh.c(c_bind): added -l (list) option. * emacs.c,emacs-c.in: moved emacs.c to emacs-c.in. * Makefile: add rule to create emacs.c from emacs-c.in. * emacs-gen.sh: new file. * emacs.c(struct x_defbindings, x_defbindings[]): new struct/array. * emacs.c(struct x_ftab, x_ftab[]): removed x_db_tab, x_db_char; initialize x_ftab[] via script. * emacs.c(x_init_emacs): changed to load key bindings from x_defbindings. * emacs.c(Findex): added typedef. * emacs.c(x_tab[]): changed to index into x_ftab; changed all refernces. * emacs.c(xft_*): changed to XFUNC_*. * emacs.c(XF_PREFIX): new flag, used for x_meta1, 2, 3. * emacs.c(KPREF,KNULL): deleted (no functional use), changed references to KSTD. * emacs.c(x_last_command): changed type to Findex. * emacs.c(x_emacs): set x_last_command to 0 at start; removed same from case KEOL. * emacs.c(XF_ARG): new flag for struct ftab. * emacs.c(x_ftab[]): filled in XF_ARG for appropriate commands. * emacs.c(x_arg_defaulted): new variable. * emacs.c(x_emacs,x_set_arg): set x_arg_defaulted. * emacs.c(x_bword, x_fword,x_fold_case): removed use of x_last_command. * emacs.c(x_fold_upper,x_fold_lower,x_fold_capitailze): trivial functions that call x_fold_case; changed x_ftab[] to use these instead of x_fold_case so arbitrary keys can be bound to them. * emacs.c(x_fold_case): changed to assume argument is 'L', 'U', or 'C'. * emacs.c(x_del_back,x_del_char,x_prev_histword,x_prev_com,x_next_com, x_kill,x_insert): use x_arg and x_arg_defaulted. * emacs.c(x_delete): don't change mark point (xmp) if <= cp; added force_push argument; changed all calls. Mon Apr 17 10:30:12 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * emacs.c(x_e_getc): changed to handle macroptr, ungetting characters. * emacs.c(x_e_ungetc): new function. * emacs.c(x_emacs): let x_e_getc() take care of macroptr. * emacs.c(x_version,x_search_hist): use x_e_ungetc() instead of macroptr. * emacs.c(x_set_arg): handle string of digits. * emacs.c(x_search_hist): handle deleting chars from search string. (fix from Dale DePriest) * emacs.c(x_search): added sameline paramater. * emacs.c(x_search_list): changes x_zots() to x_e_puts(); make deleting in empty pattern break out of search. * vi.c(domove): case '%': adjust ncursor forward only if matching opening bracket (so when cursor is on the B in "(fooBar)", c% changes the openbracket as well. * vi.c(vi_cmd): case y/d/c: special case to move end point ahead if move cmd is % and match was to the left of the cursor. Thu Apr 13 10:34:26 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * vi.c(complete_word): no bell on ambiguous matches (user can tell its ambiguous 'cause there is not space or slash appended) * configure.in,aclocal.m4: added KSH_MEMMOVE, KSH_MEMSET tests to fix problems with compiler builtins. * misc.c(blocking_read, reset_nonblock) new routines. * sh.h: deleted O_NONBLOCK ifdefs/defines. * main.c(main),lex.c(getsc_),edit.c(x_getc),shf.c(shf_fillbuf): use reset_nonblock(). (fix based on code from John Rochester) Tue Apr 11 14:36:22 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * history.c(c_fc): mostly POSIXized. * history.c(hist_execute,hist_get_newest,hist_get_oldest): new routines. * history.c(hist_get,histget): changed histget to hist_get. * history.c(hist_replace,histrpl): changed histrpl to hist_replace. * lex.h(SHIST,histpush): deleted; deleted all references. * history.c(histget): add approx check for history that hasn't happened yet. * misc.c(getn): allow leading plus (eg, +3). * main.c(initcoms[]): defined history as "fc -l --". * conf-end.h(JOBS): don't define if no posix or bsd process groups (was if SIGCONT not defined). Mon Apr 10 14:51:54 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(comexec),c_ksh.c(c_getopts),c_sh.c(c_read): use FEXPORT flag. * ksh_wait.h: changed to work with autoconf 2.x AC_HEADER_SYS_WAIT - if sys/wait.h uses union wait, don't include it. Thu Apr 6 12:19:58 NDT 1995 Michael Rendell (michael@panda.cs.mun.ca) * tty.c(tty_init): print warning if open of /dev/tty fails. Sat Mar 4 01:20:03 NST 1995 Michael Rendell (michael@garfield.cs.mun.ca) * io.c(maketemp): create valid dos filenames. Mon Feb 27 11:04:32 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * Changed from autoconf 1.x to autoconf 2.x. * acconfig.h: included old config.h.top and config.h.bot. * config.h.top, config.h.bot: deleted; deleted all references. * install.sh: changed to install-sh; changed all references. * Makefile.in: use @CPPFLAGS@, @CFLAGS@, @LDFLAGS@; use @configure_input@; remove config.log and config.cache in distclean; use @prefix@ and @exec_prefix@. * ksh_dir.h: changed to use new autoconf defines; changed NLENGTH() to NAMLEN(); changed all references. Mon Feb 27 9:31:02 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * sh.h(ISABSPATH): new macro. * var.c(setspec): use ISABSPATH() when setting tmpdir. * emacs.c(compl_file): added OS2 ifdefs. * exec.c(scriptexec): OS2: ignore path specified in #! scripts. * sh.h(ksh_dupbase): OS2: now same as unix. * trap.c(sigtraps[],inittraps): remove OS2 defines. * trap.c(alarm_catcher): V7_SIGNALS: use sig, not i. (Fixes from Dale DePriest) Mon Feb 27 10:06:00 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * configure.in: test for resource.h. * c_ulimit.c: include ksh_time.h instead of sys/time.h; use HAVE_SYS_RESOURCE_H when including sys/resource.h (was HAVE_SETRLIMIT). * aclocal.m4(KSH_RLIM_T): check sys/resources.h for rlim_t. Fri Feb 24 17:30:16 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * vi.c(struct macro_state, macro): new structure/variable. * vi.c(vi_hook, vi_cmd): use macro state info to allow nested macros, detect recursive macros. Wed Feb 22 21:20:43 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * c_ksh.c(c_whence): "an export" instead of "a export". * vi.c(classify[]): added @. * vi.c(vi_hook,vi_cmd): added support for @ (macros). (fixes from Frank Edwards). Sun Feb 19 11:57:20 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(comexec): case CFUNC: use cp (not tp->name) when checking if an autoloaded function was defined; save/restore kshname before/after function call. * var.c(popblock): don't set kshname to e->loc->argv[0] - it isn't always right. Fri Feb 10 12:36:16 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * misc.c(parse_args): check OF_SET when building set_opts (was checking OF_CMDLINE). * conf-end.h(JOBS): don't define if SIGCONT not defined. * sh.h(FLOGIN) new enum. * misc.c(options[],parse_args): added login option; set FLOGIN if name in argv[0] starts with -. * main.c(main): use FLOGIN flag; changed the way OS2 code looks for profile. Wed Feb 1 09:55:40 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * expr.c(varsub): in FUNSET test, don't always fail # and % substitutions (test for unset variable). Wed Jan 25 09:22:15 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * sh.h(MIN_COLS): new define. * sh.h(MIN_EDIT_SPACE): new define. * vi.c(prompt_trunc): new variable. * vi.c(edit_resize): calculate how much of prompt to truncate. * lex.c(pprompt): added new argument; changed all calls. * lex.c(yylex),emacs.c(x_emacs),vi.c(x_vi): move pprompt() inside x_emacs(), x_vi() or just before read in yylex(). Tue Jan 24 12:35:18 NST 1995 Michael Rendell (michael@panda.cs.mun.ca) * misc.c(parse_args): changed arrayname variable to array. * var.c(basename): changed name of function to arrayname(); changed all references (Based on fix from Dan Quinlan). Fri Dec 30 10:34:50 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * ksh.1: modifications to generate two man pages: sh and ksh (Fixes from Michael Harrdt). Wed Dec 28 16:55:13 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * vi.c(complete_word): don't check for globing characters. Wed Dec 28 10:32:18 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(search_access1): don't use ret variable; move "." to end of xsuffixes/rsuffixes. * os2.c(_execve): OS2: fixed typo. * sh.h(FILENCMP): changed stricmp to strnicmp. * os2/config.h: added define for rlim_t. * os2/make.sed: changed > null to > nul. * Makefile.in(dist): generate os2/makefile after running Dist-fixup. (Fixes from Dale DePriest) Thu Dec 22 15:06:06 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.1.3 distribution * *.c: removed RCSids. Wed Dec 21 11:55:01 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * table.h(struct tbl): changed array field to union of array/fname; changed all references. * c_ksh.c(c_whence): print undefined function path. * exec.c(comexec): do autoloading of undefined functions; print error if function can't be found. * exec.c(findcom): fill in tp->u.fname for undefined functions; search FPATH if search of PATH fails. * table.h(FC_NOAUTOLOAD): deleted define; removed all references. Tue Dec 20 14:16:16 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(herein): check if name is null. * lex.h(HEREDELIM,SHEREDELIM,SHEREDQUOTE): new defines. * lex.c(yylex): added code for HEREDELIM. * syn.c(synio): use HEREDELIM. * lex.c(readhere): changed to allow \n in here-delimiter. * tree.c(tputS): quote ", ` and $ inside "-quotes. * tree.c(ptree,pioact): made static. * tree.c(ptree,fptreef,vfptreef): added indent argument; changed to use indent argument; changed all calls. * tree.h(struct ioword): added delim field. * tree.c(iocopy),syn.c(synio,syntaxerr): deal with delim field. * tree.c(pioact): print contents of here documents. * c_ksh.c(c_typeset): typeset -f foo: set exit code to 1 if function not found. Mon Dec 19 15:14:02 NST 1994 Michael Rendell (michael@garfield.cs.mun.ca) * history.c(histinit): increment line number for each history line. * exec.c(iosetup): OS2: if open /dev/null fails, try nul instead. * Makefile.in(debugtools,install,uninstall): make check-pgrp last; use $E. * eval.c(eval,expand): OS2: added DODIRSWP code. * main.c(main): OS2: only include $HOME/kshrc.ksh if interactive. * sh.h(FILENCMP,FILECMP,FILECHCONV): new defines. * misc.c(gmatch),vi.c(grabsearch,complete_word),emacs.c(compl_file): OS2: case insensitive compares. (fixes from Dale DePriest). Mon Dec 19 09:54:42 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * vi.c(vi_cmd): make ~ honour argcnt (fix from Troy Bollinger). * vi.c(complete_word): don't add trailing / if there is already one. * vi.c(glob_word): return rval, not 0. Thu Dec 15 11:06:01 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * vi.c(vi_cmd): call complete_word() with argument of 1 not 0. Tue Dec 13 12:07:50 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * history.c(histget): made static; added approx argument; changed all calls. Tue Dec 13 10:58:14 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * Makefile.in(mandir): use $(manext), not 1 (fix from Mike Long). Mon Dec 12 20:55:53 NST 1994 John Rochester (jr@panda.cs.mun.ca) * tree.c(ptree): print TELIF part of if statements Fri Dec 9 15:21:36 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * trap.c(inittraps): OS2: don't trap SIGTERM (temporary fix). * exec.c(search_access1): OS2: fixed to check for valid suffix and change mode from X_OK to R_OK if appropriate. * edit.c: include , for SCO unix (fix from William Bader). * c_ulimit.c(c_ulimit): changed type of val from long to rlim_t (fix from Thomas Gellekum and J.T.Conklin). * aclocal.m4(KSH_RLIM_T): new test for rlim_t. * configure.in: use KSH_RLIM_T. * acconfig.h: added rlim_t. Thu Dec 8 12:20:25 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * expr.c(evalexpr): changed div-by-zero test to only derefernce vr if operation is a divide. Mon Dec 5 14:42:52 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(search): OS2: typo - changed namlen to namelen. * exec.c(search_access): OS2: check execute bit explicitly. * main.c(main): OS2: don't include ./profile.ksh. * options.h(DEFAULT_PATH): OS2: added /os2 to path. * sh.h(ksh_getdup): OS2: define to getdup(); prototype for getdup(). * Makefile.in(dist): create os2 Makefile based on distribution Makefile.in. Mon Dec 5 12:17:14 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.1.2 distribution * eval.c(globit): when searching directory, re-calculate end of string based on prefix length. Fri Dec 2 11:07:48 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * syn.c(wordlist): if token isn't 'in', don't reject ;. * eval.c(expand): leading non-white-space IFS chars no cause initial empty field. Thu Dec 1 12:04:00 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.1.1 distribution Thu Dec 1 10:50:38 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * sh.h(TF_FATAL,fatal_trap): new define,variable. * trap.c(inittraps,trapsig,fatal_trap_check,trap_pending,runtrap, settrap): use TF_FATAL, fatal_trap. * trap.c(runtraps): changed argument from bool to TF_* flag; changed all calls. * jobs.c(j_waitj): check fatal_trap flag. Wed Nov 30 11:20:03 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * conf-end.h: new file. * config.h.bot: moved guts to conf-end.h. * emacs.c(struct x_ftab): changed type of xf_db_char from char to int. * emacs.c(x_emacs): changed type of c from char to int. * emacs.c(X_NTAB): new define. * emacs.c(x_bind,x_init_eamcs): new X_NTAB, X_TABSZ. * emacs.c(x_prefix3, x_meta3): ifdef OS2. * emacs.c(x_bind): ifdef OS2; mask *a1 with CHARMASK. * exec.c(search_access): new function. * exec.c(search): use search_access() instead of duplicating test. * exec.c(search,search_access1): ifdef OS2. * Makefile.in(OS2FILES): new macro. * Makefile.in(dist): add OS2FILES to distribution. * options.h(DEFAULT_PATH): ifdef OS2. * edit.c(x_getc,x_mode): ifdef OS2. * path.c(make_path): ifdef OS2. Tue Nov 29 16:51:35 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * sh.h(EXECSHELL,EXECSHELL_STR): ifdef OS2. * exec.c(scriptexec): use EXECSHELL_STR (was "EXECSHELL"). * trap.c(sigtraps[]): ifdef OS2. * lex.c(yylex): ifdef OS2. * misc.c(change_flag): ifdef OS2. * history.c(HISTFILE): ifdef OS2. * eval.c(homedir): ifdef OS2. * c_sh.c(shbuiltins[]): ifdef OS2. * sh.h(ksh_execve,ksh_dupbase): new defines. * jobs.c(exchild): ifdef use of nice. Tue Nov 29 12:32:26 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * eval.c(globit,copy_non_glob): changed to pass/use &xp it can change (memory can be re-allocated). * ksh_dir.h(NLENGTH): new macro. * eval.c(globit): use NLENGTH macro. * alloc.c(aresize): removed redundant np and optr variables. Mon Nov 28 14:55:49 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * config.h.bot(HISTORY): new define. * lex.c(getsc_): ifdef HISTORY. * history.c: ifdef HISTORY (dummy histsave, init_histvec and hist_finish routines). * c_ksh.c(kshbuiltins): c_fc: ifdef KSH * lex.h(HISTORY): changed to HISTORYSIZE; changed all references. * options.h(KSH): new define. * config.h.bot: changed to deal with KSH define. * exec.c(do_select,pr_menu): ifdef KSH. * exec.c(execute): case TSELECT: ifdef KSH. * c_ksh.c(c_whence,c_command,kshbuiltins[]): ifdef KSH. * main.c(initcoms[],main): ifdef some aliases, SECONDS/RANDOM/TMOUT. * syn.c(get_command): case TDBRACKET: ifdef KSH. * syn.c(db_parse,db_aoexpr,db_nexpr,dp_primary): ifdef KSH. * syn.c(tokentab[]): "select", "[[" ifdef KSH. * var.c(special,getspec,setspec,unsetspec): ifdef KSH. * ksh.1: ifdef KSH; misc fixups. (changes mostly from Michael Haardt). Mon Nov 28 14:27:34 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * var.c(skip_varname,special,global,local), table.c(hash,tsearch, tenter): made argument and return value const. * main.c(version_param[]): new variable. * main.c(initcoms[],main): use version_param instead of "KSH_VERSION". * history.c(histsave): EASY_HISTORY: changed to take same arguments as COMPLEX_HISTORY histsave(); changed all calls, removing unneeded ifdefs. * vi.c(x_vi), emacs.c(x_emacs): changed unwind() call from LINTR to LSHELL so newline isn't printed twice - also lets runtrap() set the exit code. * vi.c(vi_cmd): increment source line if saving to history. Fri Nov 25 14:43:57 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * syn.c(get_command): don't generate a syntax error if EOF is read. * configure.in: add LDSTATIC to LDFALGS if the former is set. * history.c(hist_skip_back): start at the end of the buffer, not one past the end (fix from Simon J. Gerraty). Thu Nov 24 09:53:49 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * syn.c(get_command,dogroup): allow { ...;} to be used instead of do ...;done in for/select loops. Wed Nov 23 09:09:43 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.1.0 distribution * var.c(setspec): set seconds to current time - assigned value, not just current time. * emacs.c(x_copy_arg): deleted ifdef'd out code (x_prev_histword() does what it was supposed to do). * emacs.c(compl_command): don't call list_stash() twice (happened if type == 2 and multi set). Tue Nov 22 10:26:13 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * c_test.c(eval_unop): don't assume S_ISBLK, S_ISCHR, S_ISUID, S_ISGID are defined. * path.c(make_path): avoid addeding extra /'s in paths; avoid infinate loop if result buffer not big enough. * main.c(main): setting PWD: avoid calling setstr() with the current value of PWD. * var.c(typeset): set free_me to 0 if t is integer. * emacs.c(x_search_hist): added overflow checking to fixed sized buffers. * emacs.c(compl_file,compl_command): removed fixed sized buffers. * vi.c(x_vi), emacs.c(x_emacs): on interrupt, unwind instead of calling runtraps(). * vi.c(vi_cmd): added 'g' command to goto the most recent command. * c_sh.c(c_read), c_ksh.c(c_print): always increment source->line when saving history. Mon Nov 21 10:45:34 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(do_selectargs): removed use of pmenu variable (redundant) use isspace() instead of IFS chars; include . * aclocal.m4(KSH_TERM_CHECK): do not allow HAVE_TERMIOS_H check to succeed on ultrix (avoid type-ahead loss). * emacs.c(x_fword): cahnged loop to skip non word chars, then word chars (was the opposite). * main.c(shell): after error/interrupt/etc, reset an EOF if ignoreeof option is set. * vi.c(classify[]): changed space (040) from C_|U_ to M_ (got broken in 5.0.10). * ksh_wait.h(ksh_waitpid): new define. * jobs.c(waitpid): moved define to ksh_wait.h; changed use of waitpid() to ksh_waitpid(). * history.c(hist_skip_back),io.c(maketemp): use procpid instead of getpid(). Fri Nov 18 16:08:09 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * vi.c(FSHOW8): inverted meaning: now if set, do the M- stuff (done so 8 bit char sets work by default). * main.c(main): set exstat to 127 if command file can't be opened. * main.c(main): use argv[0] instead of kshname when deciding whether to include profiles. Fri Nov 18 14:25:11 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.0.10.1 distribution * tty.h: deleted KSH_VDISABLE; moved _POSIX_VDISABLE stuff to edit.c. * edit.c(x_init): calculate value for vdisable_c. * edit.c(x_mode): use vdisable_c instead of KSH_VDISABLE. Thu Nov 17 12:09:13 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.0.10 distribution * lex.c(getsc_),edit.c(x_getc): call runtraps(FALSE) if read is interrupted. * vi.c(x_vi),emacs.c(x_emacs): call runtraps(FALSE) (was TRUE). Wed Nov 16 09:48:54 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(execute,scriptexec): call __setostype(0)/(1) before/after execve() on ISC machines. * trap.c(trap_pending): new fuction. * jobs.c(j_waitj): use trap_pending(); return - if interrupted. * jobs.c(waitfor): added sigp argument; changed all calls. * c_sh.c(c_wait): use signal number set by waitfor() to set exit status. * shf.c(SHF_INTERRUPT): no longer calls intrcheck() - now sets error flag and returns EOF. * c_sh.c(c_read): re-arranged to have single shf_getc() call; if read interrupted and signal is fatal (fatal_trap_check()), make read return with appropriate exit code. * trap.c(fatal_trap_check()): new function. * trap.c(inittraps()): catch and cleanup on SIGHUP; don't force the setting of SIGINT,SIGQUIT,SIGTERM,SIGHUP. * table.c(tenter): changed to use strlen()/memcpy() instead of loops. * var.c(initvar): new function. * main.c(main): call initvar(). * var.c(special): changed to use hash table for lookup. * main.c(main),syn.c(initkeywords): moved table initialization from main() to initkeywords(). Tue Nov 15 10:01:20 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * eval.c(copy_non_glob): new routine. * eval.c(globit): changed to use copy_non_glob() instead of strchr(). * misc.c(cclass): if [..] pattern has no closing ], do literal compare of character with [ (used to always fail). * eval.c(globit): handle symbolic links in the check code. * configure.in: added check for lstat(). * ksh_stat.h: defined lstat to be stat if lstat is not available. * exec.c(search): return Xclose() instead of Xstring(). Mon Nov 14 16:28:41 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * ksh_times.h: changed BROKEN_TIMES to TIMES_BROKEN. * c_test.c(syntax): removed \n from error messages. * eval.c(glob,globit): changed to use dynamicly allocated string instead of a fixed sized buffer. Thu Nov 10 10:47:55 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * history.c(sethistsize): don't set size if new size is < 0; fixed offset calculation so histptr is not way beyond the end of array; if history is shrinking, save newest history back. * vi.c(vi_hook): case VSEARCH: call restore_cbuf() after \n or \r. * main.c(quitenv): call restfd() even if fd < 0 to re-close fd. * exec.c(execute): commented out code that set savefd[0/1] to -1 if input/output was a pipeline. * missing.c(dup2_fixup): deleted function. * sh.h(dup2->dup2_fixup): deleted define. * io.c(ksh_dup2): new function; changed all dup2() calls to ksh_dup2(). Wed Nov 9 11:11:31 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * edit.h(struct edchars): added eof field. * edit.c(x_init): initialize eof fields. * vi.c(x_vi): changed ^D to edchars.eof. * vi.c(vi_cmd): make I/cc/S skip blanks. * history.c(histsave): EASY_HISTORY: use memmove() to copy pointers back one. * vi.c(vi_cmd): make G act the same as at&t ksh. * vi.c(ismeta,O_): deleted macros; removed all references to O_. * vi.c(classify[]): add ^X and ^F to command mode. Tue Nov 8 11:15:01 NST 1994 Michael Rendell (michael@arlene.cs.mun.ca) * main.c(initsubs[]): don't set SHELL. * vi.c(vi_cmd): added v command (start up vi). * vi.c(vi_hook): added case for vi_cmd() returning 2. * vi.c(grabsearch): set anchored flag if pattern starts with ^. (based on fixes from Michael Jetzer). * history.c(findhist): added anchored argument; changed all calls. * history.c(histget): start searching from histptr-1; changed to call findhist() to do searching. * history.c(c_fc): changed to print multiline commands correctly. (based on fixes from Michael Jetzer). Fri Nov 4 10:30:14 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * lex.c(yylex): when pushing alias sources, allocate from existing source's area. * lex.c(struct source): added areap field. * lex.c(pushs): added area argument; changed all calls. * history.c(histrpl): changed constant sized hline[] to expandable string; removed hline/hsize parameters; changed all calls; put newline at end of string. * history.c(c_fc): changed to use dynamically sized buffer when reading commands; strip nulls after read. * history.c(histbackup): made static. * trap.c(block_pipe): if handler is SIG_DFL, change it to SIG_IGN. * lex.c(readhere): changed to allow eof after end-of-file marker (bug report from Andrew Moore). Thu Nov 3 09:09:39 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * io.c(coproc_read_close,coproc_write_close): new functions. * c_sh.c(c_read): call coproc_read_close() when eof is read. * c_ksh.c(c_print): set PO_COPROC if fd is coproc.write; call coproc_write_close() if write fails due to EPIPE. * exec.c(iosetup): call coproc_write_close() after #>&p. * sh.h(EF_COPROC_DUPED): deleted. * sh.h(struct coproc): deleted isopen field. * io.c(cleanup_coproc): do not use isopen field. * c_sh.c(c_exec): deleted EF_COPROC_DUPED code. * exec.c(TCOPROC): don't set isopen; don't start new coprocess if old job exists and write pipe hasn't been closed. * misc.c(str_zcpy): new function. * lex.c(getsc_): made line[] buffer local/static; use str_zcpy() to fill line[]. * history.c(c_fc): use local hline buffer instead of global line[]; use str_zcpy() to fill hline[]; * history.c(histrpl): added hline and hsize parameters; changed all calls. * history.c(hist_init): EASY_HISTORY: use local hilne buffer instead of global line[]. * lex.h(line[]): deleted. * syn.c(compile): do not set s->str to null for STTY and SHIST. Wed Nov 2 11:48:36 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * lex.c(getsc_): case SDDPAREN: set csstate before going to SPAREN state. * Makefile.in(RCSFILES): removed POSIX from list (now covered in man page). Tue Nov 1 09:27:46 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * eval.c(comsub): save/restore source before/after compile(). * c_ulimit.c(c_ulimit): allow value to be arithmetic expression (as per Korn book). * c_sh.c(c_read): call set_prompt() before printing prompt. * expr.c(v_evaluate): treat an empty expression as 0. Mon Oct 31 09:23:57 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * vi.c(grabhist,grabsearch): check that history line doesn't overflow edit buffer. * history.c(hist_finish): (EASY_HISTORY) changed for-loop condition to prevent passing the end of history. * eval.c(expand): when stuffing MAGIC, cast c to char. * misc.c(strip_nuls): new function. * lex.c(getsc_): case STTY/SFILE/SSTDIN: call strip_nuls() after reading commands. * edit.c(set_editmode): reversed strstr() arguments - check for vi/emacs in $EDITOR/$VISUAL string. * syn.c(yyparse): allow EOF as well as newline after a command. * lex.c(getsc_): case SSTRING: don't fake newline Sun Oct 30 10:55:20 NST 1994 Michael Rendell (michael@panda.cs.mun.ca) * c_ksh.c(c_print): echo: check for -n, -e and -E options. * exec.c(comexec): don't allow command -p if restricted. Fri Oct 28 10:24:48 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * var.c(typeset): in fake_assign code, was freeing t->val.s + t->type instead of t->val.s - now uses free_me variable instead of aflag. * Makefile.in(depend): change blank lines in depend output to sh.h so dumb make(1)s won't die. * mail.c: changed checking to use atime/mtime instead of size; changed struct mbox mb_size field to mb_mtime, changed all references. * main.c(shell): do not execute (or set the exit status for) a null command. * lex.c(readhere): read the newline after the eof marker. Wed Oct 26 09:11:08 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * eval.c(globit): added FMARKDIRS support. * emacs.c(x_ftab[]): added entries for ansi arrow key bindings. * exec.c(execute,iosetup): move tracing of redirections from execute() to iosetup() so expanded name can be printed. * exec.c(execute): case TDBRACKET: read was being called instead of test. * ksh_stat.h(S_ISCDF): new define. * c_test.c: added -H for context dependent files (HP bizarreness). * main.c(initcoms[]): added alias local=typeset. * Makefile.in(stamp-h,config.status): added double quotes CONFIG_FILES and LDSTATIC assignments for dmake. * aclocal.m4(KSH_SYS_SIGLIST): do something with sys_siglist so it isn't optimized away. * aclocal.m4(KSH_CLOCK_T): do extra check for clock_t in sys/times.h. * acconfig.h(CLOCK_T_IN_SYS_TIMES_H): new define. * sh.h(SIGNALS): use _SIGMAX if NSIG, _MINIX not defined. (fixes from Brian Campbell ) * emacs.c(x_transpose): changed behavior if FGMACS flag set (fix from ). Tue Oct 25 17:11:58 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * tty.c(KSH_VDISABLE): new define. * edit.c(x_init): use KSH_VDISABLE. Tue Oct 25 09:55:09 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.0.9 distribution * c_ulimit.c(c_ulimit): changed SOFT, HARD from enum to defines to avoid problems with ancient compilers. * vi.c(CHAR_LEN,char_len): changed macro to function; added FVISHOW8 support. * misc.c(options[]), sh.h(FVISHOW8): added FVISHOW8 option. Sun Oct 23 11:02:26 NDT 1994 Michael Rendell (michael@maple.cs.mun.ca) * main.c(shell): keep unwinding if LINTR and not interactive. * lex.c(yylex): do redumentery quote parsing for $(..). Thu Oct 20 11:02:27 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(execute): case TSELECT: set rv to 1 if eof is read. * exec.c(execute): case TFOR/TSELECT/TWHILE/TUNTIL: set rv to 0 before entering loop, but after setjmp incase of a continue; rv to 0 after a break. * exec.c(execute): case TFOR/TSELECT: do readonly check before assigning value. * c_ksh.c(c_getopts): do readonly check before assigning value. * misc.c(print_columns),c_ksh.c(kill_fmt_entry), misc.c(options_fmt_entry),exec.c(select_fmt_entry): new functions. * c_ksh.c(c_kill),misc.c(printoptions),exec.c(pr_menu): use print_columns() call a call-back routine to format information in columns. Wed Oct 19 10:26:25 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * misc.c(cclass): require MAGIC before - and ]. * eval.c(expand): prefix - and ] with MAGIC if appropriate. * var.c(typeset): don't allow export flag of readonly variables to be cleared. * eval.c(globit): added call to intrcheck(). Mon Oct 17 11:48:05 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * lex.c(readhere): check for and report write errors. Sun Oct 16 16:10:59 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * c_ksh.c(c_cd): don't allow cd if restricted. * exec.c(comexec): if restricted and command contains /, print error. * exec.c(ioestup): if restricted, don't allow file creations. * main.c(is_restricted): new function. * main.c(main): save and reset FRESTRICTED during .profile/ENV reading; set FRESTRICTED if argv[0] or SHELL refers to restricted shell; make PATH, ENV, SHELL readonly if restricted. * var.c(typeset): check for restricted shell and PATH/ENV/SHELL. Thu Oct 13 21:01:14 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * main.c(shell): only call j_notify() for interactive shells. * c_sh.c(c_read): check if variable is readonly before assigning value. Wed Oct 12 14:08:46 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * lex.h(COPROC),tree.h(TCOPROC,XCOPROC): added defines. * lex.c(yylex): return COPROC for |& token. * syn.c(tokentab): added COPROC. * syn.c(c_list): accept COPROC, create TCOPROC node. * tree.c(ptree): added case for TCOPROC. * exec.c(execute): added case for TCOPROC. * io.c(check_fd,get_coproc_fd): new functions. * c_sh.c(c_read),c_ksh.c(c_print): changed to use check_fd(); added -p option; for c_print() ensure SIGPIPE doesn't kill shell. * exec.c(iosetup): changed to use check_fd() for IODUP; when checking fore close, require exactly the string '-', not any string starting with '-'; added strerror() to error message. * jobs.c(exchild): don't open /dev/null if XCOPROC; close coproc.read/write/childread in child if XCOPROC; don't pass XCOPROC flag on to execute(); set coproc.job to job in parent if XCOPROC. * jobs.c(check_job): clear coproc.job if said job dies. * trap.c(block_pipe,restore_pipe): new functions. * sh.h(struct coproc, EF_COPROC_DUPED): new structure and define. * c_sh.c(c_exec): if EF_COPROC_DUPED set, clean up co-process stuff. * main.c(cleanup_parents_env): new function. * jobs.c(exchild): call cleanup_parents_env() after fork(). * tree.h(IORDUP): new define. * lex.c(yylex): changed redirection parsing to not accept & only after a single < or >; set IORDUP flag for x<&y; fixed </>> check to not allow >< (again). * tree.c(pioact): use IORDUP flag to print <& or >&. * jobs.c(exchild): set JF_ORIGFG flag if job started in foreground. * jobs.c(j_waitj): don't get default tty settings if JF_ORIGFG not set. * misc.c(parse_args): treat -A as a flag that is handled later (used to require argument); do array setting after argument sorting. * var.c(set_array): changed second argument from 0/1 flag to -1/1 flag; changed all calls. Thu Oct 6 11:55:27 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * table.c(tinit): added initial table size argument; call texpand if size isn't 0; changed all calls. * main.c(main): try to make sure table size is big enough for builtins and keywords (cut down on amount of re-hashing). * eval.c(expand): added next and prev fields to struct SubType; removed fixed length subtype array, changed code to allocate SubTypes as needed. Wed Oct 5 09:25:06 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * main.c(main): moved initio() above inittraps() as later can print stuff. * table.h(IMPORT): new flag. * var.c(typeset): if IMPORT flag set, don't allow array references, insist on assignment. * var.c(import): deleted function. * main.c(main): use typeset() instead of import(). * sh.h: include expand.h. * expand.h(Xnleft): new define. * expand.h(struct XString, Xinit): added areap field; added area argument to Xinit; changed all calls. * lex.h(struct source): added xs field. * shf.c(shf_gets,shf_getse): changed name fromshf_gets to shf_getse; return pointer to null byte instead of start of buffer. * lex.c(pushs): if type is SFILE or SSTDIN, initialize s->xs. * lex.c(getsc_): case SFILE/SSTDIN: use s->xs instead of fixed size line buffer. * syn.c(compile): don't change s->str if SFILE. * main.c(main): call pushs() explicitly for each of SSTRING, SFILE, SSTDIN, STTY. * aclocal.m4(KSH_GCC_FUNC_ATTR): changed GCC_FUNC_ATTR to HAVE_GCC_FUNC_ATTR. * config.h.bot: changed use of GCC_FUNC_ATTR; deleted GCC_FA_NORETURN, GCC_FA_CONST, GCC_FA_FORMAT defines, created generic GCC_FUNC_ATTR define; changed all uses of GCC_FA_*. * main.c(main): set s->file for SSTDIN input. * main.c(shell): pass LERROR on if not interactive. * expand.h(Xcheck,XcheckN): added XcheckN define, changed Xcheck to use XcheckN; made XcheckN call Xcheck_grow_() do do any real work (to cut down on code size). * misc.c(Xcheck_grow_): new function. * exec.c(search),c_sh.c(c_read): changed to use Xstring() routines (used to use the fixed size buffer line[]). * exec.c(findcom): avoid re-saving search() result in ATEMP. Tue Oct 4 15:32:37 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * jobs.c(j_jobs): return int value indicating error/ok; changed all calls. * misc.c(getn): added int * argument to hold result; changed return value to indicate success/failure; changed all calls. * misc.c(bi_getn): new function. * misc.c(getn_): deleted function. * io.c(internal_error,error_prefix,warningf): new functions. * *.c: changed errorf() calls reporting internal errors to use internal_error() function; changed many shellf()s to warningf(). * io.c(errorf),lex.c(yyerror): changed to use error_prefix(). * alloc.c(aprint): ifdef'd out. * tree.c(phash): deleted function. Mon Oct 3 15:08:24 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * sh.h(kshname): new variable * main.c(main): changed name to kshname, deleted local variable. * exec.c(comsub): update kshname. * var.c(popblock): restore kshname. * io.c(errorf,bi_errorf): print shell name before error message. * c_ksh.c(c_cd): print new directory on stdout, not stderr. * sh.h(GI_MINUS): new define. * misc.c(ksh_getopts): changed so once - or + introduces option, all options must start with same character. * sh.h(builtin_argv0): new variable. * exec.c(call_builtin): set/clear builtin_argv0, builtin_flag; changed argument to a struct tbl *; changed all calls. * io.c(bi_errorf): new function. * c_ksh.c,c_sh.c,c_ulimit.c,emacs.c,history.c,jobs.c: changed all uses of errorf() to bi_errorf(). * emacs.c(x_bind): changed return value to int; changed all calls. * history.c(histrpl): return 0 if there is an error; changed all calls. * misc.c(parse_args): use bi_errorf(); return -1 for error; changed all calls. * misc.c(ksh_getopts): call bi_errorf instead of errorf which means ksh_getopts() may return after an error, so changed all calls to check for '?' return. * exec.c(iosetup): use shellf() to report errors and return value indicating success or failure. * exec.c(execute): if iosetup fails, cause fatal error for special builtins, return otherwise; print PS4 and redirections. Fri Sep 30 15:17:37 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * c_ulimit.c(c_ulimit): accept unlimited as a valid value. * c_test.c(c_test): changed posix special case code to use while loop. * c_ksh.c(c_whence): for whence -p, don't look for built-ins or fuctions. Thu Sep 29 10:34:59 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * c_ksh.c(c_alias): added -r option so the sysv-bounre shell hash -r will work. * eval.c(debunk): use strchr() to find first MAGIC, if any. Wed Sep 28 15:34:32 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * sh.h(O_NONBLOCK): define to O_NDELAY or FNDELAY if not defined. * main.c(main): if stdin is O_NONBLOCK'd, clear O_NONBLOCK. * misc.c(options[], parse_args): make -c a normal flag, not an option with an argument (POSIX); deleted cargp argument to parse_args(). * main.c(main): print error if -c and no arguments left. * lex.h(SSTDIN): new define. * lex.c(yylex): added case for SSTDIN. * main.c(main): if -s flag used, set source type to SSTDIN. Tue Sep 27 08:52:11 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * lex.c(get_brace_var): new function. * lex.c(yylex): removed most ${..} parsing - leave it to expand(); use get_brace_var() to read the variable part of a ${..} expression. * tree.c(tputs,wdscan): case OSUBST: delete code that understood partially compiled ${..}. * sh.h(C_SUBOP,C_SUBOP1,C_SUBOP2): changed C_SUBOP to C_SUBOP1, added C_SUBOP2. * misc.c(initctypes): removed # and % from C_SUBOP; changed C_SUBOP to C_SUBOP1; added C_SUBOP2. * eval.c(varsub): look at word part of substitution to figure out type of substitution; check for bad substitutions; check for unset variables for #/% substitutions. * eval.c(struct SubType): changed type field to stype; changed quote field to short; added f field. * tree.h(DOTEMP_): new define. * eval.c(expand): case CSUBST: case '=': deleted bad substitution error (now handled in varsub); case OSUBST: removed special handling of trimming - varsub() does it now; when pushing/poping state (st), save/restore value of f; set f to DOPAT when trimming; case CSUBST: case '=': restore original position in string, substitute the value of the variable (as opposed to the value that was assigned to the variable); case OSUBST: if '?' qualifier, turn off DOBLANK when expandined word part; define DOTEMP_ when expanding word part of ${..[#%=?]..}; deleted first_eq and tstart - replaced with tilde_ok and saw_eq. * eval.c(expand): tilde expansion: use tstart variable instead of cp; changed '?' error message to be like at&t ksh; don't test if strval() returns NULL - it doesn't. * var.c(strval): if !ISSET, instead of returning null, set s to null. * exec.c(comexec): case TDBRACKET: don't pass DOASNTILDE to evalstr(). * exec.c(scriptexec): changed line[] to buf[] so it doesn't get confused with global the line[]. * main.c(initsubs): initialize PS4. * edit.c(x_getc): cast char to unsigned before returning. Mon Sep 26 11:06:55 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * eval.c(globit): call strnsave instead of strsave; if file has trailing /, use stat() to check that it is a directory. * eval.c(expand): case CSUBST: case #/%: deleted duplicate *dp = 0; case CSUBST: case =: copy string and call debunk() to oust MAGICs. * misc.c(print_value_quoted): deleted bogus shf_shlout argument to shprintf(); deleted unneeded test (p != s). * main.c(main): turn on FBRACEEXPAND. * misc.c(change_flag): turn FBRACEEXPAND off if turning FPOSIX on. * vi.c(x_vi): use x_vi_zotc() to print ^D. * vi.c(CHAR_LEN): new define. * vi.c(vi_hook): use CHAR_LEN() instead of inline tests for c < ' ' || c== 0x7f; search editing: display M- if necessary. * vi.c(display): changed to deal tiwh meta-characters. * vi.c(x_vi_zotc): print M- for meta chars. * emacs.c(x_e_getc): new function; changed all x_getc() calls to x_e_getc() calls. * edit.c(x_getc): don't and out upper bit. * sh.h(OPAREN,CPAREN,OBRACK,CBRACK,OBRACE,CBRACE): new defines * expr.c(OPAREN,CPAREN): re-named to OPEN_PAREN, CLOSE_PAREN. * eval.c(debunk): changed to convert MAGIC MAGIC -> MAGIC. * eval.c(expand): removed ismagic_bracket stuff - not needed. * eval.c(expand): always restore value of quote when CSUBST reached; don't set DOGLOB in fdo if trimming. Sat Sep 24 11:46:03 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * tree.h(DOBRACE_): new define. * eval.c(expand): changed check for leading ! in [..] to be more robust (old test could have looked before start of string). * eval.c(expand,maybe_expand_tilde): case ~: moved code into a function (maybe_expand_tilde). * eval.c(expand): expand alternations after macros, before globing (was before macros). * eval.c(alt_expand): changed to be called after macro expansion. * eval.c(alt_scan,alt_count): deleted (no longer needed). * misc.c(cclass): return NULL (no match) if first char in a range is greater than the second. * eval.c(expand): when building strings, stuff literal MAGIC chars. Thu Sep 22 15:05:48 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(comexec): re-arranged handling of builtin and exec; handle command (and command -p, etc.); deleted comexec_flags variable; made function static again; removed fcflags argument. * table.h(FC_NOBLOCK): deleted define. * c_sh.c(c_exec): changed empty function to deal with preserving I/O redirects (code taken from comexec()). * c_ksh.c(c_command): new function - calls c_whence. * c_ksh.c(c_whence): removed code to deal with command -p. * Makefile.in: changed [ to test. * shf.h: changed errno structure member to errno_; changed all uses (fixes for QNX from Brian Campbell). * c_test.c(enum Op): deleted trailing comma (some compilers complain). * proto.h: added volatile to tp arg of comexec() prototype. Thu Sep 22 11:08:31 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.0.8 distribution * Makefile.in(install): added missing dollar (fix from Thomas Gellekum). * emacs.c: changed CMASK to CHARMASK to avoid conflicts with some system headers (eg, HP-UX 9.01 ). Reported by Sean Hogan. * history.c(c_fc): wp not being incremented; -e strcmp() test reversed (reported by Sean Hogan). Thu Sep 21 21:12:03 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.0.7 distribution Tue Sep 20 09:56:54 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * history.c(c_fc): use ksh_getopt() to parse arguments. * c_ksh.c(c_bind): use ksh_getopt() to parse arguments. * main.c(initcoms[]): changed hash alias from alias -t - to alias -t --. * misc.c(print_value_quoted): don't use quotes if no special characters. * c_ksh.c(c_whence): added POSIX command command. * c_sh.c(c_label): removed check for null wp. * exec.c(comexec): added new flags argument (FC_*); don't call newblock() if FC_NOBLOCK set; pass flags on to findcom(); changed all calls; made comexc() a non-static function. * table.h:(FC_SPECBI,FC_FUNC,FC_REGBI,FC_UNREGBI,FC_PATH,FC_DEFPATH, FC_NOAUTOLOAD,FC_NOBLOCK): new defines. * exec.c(findcom): merged insert/justsearch/autoload arguments into one flags argument; changed code to check various flags; changed all calls. Sat Sep 17 20:17:59 NDT 1994 Michael Rendell (michael@garfield.cs.mun.ca) * exec.c(comexec): print error if builtin has no command. * exec.c(execute): before doing redirections, check for TCOM and evaluate arguments and determine if it is a special builtin; print arguments (using PS4) if FXTRACE set; case TCOM: simply call comexec(). * exec.c(comexec): deleted vp argument; only call newblock() if needed (ie, !special, !empty); evaluate assignments and put in environment one at a time; print environment (using PS4) if FXTRACE set; removed code to turn empty command into :; removed environment setting code in switch statement. * exec.c(echo): deleted function. * lex.c(yylex): only honour CMDWORD if FPOSIX set. * c_sh.c(shbuiltins): removed = attribute from false/true commands. * sh.h(E_TCOM): delete define - not used. * sh.h(null),var.c: use EXTERN for initialization of null. * sh.h(space,newline,slash): new variables (" ", "\n", "/") use these everwhere instead of "", " ", "\n", "/". * path.c: include sh.h. * exec.c(execute): combined TFOR/TSELECT cases. Fri Sep 16 11:32:01 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * lex.h(CMDWORD): new define to prevent continued alias expansion in non-command contexts. * lex.c(yylex): only set ALIAS if SF_ALIAS and CMDWORD are set. * syn.c(get_command): case LWORD/REDIR: pass CMDWORD if argc is 0. * exec.c(comexec): if there is no command, do assignments and set the return value to subst_exstat (used to fake a : command). * sh.h(subst_exstat): new variable. * exec.c(execute): case TCOM: clear subst_exstat before doing eval()s. * eval.c(expand): set subst_exstat to return value of waitlast(). * c_sh.c(c_set): if !FPOSIX, return subst_exstat instead of 0. * exec.c(execute): removed redundant "exstat = rv;" near if FERREXIT. * exec.c(comexec): case CFUNC: for normal function completion, set i to 0 and rv to return value of execute() (was i=LRETURN,exstat=..). * main.c(include): return -1 if file could not be found/opened, otherwise, the exit status of the last command is returned; changed all calls. * c_sh.c(c_dot): print error if include() returns < 0. * var.c(setspec): ifdef EDIT'd V_VISUAL, V_EDITOR cases. * misc.c(parse_args): no longer accept set -o alternations as a substitute for set -o braceexpand. * jobs.c(j_exit): when restoring tty process group, also restore our process group. * config.h.bot: define JOB_SIGS iff we have modern signal and wait routines. * jobs.c: use ifdef JOB_SIGS instead of ifdef JOBS when setting signal masks and routines or using waitpid; define TTY_PGRP and NEED_PGRP_SYNC separately from JOBS. * jobs.c(j_kill): only send SIGCONT if job is stopped. * jobs.c(j_jobs): remove exited/signaled jobs even if !FMONITOR, un-ifdef JOBS same. * jobs.c(check_job): ifdef FNOTIFY with JOBS (noted by Michael Haardt ). * jobs.c(j_notify,j_waitj): put ifdef JOBS around use of FMONITOR. * main.c(shell): removed ifdef JOBS from declaration of interactive. * ksh_limval.h,sh.h: moved include of from ksh_limval.h to sh.h since some machines define CLK_TCK there. Thu Sep 15 09:58:14 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * vi.c(vi_cmd): took out ESC as file completion char in command mode (too annoying). * jobs.c(exchild): if starting a job in the background and FBGNICE is set, call nice(). * Makefile.in: changed maxext to manext (fix from Thomas Gellekum ); in the install target, check if the path of the installed shell is in /etc/shells and complain if it isn't; added depend target, removed old $(OBJS) and trap.o dependencies. Wed Sep 14 09:39:55 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * misc.c(options[]): changed position of vi-tabcomplete option. * lex.c(yylex): ifdef use of FVI/FEMACS/FGMACES with VI/EMACS (fix from Gordan Larson ). * ksh.1(DESCRIPTION): added missing P in \fP (fix from Gordan Larson ). Tue Sep 13 11:01:47 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.0.6 distribution Mon Sep 12 11:39:07 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(scriptexec): changed so it will compile if SHARPBANG is defined; fixed error message; shell argument is everything up to a newline; don't listen to #! line unless it ends in a newline. * syn.c(get_command): case FOR: changed VARASN to ARRAYVAR. * jobs.c(waitfor): restore signal mask before returning if named job isn't own own; when waiting for unspecified jobs, only consider running jobs; don't pass JW_STOPPEDWAIT flag to j_wait. * table.h(V_TMPDIR,tmpdir): new define/variable. * var.c(setspec, unsetspec): added case for V_TMPDIR. * io.c(maketemp): use tmpdir variable if it is set, else use /tmp. * var.c(popblock): if poping a variable that wasn't set in the old environment, call unsetspec(). Fri Sep 9 10:37:18 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * sh.h(PATHMAX): increased value from 256 to 1024. * main.c(main): moved initialization of name to start of main; if getcwd() fails, use name in error message and call shf_flush(). * io.c(maketemp): check/use TMPDIR variable instead of /tmp; allocate temp structure and path in one chunk. * c_ksh.c(c_cd): when checking for no home directory, compare against null, not (char *) 0. Thu Sep 8 10:52:59 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * lex.c(yylex): case SHIST: flush shl_out after printing command. * jobs.c(check_job): when notifing, do not remove job if it is stopped. Wed Sep 7 10:55:35 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.0.5 distribution * main.c(shell): commented out shf_flush(shl_out) - shouldn't be needed since -v flushes itself. Tue Sep 6 09:30:57 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * sh.h(LSHELL,really_exit): new define/variable. * c_sh.c(c_exitreturn): if how is LEXIT, check if there are stopped jobs and, if so, unwind with LSHELL (also check/set really_exit). * main.c(shell): added case for LSHELL - stop unwinding if shell is interactive; changed local reallyquit to global really_exit. * main.c(include),exec.c(comexec): added case for LSHELL. * c_sh.c(c_exitreturn): quitenv() for LRETURN as well as LEXIT. * sh.h(TF_CHANGED): new define. * trap.c(runtrap): default EXIT/ERR trap during execution and restore original if TF_CHANGED not set. * trap.c(settrap): set TF_CHANGED when setting trap. * jobs.c(j_stopped): check that job created by current process; print "You have stopped jobs" message. * main.c(shell): don't print you have stopped jobs message. * main.c(initcoms): removed echo alias. * c_ksh.c(kshbuiltins): added echo as a builtin. * c_ksh.c(c_print): if wp[0] is echo, act like strict sysv echo; added \a (BEL) escape sequence. * syn.c(function_body): new function; calls get_command() to get the body of a function (old code did nested { } block which caused problems with how redirections after the block were handled). * syn.c(get_command): call function body to deal with foo() and function foo. * jobs.c(restore_ttypgrp): new variable. * jobs.c(j_change): set restore_ttypgrp if process group is set. * jobs.c(j_exit): if necessary, restore tty process group for main shell. Fri Sep 2 21:32:03 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * main.c(main): set FPRIVILEGED if uid (gid) doesn't match euid (egid); don't include $HOME/.profile if FPRIVILEGED; include /etc/suid_profile instead of $ENV if FPRIVILEGED. * misc.c(change_flag): if clearing FPRIVILEGED flag, set euid (egid) to uid (gid). Fri Sep 2 21:10:23 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * main.c(main): don't include $ENV if uid (gid) doesn't match euid (egid) (from J.T.Conklin). Fri Sep 2 12:07:14 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * syn.c(get_command): removed MPAREN case, taken care of in '(' case, as per POSIX.2 which says () is two operators, not one. * lex.c(yylex): don't check for/return MPAREN. * lex.h(MPAREN): deleted define. * configure.in: add test for library routine confstr(); add header test for paths.h. * sh.h: include paths.h if available; define DEFAULT__PATH. * table.h(def_path): new variable. * options.h(DEFAULT_PATH): new define. * main.c(main): initialize value of def_path; set path to def_path; remove PATH initalization from initsubs; do not set value of HOME variable (POSIX); allow SHELL, PS1, PS2, PS3 to have empty values (at&t ksh). * var.c(unsetspec): when unsetting PATH, set path to def_path. * jobs.c(j_waitj): restore proc mask before calling error if 1st tcsetpgrp() fails. Thu Sep 1 10:28:03 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * Makefile.in: added check-sig.c, check-fd.c and check-pgrp.c to RCSFILES; added rules for compiling the above; added debugtools target to compile them all. * c_test.c(arg0,t_error,T_ERR_EXIT): new variables/defines. * c_test.c(c_test): set arg0 to wp[0], t_error to 0; after calling eval_binop() or oexpr() check t_error and if set, return T_ERR_EXIT. * c_test.c(syntax): set t_error exit; use shellf() instead of errorf(); use arg0 instead of "test"; delete GCC_FA_NORETURN attribute; changed all calls to return after calling. * c_test.c(oexpr,aexpr,primary): check terror after calling oexpr(), aexpr(), nexpr(). * c_test.c(primary): if unary operator is -t and there is no argument, don't increment t_wp; if missing closing parenthesis, show next operand (if any) in error message. * c_test.c(eval_unop): default case, print t_wp[-2] (was -1). * c_test.c(c_test): set t_wp before calling eval_binop() incase there is an erorr. * c_test.c(syntax): print first message even if op is an empty string. Wed Aug 31 11:48:51 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * expr.c(O_LT, O_GT): reverse order of enums to match opinfo table. * c_test.c(nexpr): always call !nexpr() (never !primary()). * c_test.c(c_test): switch on argc-1 to make code match POSIX description; make 4 arg case fall into 3 arg case, and 3 arg case fall into 2 arg case. * c_test.c(is_not,is_and,is_or): new defines. * c_test.c(c_test,oexpr,aexpr,nexpr): use is_not,is_and and is_or. * c_test.c(primary): don't decrement t_wp in final string case. * c_test.c(eval_unop): change S_ISIFO to S_ISFIFO and S_ISFITO to S_ISFIFO. * misc.c(parse_args): use OF_SET when initializing set_opts. Wed Aug 31 09:32:39 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * made pdksh-5.0.4 distribution * jobs.c(j_change): do not restore tty process group when turning off job control; no need to save original tty process group; deleted orig_ttypgrp variable. (fixes bug in which turning off job control causes an interactive shell to exit) Tue Aug 30 14:43:48 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * aclocal.m4(KSH_OPENDIR_CHECK): always include sys/types.h; set return value according to what failed. Tue Aug 30 11:17:09 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * missing.c(strerror): for systems without sys_errlist[], report error number if unknown. * Makefile.in: added BUG-REPORTS to DISTFILES. * jobs.c(exchild): do tcsetpgrp() in both parent and child after the first process is created (may need to change to every child). * aclocal.m4(KSH_PGRP_SYNC): new test - defines NEED_PGRP_SYNC. * acconfig.h: added define for NEED_PGRP_SYNC. * configure.in: use KSH_PGRP_SYNC test. * jobs.c(exchild,j_startjob,j_sync_open,j_sync_pipe): if NEED_PGRP_SYNC is defined, use a pipe to block the first process in a pipeline until the whole pipeline is set up. Mon Aug 29 09:15:00 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * jobs.c(exchild): for background, unmonitored jobs, don't open /dev/null if input is a pipe. * jobs.c(exchild): for background, unmonitored jobs, use setsig() instead of setexecsig() to set up SIGQUIT and SIGINT; changed restoration of SIGTSTP,SIGTTIN,SIGTTOU - set them to DFL if monitoring and not a `..` command, otherwise leave them alone. * jobs.c(j_init): only use SIGTSTP,SIGTTIN,SIGTTOU if talking or monitoring - if just talking leave signals ignored. * jobs.c(j_change): if going into job control, set TF_SHELL_USES flag for sigtraps[SIGTSTP,SIGTTIN,SIGTTOU]; if leaving job control ignore signals if interactive, else restore original signals. * table.h(SPEC_BI, REG_BI): new defines. * exec.c(builtin): check for * or + in front of builtin names and set SPEC_BI or REG_BI if found. * exec.c(findcom): search for special builtins first, then functions, then regular builtins, then PATH search. * c_sh.c(shbuiltins[]),c_ksh(kshbuiltins[]): add */+ in front of POSIX special/regular builtins; add = infront of unset; remove = from alias. * c_sh.c(c_label): set exit value according to name (for true/false). * c_sh.c(shbuiltins[]): add entries for true and false. * main.c(initcoms[]): deleted true/false aliases. * aclocal.m4(KSH_OPENDIR_CHECK): new test - see if opendir() will open non-directories. * configure.in,acconfig.h: added KSH_OPENDIR_CHECK. * missing.c,ksh_dir.h(ksh_opendir): new define/function. * eval.c(globit),emacs.c(compl_file): use ksh_opendir() instead of opendir(). * main.c(include): save source filename since search() uses line[] for the filename and shell() trashes line[]. * table.h(FINUSE,FDELETE) new defines. * exec.c(execute): case CFUNC: re-arranged code so normal return goes through setjmp() switch; use FDELETE/FINUSE flags to avoid problems with a function being undefined or redefined during its execution. * exec.c(define): if FINUSE is set, set FDELETED and find a new table entry. Fri Aug 26 21:58:25 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * lex.c(getsc_): flush output after write when echoing. * Makefile.in(dist): after creating distrubution, use pathchk -p to check file names. Fri Aug 26 10:28:20 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * made pdksh-5.0.3 distribution * expr.c(IS_ASSIGNOP): new define. * expr.c(evalexpr): use IS_ASSIGNOP (bug fix). * exec.c(execute): case TFOR,TSELECT: change e->type just before setjmp() to avoid problems with bad jmpbufs. * jobs.c(startlast): new function. * jobs.c(waitlast): print error if job not started. * eval.c(comsub): call startlast() after execute(). * jobs.c(exchild,j_startjob,j_sync_pipe): when starting a pipeline use a pipe to ensure the first process doesn't die before the last process is started. * exec.c(execute): case TFUNC: set/clear FXTRACE according to tp->flag & TRACE, and restore old value when function completes. * c_test.c,exec.c,io.c,mail.c,vi.c: changed all uses of (x&S_IFMT) == S_IF* to the equivilent S_IS* (for ISC unix). * c_test.c(eval_unop): if system doesn't have symlinks or sockets (S_ISLNK,S_ISSOCK), return 0 (used to cause internal error). * ksh_stat.h(S_ISVTX): define if sys/stat.h doesn't. * sigaction.c(Signal,signal): ifdef'd Signal() and signal() out as they cause header file conflicts on some systems (eg, signal() in ISC unix); also ifdef'd out other routines not used by ksh (ie, sigdelset, sigfillset, sigismember, sigpending). Thu Aug 25 11:50:03 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * c_test.c(primary): always check that *t_wp isn't 0 before using it. * eval.c(homedir): cache home directory values. * exec.c(findcom): search builtins before tracked aliases. * table.h(commands,taliases): changed name of commands to taliases. * c_ksh.c(c_unalias): changed to use ksh_getopt(); added -t and -a options; exit with non-zero value if non-alias name unaliased (POSIX). * main.c(initcoms[]): alias hash to 'alias -t -'; added autoload alias as well; set selected comands to be tracked aliases (eg, grep, ls, who, vi, emacs, etc.). * c_ksh.c(c_alias): when printing aliases, check ISSET, not DEFINED flag (so unset tracked aliases won't cause problems); changed to use ksh_getopt(); added -t flag; added -x flag (does nothing). * c_ksh.c(c_hash): deleted function; removed all references. * table.h(CTALIAS): new define. * exec.c(findcom): added search argument for whence -p; fixed introduced bug preventing tracking of commands when insert set; changed all calls; when creating tracked aliases, set type to CTALIAS (was CEXEC). * exec.c(findcom,flushcom): when freeing old tracked aliases, use APERM, not commands.areap. * c_ksh.c(c_whence): changed to use ksh_getopt(); assume findcom() never returns 0 and never returns tp->type == CNONE; made output closer to at&t ksh output; combined vflag/!vflag switch statements; added case for CTALIAS. * exec.c(findcom): set tracked alias type to CTALIAS. * c_ksh.c(c_print): added -s option; changed to use Xstring() routines and write() instead of shf routines; returns non-zero if there was a write error. * jobs.c(struct job): changed pid_t lpid field to Proc *last_proc; changed all uses. * jobs.c(check_job): use j->last_proc instead of lp. * jobs.c(j_waitj): when checking for fake ^C, test j->last_proc status to see if it was signaled and use WTERMSIG to get signal. * main.c: initialize integer TMOUT parameter to 0; call alarm_init() if FTALKING. * trap.c(alarm_init,alarm_catcher): new functions. * trap.c(runtraps): if ksh_tmout_leave is set, exit. * sh.h(TMOUT_EXECUTING,TMOUT_READING,TMOUT_LEAVING,ksh_tmout, ksh_tmout_state): new enum values/variables. * table.h(V_TMOUT): new define. * var.c(special,setspec,unsetspec): added V_TMOUT entry. * edit.c(x_getc): call intrcheck() if read interrupted. Thu Aug 25 09:36:54 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * c_test.c(c_test): for argc cases 4 and 5, return the complement of the expressioin result; for [[ .. ]] expressions, don't parse based on argc; deleted struct t_op.op_flags field and related defines UNOP,BINOP,ACCEPT_BE,ISTEST,ISDBRACKET,ISBOTH - changed all uses to test the value of isdbracket. * c_test.c(filstat): moved body of filstat() into eval_unop(), deleted filstat(). * c_test.c: incorperated changes from J.T. Conlin (jtc@cygnus.com) for POSIXization of test builtin. Wed Aug 24 12:16:25 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * new-version.sh: new file - updates date in version.c * Makefile.in: added new-version.sh to RCSFILES; call new-version.sh in dist: target. Tue Aug 23 09:28:10 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * made pdksh-5.0.2 distribution * jobs.c(exchild): don't call restoresigs(). * exec.c(execute): do call restoresigs() (just before execve()). * c_sh.c(c_trap): ifdef'd out code to print default traps. Too ugly and it isn't clear POSIX needs it. * c_ksh.c(c_print): put -e option back in for echo emulation (-R). * c_sh.c(c_shift): generate error if n < 0. * c_sh.c(c_trap): use shellf instead of errorf to report errors (so we can return a value instead of unwinding - POSIX). * exec.c(execute): if command fails and !FERREXIT, call trapsig(SIGERR_). * c_sh.c(c_exit,c_return,c_exitreturn): combined c_exit and c_return functions. Mon Aug 22 09:39:54 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * eval.c(expand): case XARG: set word to IFS_WORD to force null words to be created. * lex.c(yylex): added indquotes flag and code for `...` parsing (to deal with "`...`" the way sh/at&t-ksh does). * trap.c(runtrap): don't reset ERR trap. * sh.h: combnied SS_USER/SS_FORCE flags with RESTORE_CURR et. al. flags; changed RESTORE_* to SS_RESTORE_*. * trap.c(setsig): combined restore, force and user flags; changed all calls. * trap.c(setexecsig): use SS_RESTORE_* values as argument. * table.h: changed LCASE to LCASEV (and UCASE_AL to UCASEV_AL) to avoid problems with ioctl/tty LCASE define. * sh.h(struct env): deleted interactive field. * main.c(shell),exec.c(iopsetup): deleted e->interactive assignment. * sh.h: made e a struct env * (was struct env); changed all references. * main.c(newenv): copy loc, flags and interactive fields explicitly. * var.c(newblock): allocate block structure, don't assume already exists. * var.c(popblock): free old block structure. * main.c(main): set e->loc to 0 before calling newblock(). * exec.c(comexec): let newblock() allocate new structure; deleted l variable (changed references to e->loc). * table.h: deleted globals variable. * c_ksh.c(c_print): treat a lone - like --. * main.c(main),trap.c(inittraps): move SIGINT,SIGQUIT,SIGTERM signal initialization to inittraps() and do it regardless of FTALKING. * trap.c(settrap): deleted force trap since probably will never add -f flag to trap. * main.c(unwind): if we are dieing of SIGINT or SIGTERM, kill ourselves with a signal. * vi.c(x_vi),emacs(x_emacs): if ^C read, call trapsig()/runtraps(); don't return -2. * edit.c(x_read): don't check for -2 return value. * vi.c(x_vi): check for quit char (^\) and fake SIGQUIT. * exec.c(comexec): made flags argument volatile. * misc.c(getn_): new function. * c_sh.c(c_exit,c_return): call quitenv() before unwind()ing; moved c_exit() next to c_return(); use getn_() instead of getn(). * main.c(shell): added exit_atend argument to deal with POSIX trap exit semantics; changed all calls. * sh.h: added STOP_RETURN macro. * c_sh.c(c_return): determine if we are returning or exiting before unwind()ing so POSIX trap exit semantics are honored. * jobs.c(j_sigchld): call trapsig() instead of messing with sigtraps[]. * trap.c(trapsig): don't restore signal handler if it wasn't set to trapsig. * sh.h: added TF_TTY_INTR flag. * trap.c(inittrap): set TF_TTY_INTR for SIGINT. * jobs.c(j_waitj): if * jobs.c,sh.h: deleted SA_RESTART ifdefs; moved SIGCLD->SIGCHLD ifdefs from jobs.c to sh.h. Sat Aug 20 15:26:24 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * sh.h: added KSH_SA_FLAGS define. * trap.c(inittrap,setsig): set sa_flags field to KSH_SA_FLAGS. * sigact.c(sigaction): if using BSD42_SIGNALS, set the SV_INTERRUPT flag. * configure.in: deleted AC_RESTARTABLE_SYSCALLS. * config.h.bot: add error message to prevent compilation if using BSD41 signals. * shf.h: added SHF_INTERRUPT flag. * shf.c(shf_fillbuf,shf_putchar,shf_write,shf_emptybuf): call intrcheck() if read()/write() interrupted and SHF_INTERRUPT set. * c_sh.c(c_read): use SHF_INTERRUPT flag. * lex.c(getsc_): call intrcheck() if read() interrupted. * main.c(main),trap.c(inittrap): moved Sigact* initialization from main() to inittrap(); made Sigact_trap/Sigact_ign static; deleted Sigact and Sigact_dfl. * sh.h: deleted declarations of Sigact*. * main.c(shell): deleted sigaction call - no longer needed. * sh.h: added RESTORE_CURR, RESTORE_ORIG, RESTORE_DFL and RESTORE_IGN defines. * trap.c(intrcheck): new function. * trap.c(runtraps): added intr argument; clear trap/intrsig before running traps; changed all calls. * trap.c(runtrap): save/restore exstat when running trap. * jobs.c(j_waitj): changed interrupt test to check intrsig and return -1. * jobs.c(waitfor): if j_waitj() returns -1, call intrcheck(). * jobs.c(j_change): use setsig() instead of sigaction() to set up SIGTTIN,SIGTTOU,SIGTSTP. * trap.c(inittraps): initialize flags for INT/QUIT/TERM. * sh.h(intrsig): new variable. * trap.c(trapsig): set intrsig if signal has TF_DFL_INTR flag set; deleted longjmp(). * trap.c(runtraps): clear intrsig. * trap.c(runtrap): if signal is defaulted and TF_DFL_INTR is set, set exstat and call unwind(); return if signal ignored; reset an ERR trap before executing it. * trap.c(cleartraps): deleted special case for EXIT; reset command traps using settrap(); clear intrsig. * trap.c(restoresigs): only deal with traps that have the TF_EXEC_IGN flag set (others take care of themselves). * trap.c(sigtraps[]): added ERR trap. * trap.c(gettrap): deleted #if 0'd ERR/EXIT check. * trap.c(gettrap,runtrap,cleartraps,restoresigs): use SIGNAL+1 to go through trap table. * sh.h(SIGEXIT_,SIGERR_): new defines. * c_kill.c(c_kill): test for signals > 128 (was >= 128) * c_sh.c(c_trap): when printing traps, use SIGNALS+1. * sh.h(struct trap): replaced ourtrap and sig_dfl fields with flags field; defined TF_SHELL_USES, etc. for flags field; added cursig field. * sh.h(struct env): replaced func_parse field with flags field; defined EF_FUNC_PARSE, EF_BRKCONT_PASS for flags field; defined STOP_BRKCONT(); changed uses of func_parse (get_command()/readhere()). * c_sh.c(c_brkcont): use STOP_BRKCONT(), EF_BRKCONT_PASS; call unwind() to do the work. Fri Aug 19 09:59:43 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * trap.c(settrap): new function - does most of what c_trap did. * c_sh.c(c_trap): changed to use settrap(); print out default actions as well as caught/ignored actions. * trap.c,c_sh.c(setsig): moved setsig from c_sh.c to trap.c and made it static; added force and user arguments; don't do anything for EXIT and ERR. * main.c(main): use sigtrap() instead of ignoresig(). * trap.c(ignoresig): deleted function. * exec.c(execute): case TSELECT: don't change SIGINT signal handler. * proto.h: use GCC_FA_NORETURN on aerror(). * syn.c(yyparse): made function static and void. * exec.c(herein): changed error() calls to errorf()s; use error() in error handler; call shf_close() instead of shf_fdclose(). * tree.h,sh.h: moved LBREAK/LCONTIN from tree.h to sh.h; added LEXIT, LRETURN, LERROR, and LINTR defines; changed values of LBREAK/LCONTIN; changed all calls to longjmp() and setjmp(). * exec.c(execute): put Break: label after main switch, changed goto Break[0-9] to Break; deleted Break[0-9] labels. * exec.c(execute): changed FOR, SELECT, WHILE, DO loop setjmps to explicitly check for LBREAK/LCONTIN, otherwise call unwind(). * exec.c(execute): case TFUNC: added setjmp switch statement to take care of various L* values. * main.c(include,shell): added setjmp switch statement to take care of various L* values. * main.c(unwind): added L* parameter to pass on to longjmp(); changed all calls. * c_sh.c(c_return): just call unwind(LRETURN); * main.c(unwind): put code from leave() in E_NONE case. * main.c(error,leave): deleted functions; replace all calls with unwind(LLEAVE or LERROR). * *.c(longjmp): replaced all calls with unwind(L..) (except the call in unwind()). * shf.h: add areap field to struct shf. * shf.c(shf_fdopen,shf_sopen): initialize areap * shf.c(shf_emptybuf,shf_close,shf_sclose,shf_finish): use areap instead of ATEMP. * shf.c(shf_sopen): if buf is 0 and writing and DYNMAIC, allocate a buffer; if writing, save room for a trailing null. * shf.c(shf_sclose): new function. * shf.c(shf_snprintf),tree.c(snptreef): use shf_sclose(). * tree.c(snptreef): changed return type to char *; if buffer is null, pass SHF_DYNAMIC to shf_sopen(); return (possibly allocated) string. * syn.c(syntaxerr): use snptreef() instead of ident. * tree.h: new define TDBRACKET; new defines DB_NORM,DB_OR,DB_AND, DB_BE,DB_PAT. * tree.c(ptree): added case for TDBRACKET. * syn.c(get_command): case DBRACKET: make TDBRACKET command; at end of function, null terminate args/vars if TDBRACKET. * c_test.c(is_db_patop): new function. * syn.c(db_primary): set type of arg to DB_PAT if is_db_patop() returns true. * exec.c(execute): added case for TDBRACKET. * syn.c(get_command): case MDPAREN: make arg[0] an allocated stuffed string (was a literal string). Thu Aug 18 11:06:49 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * c_test.c(is_op,is_binop,is_unop): new functions to test for unary/binary operators. * c_test.c(oexpr,aexpr,nexpr,primary): no longer take argument - call is_unop/is_binop directly. * c_test.c(ISDBRACKET,ISTEST,ISBOTH,ACCEPT_BE): new defines. * c_test.c(struct t_op): changed op_type field to op_flags. * c_test.c(ops[]): broke into two arrays: u_ops and b_ops; set flag field to ISDBRACKET/ISTEST/ISBOTH as appropriate. * c_test.c(t_lex): deleted function. * c_test.c(primary): before checking for unary operator, check for -BE (binary expression next) if appropriate. * c_test.c: made operator type an enum to make it easier to add operators; changed oexpr/aexpr/nexpr/primary/filstat/t_lex operand/return types. * c_test.c(struct t_op): changed op_text from char * to char [4]. * c_test.c(primary): case FILTT: using digit(**t_wp) causes core dump when there is no arg - just test if *t_wp is 0; move test into filstat(). * c_test.c(primary): use *opnd1 != 0 instead of strlen(opnd1) (3 instances). * tree.c(wdscan,wdcopy): changed string argument to const; changed return type of wdscan to const. * eval.c(expand): case CSUBST: case '?': use st->var->anme instead of cp to allow proper nesting. * eval.c(expand): case OSUBST: don't change cp - declare local variable. * eval.c(expand): case COMSUB: deleted Xsavepos() call; XCOM: deleted Xrestpos() call. * eval.c(expand): save the position of the first unquoted = for tilde expansion. * eval.c(expand): case '~': use sp == (cp+2) instead of dp == Xstring so we aren't fooled by ''~ or ${foo}~; sp[-1]/sp[-2] and firsteq for the DOASNTILDE after first = or unquoted : test. * tree.h(struct op): changed noexpand field to evalflags; changed all uses. * exec.c(execute): if t->evalflags is non-zero, pass them to eval(). * lex.h: added DBRACKET define for [[ keyword. * syn.c(get_command): added case for DBRACKET. * syn.c(db_parse,db_oaexpr,db_nexpr,db_primary): new functions to parse [[ .. ]] expressions. * syn.c(tokentab[]): added [[/DBRACKET keyword. * c_test.c(is_db_unop,is_db_binop): new functions to test if arg is [[ .. ]] unary/binary operator. * syn.c(syntaxerr): call REJECT; before token; removed REJECT before all calls to syntaxerr(). * syn.c(get_command): removed syntax error kludge. Wed Aug 17 11:07:40 NDT 1994 Michael Rendell (michael@arlene.cs.mun.ca) * c_test.c(struct ops): changed -U to -O. * tree.h: added new defined DOASNTILDE. * eval.c(expand): case '~': changed !(f&DOBLANK) to f&DOASNTILDE. * exec.c(execute): case TCOM: pass DOASNTILDE when evaluating vars and when expanding args when t->noexpand is set. * exec.c(execute): case TCASE: pass DOTILDE to both evalstr() calls (POSIX). * syn.c(get_command): don't check for redirections before determining command type; handle REDIR where LWORD are handled; default case always returns; pass ARRAYVAR flag to tpeek() if t->noexpand; don't allow redirections before "x()" function; don't allow redirection before keywords; allow a '(' in the case LWORD/REDIR: if no variables or arguments (POSIX doesn't allow this, but at&t ksh/bourne sh do). * lex.h(ARRAYVAR): new define. * lex.c(yylex): parse x[1 & 2] as one word if VARASN|ARRAYVAR. * var.c(is_wdvarname): added aok argument; changed all calls. * syn.c(get_command): case FOR/SELECT: check identifier is valid. * c_sh.c(c_trap): use print_value_quoted() to print traps; use ksh_getopt() to skip possible --. * trap.c(gettrap): allow digits only if signal numbers match POSIX values (ie, HUP=1,INT=2,QUIT=3,ABRT=6,KILL=9,ALRM=14,TERM=15). * misc.c(print_value_quoted): new function to print strings with appropriate quoting. * c_ksh.c(c_typeset,c_alias): use print_value_quoted() when printing values. * lex.h: added new ESACONLY flag - only accept ESAC keyword. * lex.c(yylex): check for ESACONLY flag when doing keyword search. * syn.c(caselist): pass ESACONLY flag to tpeek(). Tue Aug 16 10:17:47 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * lex.h(struct source); changed echo field to generic flags field; defined SF_ECHO and SF_ALIASEND. * lex.c(_getsc): case SALIAS: use isspace() to check for trailing space in alias; if alias does not end in a space, return a fake space to keep the current alias in the source list - this allows recursive alias detection; set SF_ALIAS in next source if alias does end if space. * lex.c(yylex): deleted expanding_alias, rec_alias_cnt and rec_alias_table variables; check for recursive aliases by checking the source list; don't use EXPALIAS flag; if SF_ALIAS is set in current source, set ALIAS flag and clear SF_ALAIS; deleted global alias variable. * table.h: deleted EXPALIAS define. * main.c(shell): changed s->echo to set/clr of SF_ECHO in s->flags. * table.h: added aliases and keywords tables; deleted lexicals table (POSIX says they are separate). * syn.c(keywords,initkeywords): changed name of keywords() function to initkeywords(); changed all calls; add to keywords table instead of lexicals table. * main.c(main): initialized aliases/keywords tables; deleted initialization of lexicals table. * c_ksh.c(c_whence,c_alias,c_unalias),lex.c(yylex): use keywords/aliases tables instead of lexicals table; removed unneeded type == CALIAS checks. * var.c(getint): new function, largely take from strint(). * var.c(strint): call getint() to do most of the work; if vq was an allocated string, free the string and clear the alloc flag. * var.c(intval): call getint() instead of strint(). * mail.c(mcheck): use getint() instead of strint() when getting value of MAILCHECK. * var.c(skip_varname): added argument to allow array references; changed all calls. * var.c(set_array): remove valid variable name check - done in parse_args(). * var.c(strint): check if getspec()/setspec() need to be called. * var.c(intval): remove getspec()/INTEGER checks - let strint() do it. * var.c(skip_wdvarname,is_wdvarname,is_wdvarassign): new functions. * lex.h(VARASN): new define indicating variable assignment expected, currently used to parse "x[1 & 2]" as one token - may be used in future in returning AWORD (assignment word) to the parser. * lex.c(yylex): Subst: case '[': use is_wdvarname() in determining whether to parse an array dereference; do not require an = after the dereference (typeset -r x[1 & 2] is legal). * syn.c(many functions): pass VARASN to token/musthave/tpeek/synio when ever the next token might be the first word of a simple command. * syn.c(get_command): case LWORD: use is_wdvarassign() to distinguish variable assignments from normal arguments; allow aliases after redirections and variable assignments; generate syntax error for "foo=bar bogusfunction()"; allow array variables in for and select statements. * lex.c: make global alias variable static (no longer used by get_command()). * syn.c(get_command): put MDPAREN into its own case. * lex.c(yylex): deleted place holder for tilde expansion. * tree.h(struct tree): added noexpand field for alias/export/readonly/typeset. * syn.c(newtp),tree.c(tcopy): initialize/copy noexpand field. * syn.c(get_command): case LWORD: set noexpand if assign_command() returns true. * syn.c(assign_command): new function - returns true if command is alias, export, readonly or typeset. * exec.c(execute): case TCOM: don't pass DOTILDE flag when expanding t->vars; don't do field splitting/globbing/tilde expansion of t->args if t->noexpand is set. * table.h: re-grouped the struct tbl flags into common, variable, funtion, builtin/alias, etc (some values overlap); new flag names: KEEPASN (was overloaded with TRACE) and NOEXPAND. * exec.c(comexec,builtin): changed TRACE to KEEPASN. * tree.c(tcopy): when copying t->str, use strsave(), not wdcopy() if not copying a TCASE. * c_ksh.c(c_typeset): added -p flag for POSIX export/readonly. * eval.c(expand): expand tilde in place; don't do tilde expansion on results of substitution (POSIX); only do tilde expansion if login name is unquoted (POSIX); don't check for fdo&DOTILDE when a word is completed. * eval.c(tilde): changed to return home directory of a given login name (taking care of null/+/-) (old version copied string, scanning for, and replacing, magic tildes). * exec.c(findcom): don't create commands table entries when not inserting; when doing access test of tracked alias, check for ISSET, not ALLOC (but test ALLOC before calling afree). * exec.c(search): use strcpy() instead of loop. Mon Aug 15 14:46:58 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * c_ksh.c(c_print): added at&t ksh -R flag; deleted -e flag; changed to use ksh_getopt(). * main.c(initcoms[]): changed echo alias from 'print -' to 'print -R'. * sh.h: new variable procpid; added pid field to struct temp. * jobs.c: changed references to my_pid to procpid; deleted my_pid variable. * io.c(maketemp): initialize pid field from procpid. * main.c(remove_temps): only remove temporary files created by the current process. Sun Aug 14 11:47:05 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * var.c: added var field to struct Expand and struct SubType; deleted struct SubType.name field. * var.c(expand): case OSUBST: use x.var/st->var field to save result of global() for use in case CSUBST - this avoids problems with x[i+=1] being evaluated twice; check to see if value is being assigned to non-variable (eg, ${*:=aja}) or read-only variable. * var.c(varsub): set value of xp->var; possibly generate error if FNOUNSET set when expanding ${#*}, ${#var}, or ${#array[*]}. * table.h: added struct tbl.areap field to get rid of lastarea problems; deleted lastarea variable; changted all refernces to lastarea to var->areap. * table.c(tenter): initialize areap field. * var.c(arraysearch): deleted area parameter; initialize areap field. * var.c(global,local,intval,setint): initialize areap field of vtemp. Fri Aug 12 10:54:51 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * expr.c: re-wrote e*() functions using single function and table; token() now does table lookup; added full C expressions (sans pre/post increment, sizeof). * table.h(INT_U,INT_L): new flags. * var.c(strval): handle INT_U. * c_ksh.c(c_typeset): add exclusions for INT_U/INT_L; add -U option for unsigned (non-at&t ksh). * var.c(set_array): use global() instead of local(); * var.c(global): when parsing $123, don't limit number to 1000. * expr.c(v_evaluate): like old evaluate, but assigns result to specified variable. * expr.c(evaluate): changed to use v_evaluate(). * expr.c(e0): when parsing literals, use strint() instead of setstr(). * var.c(setstr): when assigning to integers, use v_evaluate() instead of strint(). Thu Aug 11 11:33:17 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * var.c(strint): don't change anything until number completely parsed; don't clear ISSET flag if parsing fails; fail parse if non-integer/non-letter found; default base if copying from integer variable; set ISSET if parsing succeeds. * expr.c(tempvar): set vp->val.i to 0. * expr.c(token): when skipping a literal number, don't allow _; use isspace() to skip. * expr.c(asn): use strint()/setstr() instead of setint(). * expr.c(e0): added unary ~ and + (posix). * var.c(global,local): always call substitute on contents of [..]; free sub when finished eval. * ksh_limval.h: new file. * shf.c: use ksh_limval.h. * Makefile.in: added ksh_limval.h to HDRS. Wed Aug 10 10:57:01 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * c_ksh.c(c_whence): case CFUNC: print exported/traced/undefined, do not print function definition. * exec.c(findcom): new argument indicated if functions to be autoloaded; changed all calls. * misc.c(ksh_getopt): added # option modifier for typeset. * c_ksh.c(c_typeset): changed to use ksh_getopt(); added -L, -R, -Z, -l, -u flags; quote variable values when printing; generally re-arranged function. * table.h: added LJUST,RJUST,ZEROFIL,LCASE,RCASE; deleted FUNCT. * exec.c(findfunc): new function. * exec.c(define,findcom): use findfunc(); skeleton autoload code. * var.c(typeset): added two arguments for initial field width and base; changed all calls; deal with LJUST,.. flags; re-arrange to have one loop iterating over array; do readonly check before changing attributes. * var.c(strval): deal with LJUST,.. flags when getting integers. * var.c(setstr): deal with LJUST,.. flags when setting strings. * var.c(setstr): deal with LJUST,.. flags when setting strings. * var.c(arraysearch,tenter): initialize {new,p}->field to 0. * table.h: added struct tbl.field. * siglist.in: changed signal messages to be more or less the same as sys_siglist[]; moved SIGUNUSED before SIGBUS. * jobs.c(j_print): assume sigtrap[].mess always valid; use sigtrap[].mess directly for stopped processes. * aclocal.m4(KSH_SYS_SIGLIST): new macro like KSH_SYS_ERRLIST. * configure.in: use KSH_SYS_SIGLIST instead of AC_SYS_SIGLIST_DECLARED. Tue Aug 9 10:28:45 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * version.c: removed RCS logs since version numbers don't match release numbers. * configure.in: added AC_PROG_CPP * Makefile.in: added rules for generating siglist.out * siglist.in,siglist.sh: new files. * trap.c(inittraps,deftraps[]): deleted deftraps[]; initialize sigtraps[] directly by including siglist.out. * tree.h: added EXPRSUB for $((..)), re-numbered defines. * tree.c(tputS,wdscan): added case for EXPRSUB. * eval.c(expand,alt_count,alt_scan): added case for EXPRSUB. * lex.h: added SDDPAREN for $((..)). * lex.c(yylex): added case for SDDPAREN. * lex.c(yylex): case SPAREN: match parenthesis using counter instead of pushing/poping states. * lex.h: re-numbered S* defines to be sequential; added SREREAD. * lex.c(yyerror): pop SREREADs. * lex.c(getsc_): added case for SREREAD. * lex.c(arraysub): changed to save whatever is read and return a value indicating if brackets matched; changed all calls. * lex.c(yylex): if brackets in array reference are not balanced, or if array reference not followed by an =, re-read the input. Mon Aug 8 21:20:08 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * sh.h: fix lseek prototype (from sjg@zen.void.oz.au) * configure.in,jobs.c: added HAVE_SYSCONF; don't use sysconf() unless HAVE_SYSCONF defined (for NetBSD-Feb12 from sjg@zen.void.oz.au). * jobs.c(put_job): removed PJ_ON_END case and define (not used). Wed Jul 27 10:19:42 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-5.0.1 distribution * exec.c(comexec): when doing exec has no command, fall through and do variable assignments. * c_ksh.c(c_let): complain if there are no arguments. * exec.c(comexec): if XEXEC is set, exit after executing (builtin/function) command; deleted FERREXIT code; don't set exstat. * exec.c(execute): handle FERREXIT; set exstat to rv for all cases. * lex.c,syn.c: changed calls to errorf to yyerror (except the on in yyerror()). * lex.h(struct source): added errline field. * lex.c(yyerror): now a varargs function; if source->errline field is non-zero, print it instead of source->line. * syn.c(syntaxerr): set source->errline if read EOF in a multiline command. Tue Jul 26 11:22:06 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * lex.h(SYNTAXERR,INP): deleted macros. * lex.h(HISTORY): upped to 128 as per POSIX. * lex.h,syn.c(multiline): moved from lex.h to syn.c. * tree.c(vfptreef): added %R to format I/O redirections. * tree.c(pioact): don't output unit more than once; print unit only if it isn't the default for the action; print only one opening quote for quoted here documents; print <> for read-write (was ><). * syn.c(zzerr, syntaxerr): replaced zzerr function with new syntaxerr function; changed uses of SYNTAXERR to syntaxerr() calls; print out the last unused token; if in a multiline command when EOF encountered, print token that was unmatched. * tree.h(TBANG),lex.h(BANG): for POSIX ! keyword * tree.c(ptree),exec.c(execute): added case for TBANG. * syn.c(restab[]): added ! keyword. * syn.c(get_command): added case for BANG (!). * tree.h(XERROK): new define to allow non-zero exits to be ignored in certian circumstances (set -e). * exec.c(execute): pass XERROK to recursive execute() calls; set XERROK when evaluating conditional part of if/while/until/&&/||. * exec.c(comexec): pass XERROK on to functions; don't exit if XERROK is set. * jobs.c(async_pid): new variable needed since async_job may go away, but $! should still be expanded. * jobs.c(j_async): return async_pid. * jobs.c(j_set_async): set async_pid. Mon Jul 25 14:15:25 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * misc.c(parse_args): changed to use ksh_getopt(). * c_sh(c_set): deleted call to resetopts() - neither POSIX nor at&t ksh touch OPTIND when positional parameters are changed. * exec.c(comexec): changed resetopts() call to getopts_reset(1) - this is not a proper fix - should declare a local optind. * misc.c(builtin_getopt,ksh_getopt): renamed builtin_getopt to ksh_getopt (shorter); changed to use state structure instead of static variables; changed all calls; optionally allow + to introduce an option; don't skip lone - (or +) in arguments - set optind to point to it. * misc.c(ksh_getopt_reset): changed to use state structure instead of static variables. * sh.h(Getopt): new structure for ksh_getopt() state. * exec.c(call_builtin): call ksh_getopt_reset(). * c_ksh.c(c_getopts,getopts_reset): new getopts implementation that is POSIX complient and uses ksh_getopt() routine. * var.c(setspec): call getopts_reset() when OPTIND set. * getopts.c: deleted file. * Makefile.in: deleted getopts.c and getopts.o. * options.h(FASCIST): deleted option. Thu Jul 21 09:52:03 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-4.9+mun.5 distribution * syn.c(get_command),shf.c(shf_fdopen,shf_sopen,shf_emptybuf): added cast to alloc()/aresize() calls. * sh.h: changed enum flags_enum to enum flags. * misc.c(change_flag): changed type of first argument to enum flag. * edit.c(set_editmode): change type of static array to enum flag. * edit.c(x_init): initialize tty chars to -1, except for werase, which is set to ^W. * edit(x_mode): split oldedchars structure declaration and initalization (some old compilers don't like them combined). * c_test.c: made -h work like -L. Wed Jul 20 11:12:52 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * config.h.top: moved compile options into options.h; include options.h. * options.h: new file. * c_ksh.c(c_fgbg): if !FPOSIX, set return job exit status. * jobs.c(j_jobs,j_notify): use JF_REMOVE to flag jobs to delete after all notification done (to prevent multiple + or - jobs). * jobs.c(put_job): new funtion, takes argument to specify where to put job; changed all calls to put_job_on_front and put_job_on_end to use this; put background processes just after stopped jobs (instead of at end) (POSIX). * jobs.c(put_job_on_front,put_job_on_end): deleted. Tue Jul 19 10:33:55 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * aclocal.m4(AC_MMAP): copied from autoconf's acspecific.m4 and modified to use the MAP_FILE flag if available. * misc.c(change_flag): ifdef use of FVI/FEMACS/FGMACS. Mon Jul 18 13:19:29 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * sh.h(async): deleted. * var.c(global): call j_async() instead of using async global. * jobs.c(j_async,j_set_async()): new functions. * jobs.c(j_startjob): new function. * jobs.c(exchild,j_waitlast): call j_startjob() to start job. * jobs.c(j_sigchld): if any jobs aren't started, note signal occured and return without calling wait. * jobs.c(j_resume): allow un-reported dead jobs to be fg'd/bg'd; if backgrounding, set async job. * jobs.c(j_jobs,j_notify,j_waitj,check_job,remove_job): re-wrote to deal with posix `known processes'. * jobs.c(j_lookup()): if number specified, see if it is a lpid first, then check for pgrp. * jobs.c(new_job): added functionality of j_newjob(). * jobs.c(j_newjob): deleted function and all calls. * tty.c(tty_init,tty_close): new functions which initialize tty_fd, tty_state and tty_devtty. * jobs.c(j_init,j_change): use tty_init()/tty_close(); changed references of ttyfd to tty_fd; moved tty_fd, tty_state and tty_devtty to tty.h; call tty_init() if !FMONITOR; save/restore tty modes on foreground job completion if FTALKING (was FMONITOR). * edit.h(X_chars): new structure for tty driver characters (replaces ed_erase, ed_kill, ed_werase, ed_intr, ed_quit); moved prototypes for emacs.c and vi.c from proto.h to edit.h; changed all references to ed_* to edchars.*. * edit.c(x_mode): use tty_state instead of cborig; re-initialize tty state from tty_state whenever entering xmode; save tty characters in edchars structure. * edit.c(x_init): now called from main(); initializes edchars, x_cols, and calls x_init_emacs. * emacs.c(x_init_emacs): changed erase,kill,werase,intr,quit arguments to X_chars argument. Fri Jul 15 10:35:13 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * io.c(restfd): only flush if fd is 2; use dup2() instead of fcntl(F_DUPFD) (2 system calls instead of 3). * ksh_wait.h(WEXITSTATUS): changed mask from 0x7f to 0xff. * tty.h: added TTY_state structure. * tty.c: new file - contains get_tty() and set_tty(). * edit.c(x_init,x_mode): use get_tty() and set_tty(). * jobs.c(j_waitj,j_resume): save/restore tty modes of stopped jobs, as per POSIX.1, B.2, job control; for foreground jobs, save tty state after successful completion, restore tty state after non-successful completion (signaled, non-0 exit, stopped). * misc.c(options): changed "alternations" to "braceexpand" (this is what bash uses - no need to invent new option names); changed ALTERNATIONS define to BRACEEXPAND, same for FALTERNATIONS to FBRACEEXPAND. * jobs.c(check_job): if process died of SIGINT or SIGPIPE, leave job state as PEXITED (not PSIGNALLED). * jobs.c(j_print): if printing short notice, ignore SIGPIPE the way SIGINT is ignored. * exec.c(comexec): flush shl_out after 'not found' message. * c_ksh(c_kill): re-wrote function (again) to handle posix options (-s, --, etc.) and posix -l output. * configure.in: added strcasecmp function check. * missing.c(strcasecmp): define strcasecmp function if not available. * trap.c(gettrap): use strcasecmp when comparing signal names. * var.c(global): expand $! to nothing if there haven't been any asynchronous processes started yet. * misc.c(options): added posix option (set automatically if POSIXLY_CORRECT env variable is set or if POSIXLY_CORRECT config define is defined) * var.c(special,setspec): added POSIXLY_CORRECT. * config.h.top: added POSIXLY_CORRECT define. * main.c(main): set FPOSIX if POSIXLY_CORRECT is defined. * POSIX: new file describing what the posix flag controls. Thu Jul 14 10:53:15 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * jobs.c,sh.h(killpg): moved killpg define to sh.h. * jobs.c(exchild): set async variable when starting background processes. * jobs.c(j_resume): print [job-num] before command when backgrounding; print to stdout instead of stderr. * c_ksh.c(c_fgbg): call builtin_getopt to skip possible --, complain about unknown options. * jobs.c(held_sigchld): new global variable. * jobs.c(j_sigchld): if any jobs aren't started, set held_sigchld and return. * jobs.c(exchild,waitlast): after setting JF_START, if held_sigchld set, call j_sigchld(). * jobs.c(exchild): added/initialized ppid field to struct job; deleted global is_child. * jobs.c(waitfor): don't wait for a process that isn't a child of the current process. * jobs.c(j_exit): kill stopped jobs owned by current process only. * jobs.c(check_job): don't do monitor stuff for XXCOM jobs, but do set up notification. * jobs.c(j_waitj): added JW_NOTIFY flag to print job notification messages. * jobs.c(exchild): remove !XPIPEI condition - we now close pipe so pipeline doesn't have to call waitlast(). * exec.c(execute): case TPIPE: no need to restore 0 or call waitlast() since exchild() handles everything. * jobs.c(remove_job): set last_job to 0 if we are removing it. * jobs.c(waitlast): check if last_job is 0. * jobs.c(struct job): combined started, waiting, interactive field into flags field; added JF_* flags; changed JW_NONOTIFY to JW_NOTIFY and changed all calls to j_waitj() to reverse this flag. * jobs.c(exchild): ignore SIGTSTP, TTIN, TTOU for `command` jobs. Wed Jul 13 09:28:34 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * main.c(main): when checking if FMONITOR set on command line, use 127 instead of -1 (signed vs unsigned char problem). * tree.h: renumbered, XEXEC, XFORK, ... and DOBLANK, DOGLOB, ... to use bits in order (instead of 0 5 2 4...). * jobs.c(j_init): don't set sigtrap[SIGCHLD].sig_dfl = 1 as a forked child may be a shell that needs to trap SIGCHLD. * tree.h(XPCLOSE,XCCLOSE): flags for close in parent, close in child. * jobs.c(exchild): added third argument - a file descriptor - if flags has XPCLOSE, close fd in parent, if flags has XCCLOSE, close in child. * exec.c(execute): pass input side of pipe to exchild() so it can be closed in the child. Tue Jul 12 10:21:57 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * main.c(main): let ignoresig() handle SIGTERM. * jobs.c(exchild): let restoresigs handle SIGTERM. * lex.c(yylex): don't parse array references inside double quotes (partial fix). * emacs.c(x_print): use shprintf instead of shellf so the output of bind can be redirected. * trap.c(deftraps): added SIGINFO (from jconklin@netcom.com). Fri Jul 8 09:37:51 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-4.9+mun.4 distribution * Makefine.in: added $(LDSTATIC) to LDFALGS to make static linking easier (suggested by sjg); use cp -p when creating distributions to preserve file dates. * configure.in: set LDSTATIC in Makefile if present in environ when configure is run. * sigact.c(sigsuspend): when calling 4.2bsd sigpause, pass *mask, not mask. * main.c(main): fixed up initialization of PWD (free memory, print more informative message). * misc.c(getcwd): range check backwards. * c_sh.c(setsig): set sa_flags/sa_mask. * edit.c(init_editmode),main.c,proto.h: deleted function - not needed since VISUAL/EDITOR are special. * lex.c(set_prompt),table.h: take out PS3. * c_sh.c(c_umask): handle multiple actions in symbolic mode clauses (eg, u+r-w); handle X (eg, o+X); ignore s (eg, u+s). * shf.c(shf_fillbuf): continue reading if we get an EINTR. * shf.c(shf_emptybuf,shf_write,shf_putchar): continue writing if we get an EINTR. Thu Jul 7 10:19:24 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * sigaction,sigprocmask: changed NULL third argument to (struct sigaction *) 0. * sh.h(kshpid): changed type from int to pid_t. * proto.h(do_ulimit): removed do_ulimit() declaration. * vi.c(complete_word): removed unused variable pos. * syn.c(pipeline,elsepart): removed unused variable c. * jobs.c(exchild): deleted variable s (assigned but not used). * history(hist_init),shf.c(shf_gets): changed variable e to end because there is a global e. * exec.c(do_selectargs): removed secondarg argument; changed return (char *) 1 to (char *) 0; changed all calls. * io.c(canseek): use fd argument instead of 0. * lex.c(readhere): don't use fixed sized buffer (line). * expand.h: changed multi-statement macros to use do {..} while (0); changed temporary variable vp to vp__ to avoid lint complaints. * aclocal.m4(KSH_DUP2_CHECK): define F_GETFD/F_SETFD if not already defined. * etc/profile, etc/ksh.kshrc: replaced with new versions from Simon J. Gerraty (sjg@zen.void.oz.au). Wed Jul 6 10:09:55 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * jobs.c(killpg),configure.in: restored use of killpg() - some systems don't understand kill(-pgrp, signal) (ultrix 2.2); added test for killpg() in configure.in. * trap.c(inittraps): changed initialization of sigtraps - was using -1 in deftraps[] as end of table marker but some systems (eg, ultrix 2.2) define signals with -1 values (SIGPWR). * Makefile.in(mandir,install): fixed mandir value; added / in man installation; prefixed ksh.1 with $(srcdir). * jobs.c(j_init): Ignore failure of TIOCSETD. * misc.c(options[]): changed "vicomplete" to "vitabcomplete". * emacs.c(x_e_putc,x_e_puts,x_debug_info): x_e_putc()/x_e_puts() are the x_putc()/x_puts() functions from ksh4.9 edit.c (they got lost in the merge); same for x_debug_info(); changed x_e_putc/x_e_puts to call x_putc/x_puts. Mon Jul 4 09:29:05 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-4.9+mun.3 distribution * main.c(remove_temps): use unlink() instead of remove(); delete remove() define. * sh.h(func_heredocs, struct env): added func_heredocs for here documents in functions; added func_parse field to struct env - set when a function is being parsed. * lex.c(readhere): if e.func_parse, save temp file in func_heredocs. * syn.c(get_command): increment/decrement func_parse when parsing functions. * main.c(remove_temps,reclaim,leave): added remove_temps(); make reclaim() call remove_temps(); make leave() clean up function here documents. * aclocal.m4(KSH_TIMES_CHECK): new test - define TIMES_BROKEN if times() doesn't exist or if it always returns 0. * acconfig.h(TIMES_BROKEN): new define. * missing.c(ksh_times): new function. * ksh_times.h: new file. * c_sh.c,jobs.c: changed to "ksh_times.h" * c_sh.c,ksh_time.h(CLK_TCK): moved CLK_TCK define from c_sh.c to ksh_time.h (needed in missing.c). * syn.c(get_command): case TIME: don't call pipeline() with CONTIN flag. * c_sh.c(c_times): combined some printfs(). * jobs.c(j_jobs,j_kill,j_resume,waitfor): block SIGCHLD before calling j_lookup() or looking at jobs list - avoids potential problems with remove_job() being called in signal handler. Sun Jul 3 11:09:01 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * exec.c(do_selectargs, selread, pr_menu): re-wrote do_selectargs to let c_read() to most of the work; deleted selread; make pr_menu calculate width/ncolumns each call so select can be used recursively. * configure.in, aclocal.m4(KSH_TERMIOS_H, KSH_TERM_CHECK): replaced KSH_TERMIOS_H with KSH_TERM_CHECK; removed calls to tcgetpgrp/tcsetpgrp - there is a separate test for this. * main.c(main), sh.h: move getcwd() declaration to sh.h. * eval.c(expand,varsub): added XNULLSUB case to deal with "$@" (and "${foo[@]}") when $# (or ${#foo}) is 0. * eval.c(expand,varsub): removed free_me field - let reclaim() take care of it. Wed Mar 9 00:50:12 1994 Simon J. Gerraty (sjg@zen.void.oz.au) * var.c (setstr): don't set ALLOC flag if vp.s is NULL. Thu Jun 30 10:16:44 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * c_sh.c(c_read): ignore null characters; use builtin_getopt() instead of explicit parsing; removed -e option (neither at&t ksh nor POSIX have this); added -s option (put line in history, at&t ksh); if no variable specified, use REPLY (at&t ksh). * exec.c(do_selectargs): use Xstring macros to deal with saving input (was static, growing, buffers); flush shl_out after shellf(). * vi.c(expand_word,complete_word): deleted call to free_edstate since already done by restore_edstate(). * var.c(global): in 'if !letter(c)' block, deleted !c from 'if (!c || !n[1])' - don't know why it was added since it makes no difference to what is returned. * syn.c(dogroup): removed onlydone argument since it is only used in the while/until statements, where "while command; done" is not allowed anyway; Changed all calls. * misc.c(options[]): allow -i to be specified on the command line. * exec.c(iosetup): if stderr (fd 2) is being re-directed, re-open shl_out to clear any errors. * main.c(quitenv): if restoring fd 2, clear any write errors * io.c(initio): initialize shl_out, shl_spare for writing (was SHF_GETFL). * main.c(main): ignore SIGQUIT if talking. Wed Jun 29 11:11:34 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * c_sh.c(c_exit): removed jobs/really quit stuff - exit should always exit. * main.c(shell): made reallyquit a local variable. * sh.h(reallyquit): deleted reallyquit * exec.c(comexec), main.c(main), misc.c(change_flag), jobs.c: ifdef'd use of FMONITOR. * sh.h, misc.c: define FMONITOR option only if JOBS defined. * c_sh.c(c_wait): POSIXized: option parsing (of no options); return 0 if not given any arguments; deal with multiple arguments. * jobs.c(j_lookup): changed second argument to return an integer error code, added defines for error codes, added error message array; changed all calls to use new conventions. * jobs.c(waitfor): returns -1 if job not found; added argument to specify if notification messages should be suppressed. * jobs.c(j_waitj): added flags argument instead of intr argument; added JW_STOPPEDWAIT flag to wait for stopped jobs to complete; added JW_NONOTIFY flag to suppress notification of normal job termination. Tue Jun 28 16:13:10 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * c_ksh.c(c_jobs): added -n and -p options, allow job ids to be specified for -l option. * jobs.c(j_jobs): added new arguments to deal with -n and -p options. * shf.h(SHF_BSIZE): reduced size to 512 to reduce memory requirements (I/O is used mostly for one line messages). * config.h.bot: removed necessity for tty process groups to define JOBS, added necessity of signal blocking/pausing. Mon Jun 27 21:49:52 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * jobs.c(exchild,j_print,j_waitj,j_jobs,check_job): exchild() - removed commented out shf_flush() calls; j_print() - print a space between status reports when lflag < 0, changed flag argument to use long/medium/short defines; Changed Job.notify field to use long/medium/short defines; j_waitj() - instead of calling j_print(), set j->notify to print the job; j_jobs() - clear j->notify so user won't be notified twice if a job finishes before a jobs command; check_job() - put job on front of list only if it is stopped. * main.c(main): pass flag to j_init() indicating if -m flag set/cleared on command line; don't initialize ttyfd. * sh.h: delete ttyfd. * jobs.c(j_init,ttyfd,check_job): made ttyfd static; re-worked j_init() to initialize ttyfd, initialize FMONITOR if not set by command line, initialize shl_j for asynchronous job notification; check_job() - use shl_j, look through saved fds to find real standard-error. * jobs.c(TTY_PGRP, ttypgrps_ok): modified conditions so job control is useful without tty process groups; added ttypgrps_ok flag that indicates if tty process groups should be set up; modifications so job control useful if ttypgrps_ok not set. * main.c(main): set FTALKING if 0 and 2 are tty as specified in POSIX (was 0 and 1). * misc.c(parse_args): do POSIX option processing for -A, -c and -o (allow -onoglob, -ctrue). * main.c(main): don't set up shl_stdout before/after parse_args() since lone -o on command line no longer accepted; remove code to allow -c with no options to read from stdin (at&t khs does this but POSIX requires an option to -c). Thu Jun 23 17:46:54 NDT 1994 John Rochester (jr@panda.cs.mun.ca) * trap.c(cleartraps): added special case for clearing trap 0 from ksh-4.9 sources. Thu Jun 23 10:17:03 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * misc.c(builtin_getopt): print error messages for unknown option, missing option; reset state if argv is 0. * c_ulimit.c(c_ulimit): let builtin_getopt() print error messages. * exec.c(call_builtin): call builtin_getopt() with 0 argv. * c_sh.c(c_unset): added -v option (POSIX); use builtin_getopt() to parse arguments; removed bogus comment about global() and special variables; don't allow read-only variables to be unset (POSIX). * var.c(unset, unsetspec): when unsetting a special variable, call unsetspec(); unsetspec() new function. * mail.c(mbset, mcheck): check that path is not 0 before calling stat (so mbset() can be called with 0 when MAIL is unset); deleted #if 0'd declarations of munset, mballoc and maddmsg. * misc.c(parse_args): pass argv+i+1 to set_array (not argv+i); when skipping arguments, leave i just before the NULL. * exec.c(echo): flush shl_out when done. * shf.c(shf_close): always used to return EOF. * trap.c(trapsig): skip error handlers when checking for PARSE or LOOP. Wed Jun 22 10:24:09 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * sh.h(C_IFSWS), misc.c(initctypes): added and initialized C_IFSWS (IFS white space). * c_sh.c(c_read): print continuation prompt if line ends in backslash; multiple non-white-space IFS chars delimit fields; strip trailing IFS-white-space from last variable; watch out for backslash followed by EOF. * eval.c(expand): only do field splitting on the results of parameter/command substition (POSIX, !v7-sh); multiple non-white-space IFS chars delimit fields. * eval.c(expand,alt_expand): removed NOALT tests since it could never be set; added return after call to alt_expand() in expand(). Mon Jun 6 10:12:41 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * misc.c(setctypes, initctypes): setctypes - don't allow leading null in IFS (IFS="" could cause problems, 0 is already added); initctypes - don't use a leading null. * sh.h, eval.c: move definition of ifs0 from eval.c to sh.h; handle null ifs0. * var.c(setspec): set ifs0 to first character of IFS. * lex.c(yylex): when parsing ${..}, array references were not being null terminated. Fri Jun 3 12:28:06 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * var.c(export): changed to use memcpy() instead of loops. * eval.c(varsub, expand): check for #foo[@] in addition to #foo[*]; handle ${foo[*]} and ${foo[@]} - added free_me field to struct Expand so pointer vector can get freed. * c_sh.c(c_dot), main.c(include): set up positional parameters if any are specified; Added argc,argv args to include(); changed all calls to include(); change include() to return 0 or 1 - caller can check exstat if desired; c_dot() should return 1 if can't open file (was -1). * c_sh.c(c_brkcont): warning message could call getn() with NULL - save original number and print it. * main.c(main): set $0 to first argument when -c used, ie, "sh -c cmd-string this-is-$0 argumernts..." * exec.c(iosetup): print "cannot open" if IOHERE fails. * io.c(errorf): set exstat to 1. * exec.c(search): assume mode is R_OK or X_OK (not 0/1 - 0 is F_OK, we want R_OK); changed all calls to pass R_OK/X_OK. sh.h: define R_OK,W_OK,X_OK,F_OK if not defined. eaccess(): changed all calls to use [RWXF]_OK. * sh.h(flag[], shell_flags[], Flag()): Renamed flag[] array to shell_flags[] to avoid conflicts with other uses of flag; Changed all references to flag[] to Flag(); defined Flag() to cast its arg to an int (for old pcc based C compilers). * vi.c(iswordch): use letnum() instead of isalnum || _. * misc.c(parse_args): call set_array() to deal with -A flag. * var.c(set_array): new function. Fri Jun 3 10:22:26 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * eval.c(substitute): afree(s). * var.c(global,local), sh.h: ARRAYMAX: new define - max index of an array; changed 511 constants to this; changed global() and local() to use array_ref_len() instead of arraysub(). * expr.c(token): deleted unneeded arraysub() decl. * lex.c(arraysub), proto.h: made static, removed unused arguments, changed callers; removed prototype from proto.h. * ChangeLog: changed descriptions from func(file) to file(func). Wed Jun 1 09:17:50 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * made pdksh-4.9+mun.2 distribution * Makefile.in: added RCSFILES macro and rcs-ci target. * configure.in: add termio.h to the AC_HAVE_HEADERS() call. * sh.h, main.c, edit.c, misc.c: use EXTERN for aperm, x_cols, builtin_optind and builtin_optarg in sh.h, delete definitions in main.c, edit.c and misc.c. * io.c(maketemp): changed sizeof(PATH) to sizeof(path). * aclocal.m4(KSH_VOID,KSH_DUP2_CHECK): test that a void * variable can be used (Ultrix 2.2 compiler doesn't do this); added ifdef HAVE_FCNTL_H to dup2 test. * aclocal.m4, configure.in, sh.h, tree.c, io.c, shf.c: added new config test KSH_PROTOTYPES to check for function prototypes (MIPS RICS/os 5.0 C compiler isn't STDC and it can't mix with ). Removed stdarg.h test (now redundant). Changed all varargs functions to use HAVE_PROTOTYPES instead of HAVE_STDARG_H && STDC. * eval.c(alt_scan): changed type of endc param from char to int to avoid problems with mixing prototype declarations and K&R definitions. * main.c(main), sh.h: added plain getcwd() decl to main(), removed ARGS() version from sh.h (some systems have getcwd() but don't declare it, some have getcwd() with a size_t arg 2, some have an int arg 2). * misc.c(memset,memmove): changed the second memset() to memmove(). * c_sh.c(clocktos): changed #if CLK_TCK ... to if (CLK_TCK.. since CLK_TCK is not always defined to a number (may be a _sysconf())). Tue May 31 10:49:16 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * configure.in, Makefile.in: added code to set GCC_WARNFLAGS from $(srcdir)/Warn-flags if gcc is being used; Took -Wall, etc. out of CFLAGS, took -Dno_RCSids out of DEFS. Added install.sh to DISTFILES, grabbed copy of install.sh from autoconf (who grabbed it from X11R5). * io.c(errorf,shellf,shprintf),shf.c(shf_fprintf,shf_snprintf), tree.c(fptreef,snptreef): don't use ansi decls with old style varargs; changed ifdef __STDC__ to ifdef HAVE_STDARG_H. * jobs.c(j_init): changed getpgrp() call to getpgID(), defined getpgID() appropriately for BSD vs POSIX/SYSV getpgrp. * expand.h, ksh_dir.h, ksh_stat.h, ksh_time.h, ksh_wait.h, shf.h, tty.h: added RCS Id's. * acconfig.h: updated SIGSET_T comment: unisgned int -> unsigned. * aclocal.m4(KSH_CLOCK_T,KSH_TIME_T,KSH_SIGSET_T): make sure type is a word (same fix as was done for more_t, et.al.). * aclocal.m4(KSH_VOLATILE): check that the compiler can deal with volatile pointers (dec/pmax ultrix 4.2 compiler can't). * misc.c(parse_args): added skelatal code for dealing with -A. * var.c,proto.h(skip_varname): new function; deleted isassign() function, which is no longer called. Changed typeset(var.c) to use skip_varname(). * var.c(strint): fail if base is not in the range 2..36; set variable base according to first base seen; generate an error if a non-alnum char is seen (1^A was the same as 11). * var.c(strval): for integer variables, output base if != 10. * sh.h: fixed typo in x_cols define (#defined -> #define). Fri May 27 16:49:29 NDT 1994 Micharl Rendell (michael@panda.cs.mun.ca) * made pdksh-4.9+mun.1 distribution * finished autoconf'ing source code. Fri May 20 16:47:06 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * c_ulimit.c(c_ulimit) (was do_ulimit.c(do_ulimit)): major rework; deal with combinations of getrusage and ulimit, use options at&t ksh uses (-SHa..). * misc.c(builtin_getopt): yet another getopt routine for builtin commands * misc.c(parse_args), c_sh.c(c_set), main.c(main): custom option parsing routine for command line/set options. Lots of changes to main() to incorporate this (easier to follow). * c_test.c(c_test): added -e (file exists) test. Fri May 5 12:16:46 NDT 1994 Michael Rendell (michael@panda.cs.mun.ca) * numerous changes from old Notes.4-9 file: - c_ksh.c: - calls to errorf identify what function the error is in (eg, errorf("print: bad -u option");) - added array stuff (lots of places) - table.c - lex.c - var.c: +arraysearch(), +basename() - c_sh.c(c_exit), main.c(shell), sh.h: - added reallyquit flag to deal with stopped jobs at exit time; only two exit commands (or eofs) in a row will work. in shell(), set exstat from execute value. - c_ksh.c(c_print): - handle \\ at end of string better (don't skip the null) - c_ksh.c(c_whence): - stop looking as soon as we get a failure - pass flag[FTRACKALL] to findcom() instead of 0 - c_ksh.c(c_alias): - print '%s alias not found' if not found - c_ksh.c(c_jobs): - handle -l option (list pid) - c_ksh.c(c_kill): - two column -l output to try to keep it on one screen - c_sh.c(c_read): - skip IFS at start of line "echo ' a b' |(read a b; echo $a)" should print a, not nothing. - changed EOF check to set all vars to null (same way \n is handled) - eval.c(comsub): - after compile(), return if t is NULL - use setfileno() instead of fileno(x) = .. (see sh.h changes); - exec.c(iosetup): - set exstat if redirect fails - exec.c(fd_clexec): - check that fd >= 0 - exec.c: - change SHARPBANG ifdef code - everyone uses scriptexec(). ifdef is put around open/read/parse code in scriptexec(). [code cleanup] - exec.c(search): - eaccess test out side of loop: must be regular file to exec it (like test in loop) - eval.c(expand): - added while getc() == 0 in XCOM [a null in the output of a file would be treated as eof and waitlast would not be called] - eval.c(trimsub): - '%' subst: use ATEMP, not APERM - eval.c(tilde): use Xinit et. al., instead of fixed length buffer - getopts.c(getopt): rename getopt() to ksh_getopt() to avoid problems with prototypes in system #include files. - io.c(fopenshf): - call clearerr(fd) if already open - use F_GETFL to determine appropriate mode for fdopen() call instead of opening everything for read/write - use ifdef _FSTDIO instead of ifdef _BSDI (_FSTDIO is used in 4.4bsd, NetBSD, FreeBSD and other non BSDI environs) - lex.c(ungetsc): don't decrement if str == null, remove nullstr hack - lex.c(yylex): - \ at eol: call Xfree before goto Again - use memset() to clear ident, instead of while loop - syn.c(get_command): renamed from command() to get_command() to avoid conflicts with command(main.c). - sym.c(get_command): - allow A=B to work (alias was not being expanded) - allow `if .. if .. fi fi' to work (no ; after group terminator (fi , esac, done, ), }) - allow `alias FI=fi ; if .. if .. fi FI' to work (alias expansion after group terminator) - do not assume resize returns same pointer - tree.c(pioact): - handle IORDWR case - added leading quote for file in IOHERE case - var.c(special): - add MAILCHECK check - var.c(setspec): - add MAILCHECK case (doesn't do anything yet) - var.c(strint): - handle null vp->val.s - eval.c(sh.h, expand), misc.c(options[]): - enable alternations only if alternations flag set (set -o alternations). This is so (att ksh) scripts that don't expect alternations won't break. - added notify option (asynchronous job completion notification) - added vicomplete to enable tab char as file name completion char in vi (this is likely to go away - exits for historical reasons) - jobs.c, main.c, sh.c, trap.c: - define/use SIG_HDLR instead of void - eval.c(expand): alt_expand() does not return a value so don't test it, just return. Also changed decl of alt_expand() to reflect reality. - emacs.c(x_emacs): first return returns random value (i); change to return 0. Also changed the way interrupts are returned to called (return -2 means interrupt). - c_sh.c(c_brkcont): at&t ksh allows breaks/continues outside of loops, 4.9 prints an error and breaks out of all env's (if, case, etc.). Fixed to act like at&t (ie, allow bogus continues), except a warning message is printed. (Some HP-UX shell scripts actually have continues outside of loops...) - main.c(shell): parameter s should be volatile as it is used after a setjmp. - edit.c(promptlen): handle tabs, backspaces... - cleaner fix to the ^C/source->line problem: in pprompt(lex.c), convert ! to source->line+1 (same in promptlen(edit.c)), increment source->line after a (non-empty, non-eof) line has been read (before call to histsave()). To be pedantic, also adjust position of source->line++ in SHIST in case PS9 is ever used. Remove code in shell(main.c) that does the source->line--, remove the source->line-- for eof and empty line in from getsc_(lex.c). - trap.c(sigtrap[]): do not depend on signal number matching position in initialization array. Use second table in which order does not matter to initialize sigtrap[] array. Easier to read/port, and generally less fragile. requires call to inittraps() in main.c. - trap.c(cleartraps): need to clear Sigact flags/mask after use (actually, declare a local struct sigact and use that instead of Sigact) - exec.c(execute): case TSELECT: no USE_SIGACT code for call to signal(); case TPIPE: don't call waitlast() if XXCOM since waitlast() will be called in expand(); 4.9 code that set and then cleared the XEXEC flag in the TPIPE case not added since it was ifdef'd out, also the code to not exit if XPIPEI flag set was not added; 4.9 XXWHL flag not added (don't flush stdin if in a while loop) since this problem fixed (I hope) by shf stuff. - ttyfd{sh.h/lex.c}: use EXTERN/_I_ to initialize ttyfd. Remove from lex.c - interrupted reads: instead of testing sigchld_caught after reads fail, continue them if errno == EINTR. - edit.c(x_getc): check for EINTR, and continue reading if so. - lex.c(getsc_): check for EINTR, and continue reading if so. (don't check return of x_read() - check has already been done) - exec.c(selread): check for EINTR, and continue reading if so. - history changes: - history.c: - histrpl(): bounds check doesn't take global flag into account - move check into loop and past loop. - c_fc(): if pattern is the empty string, histrpl() goes into infinate loop. Start searching for = after first char (this is what at&t ksh seems to do). - c_fc(): `fc -l first' should list at most 16 commands according to at&t manual. - findhist(): re-wrote: shorter, easier to follow. Now returns an int. (used only by vi code) - use COMPLEX_HISTORY's allocated history array in EASY_HISTORY: common init_histvec(), sethistfile() and sethistsize() functions. In the process, hist_open() went away. Use histsize instead of HISTORY in hist_init() and hist_finish() #ifdefs in lex.h, table.h, var.c disappear, history variable definitions in lex.c disappear. - hist_init(COMPLEX_HISTORY): move hstarted = 1 to after the FTALKING test. - hist_finish(): don't open hname if its null - histrpl(): made static, use ARGS in decl - made current and curpos static - changes to allow embedded newlines in commands: - histsave(): trash only trailing newline - hist_init(): read in null terminated lines instead of newline terminated - hist_finish(): write null terminated lines - make multiple line command appear in single history line (EASY_HISTORY only): - added histappend() to append new command to last command - added call to histappend() in getsc_(lex.c) (also: only adjust source->line if not multiline). - lex.h: - remove second decl of history if !EASY_HISTORY - tree.c(ptree): case TCOM: check if t->vars or t->args is 0 - vi.c(x_vi): ^D anywhere in command line is eof ($ foobar^D exits). at&t ksh ignores ^D in middle of line - edit.c: - don't need to include string.h - included in stdh.h - init_editmode(): in at&t ksh, VISUAL takes precenence over EDITOR, so put it first. Also, at&t ksh doesn't use FCEDIT so trash it. - moved initialization of ed_* from x_read() to x_init() since thats where they are set from tty structs. - x_init(): set ed_intrc, ed_quitc for _BSD & _POSIX_TERM ifdefs - send output to shlout (instead of stdout - at&t ksh writes to stderr) - made x_do_init static. - exit.c(x_getc), lex.c(yylex): restart interrupted reads in x_getc(), changed read-restart in yylex() to only effect call to read(). - syn.c(thenpart): then THEN is not optional - generate a syntax error if no THEN. (ie, `if true ; fi' is not legal). - syn.c(get_command): don't accept keywords after re-directory (eg, `> /dev/null if true ; then echo hi ; fi' is not legal). - vi.c: handle \ and ^[ in command mode ala at&t ksh (filename completion) - syn.c(thenpart), syn.c(elsepart): calling token(0) when they want a keyword (always worked 'cause tpeek() is always called before, with the keyword flag). Fix: call token(KEYWORD|ALIAS) (at&t ksh does alias expansion here). Question: pass CONTIN as well? - syn.c(get_command): LWORD/MPAREN case: do alias expansion when getting open brace ({). CASE case: ditto for `in' and `esac'. IF case: ditto for `fi'. FUNCTION case: dito for open brace ({). - syn.c(dogroup): alias expansion when getting `do' and `done'. - syn.c(wordlist): alias expansion when getting `in'. - syn.c(nested): alias expansion when getting `)', `}' - syn.c(casepart): alias expansion when getting `esac' or `;;'. Also removed use of cf variable - it does nothing. - eval.c(expand): case CSUBST: '#'/'%' - increment st so nested substitutions work. - var.c(typeset): INTEGER && no assignment: memory was being freed and then used (there was even a comment saying it was being done...) - lex.c, lex.h, exec.c, main.c: added shf_{open,fdopen,close,gets}() routines so stdio wasn't used. When reading a command file under osf/1, stdio would mess up the read pointer when a child exited: the exit flushed all open files and flushing a file open for reading changes the current read position (does a seek to where the next char would be read). This position is then used by the parent process, who thinks the read position is still at the end of the buffer it read. - c_sh.c: use shf_*() routines avoids two bugs in read: - on sunos 4.1.3, a read would gobble up a stdio buffer and never put it back (ie, lseek backwards). Neither a fflush() nor a fseek(x, 0L, 1) fixed the problem. (see Bug 26) - on linux, stdio knows its current offset and seeks there before reading a buffer. This causes grief when the shell replaces file descriptors behind stdio's back (ie, all the time). $ read x << EOF hi EOF $ cat > /dev/tty << EOF 1:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 2:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 3:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ EOF $ the cat picks up reading at the offset where the read command left off (ie, at bcdefg... - the 1:a are skipped). - exec.c(comexec): built-in c_exec && no args: close the saved fd's (were thrown away). Also, set close-on-exec flag for fd's > 2, as per at&t manual. - lex.c(yylex): only accept 1 digit before a redirection (eg, 1> is ok, 1abc> is not) - exec.c(iosetup): only accept 1 digit after a dup-redirection (eg, >&1 is ok, >&1abc is not) - exec.c(iosetup): use O_APPEND flag for >> redirections; use O_CREAT flag for <> redirections. (re-organized to accumulate open() flags and do one open() call); changed error message to know about dup failing. - c_sh.c(c_umask): umask should have leading 0 - doesn't when umask has 3 digits (eg, `umask 222; umask' prints 222 instead of 0222) - c_sh.c(setsig): declare local struct sigaction and use it so sa_flags doesn't have to be cleared (also to try to keep away from global vars). - main.c(main): - don't go set TALKING if name starts with -. - read $HOME/.profile (not .profile) - main.c(main): re-wrote option parsing code - edit.c(init_editmode): don't check FCEDIT - if set -o vi/emacs/gmacs on command line, don't set edit mode from FCEDIT/EDITOR/etc. - var.c(setspec): FCEDIT should not magicly change edit mode; VISUAL and EDITOR should (EDITOR only if VISUAL is not set) - changed noclobber char from ! to | (this is what at&t ksh uses) - exec.c(iosetup): use O_EXCL flag if FNOCLOBBER set and >| not used - c_sh.c(c_set): don't clear FERREXIT if FTALKING is set; although some ksh manuals say -e is ignored for interactive shells, they all seem to honour the -e flag for interactive shells. - vi.c: reset history position to the end after a line is modified - `(( 1 + 2 ))' no longer prints `+: bad expression'! - lex.c(yylex): added parenthesis counting so `(( ((1+2)) ))' no longer generates a syntax error - expr.c(intvar): if strint() fails, give bad number error (`let 1+foo' should fail) - `echo hi 1abc123> /dev/tty' no longer interpreted as `echo hi 1> /dev/tty' (is `echo hi 1abc123 > /dev/tty') - `echo hi 1<> /tmp/does-not-exist' now works (used to say cannot open) - c_sh.c(c_umask): umask now takes symbolic arguments (g-r, +w, etc.) - c_ksh.c(c_whence): pass flag[FTRACKALL] to findcom() instead of 1. - `echo hi >< bar' now produces an error - jobs.c(j_lookup): now checks for ambiguous job specifications; callers now get an error message. - c_ksh.c(c_fgbg): multiple jobs can be specified - emacs.c(x_transpose): move past transposed chars like (gnu) emacs does - main.c(main): don't copy initcoms (messes up memory allocated for shf_iob[] in initio(), should not be necessary) - main.c(main), var.c(import), var.c(typeset), c_ksh.c(c_alias), expr.c(token), misc.c(strnsave): added strnsave() function; use it instead of writing nulls in the middle of strings; main() no longer copies startup commands before executing them. - vi.c: wbuf[] no longer a fixed size (was hard coded to 80 chars). - alloc.c(aresize): if passed a null pointer, don't free it - expand.h: restored usage description and NOTE from previous version - alloc.c, table.h, table.c: - changed struct fields named `free' to nfree (struct table) and freelist (struct Block) to allow memory debugging (involves #defining free) - main.c(main): smart initialization of PWD (ensures it is always valid). - lex.h, table.h, tree.h: removed redundant function declarations (were also in proto.h) - sh.h: increased LINE from 256 to 1024 - main.c(include), sh.h(E_INC), c_sh.c(c_return): added hack so a return in a included file returns to the includer instead of exiting the shell. Very useful in $ENV scripts and profiles, eg, so the whole script does not have to be parsed for non-interactive shells. This is not compatible with the at&t ksh, whose man page says return is the same as exit outside of functions. May be modified in the future. (note that at&t ksh parses a .'ed file before executing anything, so a premature return would not speed its parsing, which is why the return hack was added to pdksh) - exec.c(iosetup): don't save fd if already saved (and don't generate an error) - exec.c(findcom): in if (..ALLOC && eaccess), test for ALLOC redundant - always call afree()