Commit Graph

444 Commits

Author SHA1 Message Date
dsl 51d94f2156 Fix bin/20185 - builtin called from function of same name mustn't be hashed.
Make 'hash' only report utilities that are not builtins (posix), the
non-posix 'hash -v' will report everything.
(agreed by christos)
2003-02-04 08:51:30 +00:00
dsl 0871280204 Parse end of line comments correctly
(approved by christos)
2003-02-02 21:10:45 +00:00
christos 66b9125762 - use FD_CLOEXEC properly
- move ttyfd to a high fd
suggested by Tim Robbins at FreeBSD.
2003-01-27 12:54:08 +00:00
wiz 6ce643e53c Fix indentation of continuation of first line in SYNOPSIS. 2003-01-23 18:32:07 +00:00
agc 53ed48f326 Make this build on platforms where size_t != int, i.e. sparc, arm, ppc, ... 2003-01-23 14:58:07 +00:00
rafal 0923f4be26 Make this build again. 2003-01-23 03:33:16 +00:00
wiz e254f6a849 More markup, more commas, less typos. 2003-01-22 22:05:45 +00:00
dsl e314f958bd Support command -p, -v and -V as posix
Stop temporary PATH assigments messing up hash table
Fix sh -c -e "echo $0 $*" -a x (as posix)
(agreed by christos)
2003-01-22 20:36:03 +00:00
kleink b3df6303a9 Rename `sigset' locals to avoid symbol shadowing warning. 2003-01-16 09:38:37 +00:00
christos 51457e8842 Make sure that UPEOF is compared to the right type on the left hand
side. Sometimes it was compared to int, which was -1 on EOF, and on
unsigned char machines UPEOF was (unsigned char)-1. This worked
by chance because isalpha((unsigned char)-1) returns false usually,
but it does not when the locale is invalid!
2003-01-12 20:26:53 +00:00
christos a17201f05e allow this to be compiled with unsigned-chars. 2003-01-09 13:57:26 +00:00
wiz 617b132aac Spell output with two ts. 2003-01-04 23:43:02 +00:00
uebayasi 80a4544dcd trap '' SIGINT -> trap '' INT. 2002-12-28 05:08:27 +00:00
kleink 9273e5b038 Another it's -> its. 2002-12-19 18:04:41 +00:00
uebayasi 60ad876a43 `` [n1]>&n2 Duplicate standard output (or n1) _TO_ n2.'' 2002-12-12 11:50:40 +00:00
christos aa0e549885 PR/19453: Christopher Richards: Call setlocale() in /bin/sh 2002-12-11 19:12:18 +00:00
agc 1aafd1a470 Include <stdio.h> to get the prototype for sprintf(3) - macppc needs this. 2002-11-25 21:55:58 +00:00
agc ea1d615943 Make this compile on some of the more esoteric architectures (e.g. those
which are not i386)
2002-11-25 12:13:03 +00:00
christos c02b3bbdf4 Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
  (so I could unset -e PS1 before running the test shell...)
2002-11-24 22:35:38 +00:00
wrstuden 5b0a9938fd Use signed char to replace int8_t, not just char. Should fix macppc
cross-build problems introduced in rev 1.59.

Pointed out by Valeriy E. Ushakov uwe at ptc dot spbu dot ru on
tech-toolchain.
2002-10-31 17:14:46 +00:00
christos dde7426849 From David Laight
> The wrong process is aborting when variable assignment fails
> in the vfork path.  So the following command fails to execute
> the second echo (shown here with the correct output).
>
> $ (readonly r; r= /bin/echo a; echo b)
> r: is read only
> b
>
> fix: defer the mklocal() to the child shell.
2002-10-23 19:46:34 +00:00
christos f3dfd6e686 From David Laight:
> Also 'jobs' fails in a non-interactive shell.
> In showjobs(), the code that puts the process back into its
> own process group should only be run if the shell is actually
> doing job control - eg if 'mflag' is set.
2002-10-23 19:46:06 +00:00
christos 6166cc6e93 Fix interrupt problam from David Laight
$ /fred # non existant command
$ ^C # stops working

He says:
    Ok the extra INTOFF is the one in exverror().
    In almost all cases this doesn't matter because the longjmp()s
    all end up in main() and the FORCEINTON call sorts it out
    for the next command.
    (There are a significant number of INTON/OFF mismatches through
    the error paths...)

    In any case the above failure can be 'fixed' by changing 2 (I think
    they are both needed) INTON calls to FORCEINTON within evalcommand.
    The following patch seems to work:

We should really look in the code and fix the INTON->INTOFF pairs.
2002-10-23 13:25:24 +00:00
lukem e490a5c798 don't compile in `-h' as a synonym for the command that the argument is for.
this fix is hokey, but works as well as the previous solution for -j.
2002-10-15 04:15:58 +00:00
christos 1ce87c4b29 - it is wrong to put inton/intoff arount ckmalloc(), because the code
around it is the one that does this.
- whitespace fixes.
2002-10-07 14:26:49 +00:00
christos 202746f803 explain what's breaking with alignments > 16, but no fix yet. 2002-10-07 14:26:08 +00:00
christos b9d3050e20 Rename ALIGN to SHELL_ALIGN and simplify macro so that it does not have side
effects, and add double to it, so that it aligns doubles correctly too. This
is just a workaround to fix the sparc64 problem where ALIGN() is now defined
in some include file to be 16 instead of 8. Thanks to martin for debugging this.
2002-10-04 13:15:51 +00:00
wiz 1da66f1f4c filesystem -> file system, automaticly -> automatically. 2002-10-02 10:01:46 +00:00
wiz 2e6e2165c0 Use more mdoc, particularly to get rid of some \*[Lt] and \*[Gt]. 2002-10-01 15:06:31 +00:00
mycroft 6092f7d52b Revert the previous for now. This is truly gross. 2002-09-28 03:15:43 +00:00
mycroft 7973b7a0ac Remove the duplicate setpgid() in forkparent(). The real bug was freeing the
job structure in the child and referencing freed memory.
2002-09-28 03:08:00 +00:00
christos 4783843fdc Revert previous change. No need to save rootshell. It is only affecting
the non-vfork case. Having said that, it would be nice if pipelines of
simple commands were vforked too. Right now they are not.
Explain that setpgid() might fail because we are doing it both in the
parent and the child case, because we don't know which one will come
first.
Suspending a pipeline prints %1 Suspended n times where n is the number
of processes, but that was there before. It is easy to fix, but I'll
leave the code alone for now.
2002-09-28 01:25:01 +00:00
christos 6f48233483 Deal with rootshell not being maintained correctly in the vfork() case.
Propagate isroot, throughout the eval process and maintain it properly.
Fixes sleep 10 | cat^C not exiting because sleep and cat ended up in
their own process groups, because wasroot was always true in the children.
2002-09-27 22:56:24 +00:00
mycroft d84d36165d Clean up INTOFF/INTON usage a little -- none of fork{shell,parent,child}()
screw with them now, only their callers.
2002-09-27 21:32:24 +00:00
christos ad1e7bca30 off by one in nprocs. 2002-09-27 21:04:08 +00:00
christos 35975338b0 Put back charles' fixes from -r1.60 2002-09-27 20:24:36 +00:00
christos edcb454443 VFork()ing shell: From elric@netbsd.org:
Plus my changes:
	- walking process group fix in foregrounding a job.
	- reset of process group in parent shell if interrupted before the wait.
	- move INTON lower in the dowait so that the job structure is
	  consistent.
	- error check all setpgid(), tcsetpgrp() calls.
	- eliminate unneeded strpgid() call.
	- check that we don't belong in the process group before we try to
	  set it.
