Skip to content

Commit

Permalink
Merge pull request #1141 from DoctorWkt/wish
Browse files Browse the repository at this point in the history
Add the wish shell.
  • Loading branch information
EtchedPixels authored Jan 22, 2025
2 parents 1bc2771 + 763a6ee commit e7a4d54
Show file tree
Hide file tree
Showing 37 changed files with 8,348 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Applications/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
APPS = util cmd sh games cave cpm v7games games cursesgames \
as09 ld09 netd MWC flashrom ue cpmfs plato \
emulators cpnet dw assembler CC cpp ar
emulators cpnet dw assembler CC cpp ar wish

.PHONY: $(APPS)

Expand Down Expand Up @@ -79,6 +79,9 @@ cpp:
ar:
+(cd ar; $(MAKE) -f Makefile.$(USERCPU))

wish:
+(cd wish; $(MAKE) -f Makefile.$(USERCPU))

clean:
(cd util; $(MAKE) -f Makefile.$(USERCPU) clean)
(cd V7/cmd; $(MAKE) -f Makefile.$(USERCPU) clean)
Expand All @@ -104,3 +107,4 @@ clean:
(cd cpp; $(MAKE) -f Makefile.$(USERCPU) clean)
(cd dw; $(MAKE) -f Makefile.$(USERCPU) clean)
(cd ar; $(MAKE) -f Makefile.$(USERCPU) clean)
(cd wish; $(MAKE) -f Makefile.$(USERCPU) wish)
95 changes: 95 additions & 0 deletions Applications/wish/Ifdefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#defines used in Wish 2.0
-------------------------

$Revision: 41.1 $ $Date: 1995/12/29 02:57:38 $

Here are the defines that are used in Wish 2.0. Code that uses specific
library calls and system calls are appropriately ifdef'd.

DEBUG /* debugging code used in development */
MALLOCDEBUG /* malloc debugging code used in development */
MINIX1_5 /* Minix 1.5 specific stuff */
NOTYET /* code that's not being used, & may never be */
POSIXJOB /* POSIX style job control */
PROTO /* Ansi-C function prototypes */
STDARG /* <stdarg.h> use */
UCBJOB /* 4.3BSD style job control */
USES_DIRECT /* struct direct instead of struct dirent */
USES_GETWD /* getwd() use instead of getcwd() */
USES_MORESIG /* sgtty moresig code */
USES_SGTTY /* bcopy() and sgttyb/TCIOGETP use */
USES_TCGETA /* termio/TCGETA use */
USES_TERMIOS /* termios/tcgetattr use */
V7JOB /* 7th Edition ptrace(1) job control */
VARARGS /* <varargs.h> use */

A small amount of code is specific to some systems. The following systems
are defined in the m_*.h files. Only the MINIX1_5 define is used in the
source code. If you are porting Wish to another system, define a name for
the system, but try not to use this when #ifdef'ing code. Use the #define's
above, or create a new define, e.g #define USES_INDEX if using index().


AUX2_01 /* A/UX 2.01 */
COHERENT /* Coherent */
FREEBSD_1 /* FreeBSD 1.x */
FREEBSD_2 /* FreeBSD 2.x */
GENBSD /* Generic BSD 4.x machine */
GENSYSV /* Generic SysV machine */
J386BSD0_1 /* 386BSD-0.1 */
MINIX1_5 /* Minix 1.5 */
MINIX1_7 /* Minix 1.7 */
OSX5_1_ATT /* Pyramid under OSx 5.1a, SysV Universe */
OSX5_1_BSD /* Pyramid OSx 5.1a, BSD Universe */
SOLARIS_2 /* Solaris 2.x */
SUNOS3 /* Sun OS 3.x */
SUNOS4 /* Sun OS 4.x */
ULTRIX4_2 /* Ultrix 4.2 */

Job Control
-----------

There are four styles of job control available: 7th Edition Unix
job control (using ptrace), Berkeley job control, POSIX job control and
no job control whatsoever. These are enabled by the following defines, only
one of which should be defined.

#define POSIXJOB /* POSIX job control */
#define V7JOB /* 7th Edition Unix job control */
#define UCBJOB /* Berkeley job control */

Argument Passing
----------------

The prints() [and friends] functions take a variable number of
arguments. Where possible, argument passing macros should be used. There
are three main types: no argument passing macros, varargs.h style argument
passing and stdarg.h stype argument passing macros. These are enabled by the
following defines, only one of which should be defined.

#define VARARGS /* varargs.h style argument passing */
#define STDARG /* stdarg.h stype argument passing */


Miscellaneous
-------------

There are a few other miscellaneous defines which control things
like types of functions used for directory searches, current working directory
information.

#define USES_GETWD /* Uses getwd(), not getcwd() */