2002-09-27 18:56:50 +00:00
mycroft 2aa6ebd4ed In evalpipe(), move the INTOFF after the waitforjob(), to prevent possible
race conditions -- now we always synchronously wait for the job to finish.
In evalcommand(), add the same INTOFF/INTON locking as evalpipe(), to prevent
leaving internal state inconsistent, and also to insure that we synchronously
wait for the job.
2002-09-27 17:37:12 +00:00
christos 6438e7dcdc no SYSV for eagain, enable EMFILE 2002-09-27 16:56:15 +00:00
wiz 14dfaa4b03 New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.
2002-09-25 15:18:36 +00:00
thorpej e41b1aa4a2 Use "unsigned char" and "char" instead of "u_int8_t" and "int8_t"
for TARGET_CHAR when building mksyntax.  This isn't perfect, but
it lets the host tool work on non-BSD systems without completely
redoing how sh is built.
2002-09-15 00:19:22 +00:00
lukem 146a774973 Use ${NETBSDSRCDIR}/some/path instead of ${.CURDIR}/../../some/path (etc). 2002-08-19 09:56:00 +00:00
christos 82886e162e deal with char c; c != -129 warning. Hi jason! 2002-05-31 16:18:48 +00:00
wiz 10610e5a31 __STDC__ is always defined on NetBSD. 2002-05-25 23:12:16 +00:00
wiz 0b398b282c __STDC__ is always defined on NetBSD, so remove #ifdef __STDC__ (and
unnecessary #else cases).
2002-05-25 23:09:06 +00:00
bjh21 84c006d0f8 The printf builtin has been "temporarily" disabled for eight years. Remove
its directory from .PATH to avoid confusion.
2002-05-15 20:45:17 +00:00
bjh21 6f786375c4 Implement sh -a (allexport). Code (all two lines of it) from FreeBSD
(FreeBSD var.c 1.13, sh.1 1.27).
2002-05-15 19:43:29 +00:00
christos f629aa28d9 implement noclobber. From Ben Harris, with minor tweaks from me. Two
unimplemented comments to go. Go Ben!
2002-05-15 16:33:35 +00:00
christos eac955176d Implement unset variable error messages from Ben Harris. 2002-05-15 14:59:21 +00:00
christos de525ac6ca Try harder to find a tty. 2002-04-10 15:52:07 +00:00