#define PLONG int /* The type of arguments to ptrace(). Minix 1.5 */
/* uses longs! This is only used when V7JOB is on */

#define SIGTYPE void /* Signal handlers return this type. Usually void or */
/* int, but might also be __sighandler_t */

#define USES_DIRECT /* Uses struct direct, not struct dirent */

#define PROTO /* The compiler supports Ansi-C prototyped function */
/* declarations */

#define DEBUG /* Debugging code in Wish is #ifdef'd with this. You */
/* should not need (or want) to turn this on. */
54 changes: 54 additions & 0 deletions Applications/wish/Installation
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Installation of Wish 2.0
------------------------

$Revision: 41.4 $ $Date: 2003/04/21 13:13:32 $

1) Link the most appropriate file from the list of the m_*.h files to machine.h.
The current machine types are:

m_386bsd.h 386BSD-0.1
m_attpyr.h OSx 5.1a, SysV Universe
m_aux.h A/UX 2.01
m_bsdpyr.h OSx 5.1a, BSD Universe
m_coherent.h Coherent
m_freebsd1.h FreeBSD 1.x
m_freebsd2.h FreeBSD 2.x
m_freebsd4.h FreeBSD 4.x
m_genbsd.h Generic 4.x BSD machine
m_gensysv.h Generic SysV machine
m_minix1.5.h Minix 1.5
m_minix1.7.h Minix 1.7
m_solaris.h Solaris
m_sunos3.h Sun OS 3.x
m_sunos4.h Sun OS 4.x
m_ultrix.h Ultrix 4.2

Not all of these have been tested recently, only those described in the
`Systems' file. If you get any to work, especially with the changes
required, let me know.

If there is no m_*.h file for your system, pick one which is close, and
alter it to work:

POSIX: m_sunos4.h or m_386bsd.h
Old SYSV: m_gensysv.h
4.3BSD: m_genbsd.h

Put a unique system #define in the file, and try to #ifdef code with this
define only when absolutely necessary. The file `Ifdefs' has information
about what defines are available in Wish. Please send me a copy of the new
machine file when it works.

2) Copy the file Std.Makefile to Makefile. Make sure Makefile is writeable.
Edit the Makefile to define how to compile the shell. You should define:

CFLAGS The compiler flags used when compiling each .c file
LDFLAGS The link flags used when linking the program
CC The name of your compiler
DEFINES Special defines needed during the compilation stage
CLIB Any libraries needed during the link stage
FINAL_TOUCHES Any final touches needed after the linking

Suggestions for these defines are given in the Makefile.

3) Run `make' to make the shell.
27 changes: 27 additions & 0 deletions Applications/wish/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2016, Warren Toomey
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of Wish nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions Applications/wish/Makefile.68000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Makefile.common
23 changes: 23 additions & 0 deletions Applications/wish/Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include $(FUZIX_ROOT)/Target/rules.$(USERCPU)

SRC = alias.c bind.c builtin.c clebuf.c clex.c comlined.c exec.c file.c \
hist.c job.c main.c malloc.c meta.c parse.c prints.c signal.c \
term.c val.c var.c

.SUFFIXES: .c .o

OBJ = $(SRC:.c=.o)

all: wish

.c.o:
$(CC) $(CFLAGS) $(CCOPTS) -c $<

wish: $(OBJ)
$(LINKER) $(CRT0) $^ -o $@ $(LINKER_OPT) -ltermcap$(USERCPU) $(LINKER_TAIL)

clean:
rm -f *.o wish core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin size.report

rmbak:
rm -f *~ core
29 changes: 29 additions & 0 deletions Applications/wish/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Wish 2.0 - Warren's Interactive Shell
-------------------------------------

Welcome to Wish, a sort-of-tcsh-like shell based largely on the Clam shell
written by Callum Gibson. The aims of wish are:

+ to be as small as possible, so as to compile on small
systems like Minix
+ to have some of the interactive features of tcsh, such
as command-line editing, tab and ^D expansion, history,
aliases etc.
+ to be portable across as many systems as possible,
+ to be fast and have minimal impact on the system.

I worked on this shell from 1991 to 1996 and then gave up to finish off
my Ph.D. This release of Wish is an alpha-release, and I doubt I will ever
get back to finishing it off. It is known to run on FreeBSD 4.7, but I have
not tried it on any other system since 1996.

The manual is in nroff form in `Wish.1'. Instructions on how to compile wish
are in the `Installation'. If you are porting wish to another system, read
the file `Ifdefs', `Systems' and the `m_*.h' files.

Anybody who would like to take over development of the shell should email me,
as I can supply some good documentation about the development up to now, and
also a good description of the shell's internals.

Warren Toomey [email protected] 1996, then a bit in 2003.

Loading

0 comments on commit e7a4d54

Please sign in to comment.