Adding sash version 3.4.

A Stand-Alone shell combining many common utilities.

PR:		16309
Submitted by:	Patrick Gardella <patrick@freebsd.org>
This commit is contained in:
Steve Price 2000-01-29 22:36:06 +00:00
parent e3a63b2d16
commit aea575ce76
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=25291
20 changed files with 569 additions and 0 deletions

View file

@ -10,6 +10,7 @@
SUBDIR += pdksh
SUBDIR += perlsh
SUBDIR += rc
SUBDIR += sash
SUBDIR += scsh
SUBDIR += tcsh
SUBDIR += zsh

35
shells/sash/Makefile Normal file
View file

@ -0,0 +1,35 @@
# New ports collection makefile for: sash
# Version required: 3.4
# Date created: Jan 22, 2000
# Whom: Patrick Gardella <patrick@freebsd.org>
#
# $FreeBSD$
#
DISTNAME= sash-3.4
CATEGORIES= shells
MASTER_SITES= http://www.pcug.org.au/~dbell/programs/ \
http://www.freebsd.org/~patrick/
MAINTAINER= patrick@freebsd.org
MAN1= sash.1
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/sash ${PREFIX}/bin/sash
${INSTALL_MAN} ${WRKSRC}/sash.1 ${PREFIX}/man/man1/sash.1
@${ECHO_MSG} "------------------"
@${ECHO_MSG} "Installing into ${PREFIX}/bin"
@${ECHO_MSG} "If you want this installed elsewhere, "
@${ECHO_MSG} "set the environmental variable PREFIX"
@${ECHO_MSG} "------------------"
post-install:
@${ECHO_MSG} "Updating /etc/shells"
@${CP} /etc/shells /etc/shells.bak
@(${GREP} -v ${PREFIX}/bin/sash /etc/shells.bak; \
${ECHO} ${PREFIX}/bin/sash) > /etc/shells
@${RM} /etc/shells.bak
strip ${PREFIX}/bin/sash
.include <bsd.port.mk>

1
shells/sash/distinfo Normal file
View file

@ -0,0 +1 @@
MD5 (sash-3.4.tar.gz) = 9c631eb171371b69276ff6692100beb6

View file

@ -0,0 +1,41 @@
--- Makefile.orig Sat Sep 25 01:21:56 1999
+++ Makefile Sat Jan 22 21:52:23 2000
@@ -5,13 +5,26 @@
# The HAVE_EXT2 definition adds the -chattr and -lsattr comamnds.
#
-CFLAGS = -O3 -Wall -Wmissing-prototypes -DHAVE_GZIP -DHAVE_EXT2
+CFLAGS += -O2 -Wall -Wmissing-prototypes $(OPTS)
LDFLAGS = -static -s
LIBS = -lz
-BINDIR = /bin
-MANDIR = /usr/man/man1
+## FreeBSD: add/remove components as needed. HAVE_EXT2 doesn't work
+## for us...
+OPTS+=-DHAVE_AR
+OPTS+=-DHAVE_DD
+OPTS+=-DHAVE_ED
+OPTS+=-DHAVE_FILE
+OPTS+=-DHAVE_FIND
+OPTS+=-DHAVE_GREP
+OPTS+=-DHAVE_GZIP
+OPTS+=-DHAVE_LS
+OPTS+=-DHAVE_TAR
+
+
+BINDIR = $(PREFIX)/bin
+MANDIR = $(PREFIX)/man/man1
OBJS = sash.o cmds.o cmd_dd.o cmd_ed.o cmd_grep.o cmd_ls.o cmd_tar.o \
@@ -20,6 +33,8 @@
sash: $(OBJS)
$(CC) $(LDFLAGS) -o sash $(OBJS) $(LIBS)
+
+all: sash
clean:
rm -f $(OBJS) sash

View file

@ -0,0 +1,33 @@
diff -NPru README.FreeBSD.orig README.FreeBSD
--- README.FreeBSD.orig Thu Jan 1 01:00:00 1970
+++ README.FreeBSD Sun Jan 23 00:03:20 2000
@@ -0,0 +1,29 @@
+This is a port of SASH to FreeBSD 4.0. Here are the differences to
+the original version:
+
+* The Makefile was rewritten to make use of standard BSD makefiles.
+ This helps integrating SASH into binaries built with crunchgen.
+
+* This port contains only a subset of 'mount -t type' commands. The
+ types that are supported are:
+
+ ufs,msdos,ext2fs,cd9660
+
+ (the naming follows standard mount(8) command in FreeBSD).
+
+ However, the only supported options for mounting are either read/write
+ (default, except for cd9660), read-only, or updating the mount
+ (NOTE: the original code uses '-m', but I changed it to '-u'
+ to be consistent with standard FreeBSD mount(8) ).
+
+ Also, the built-in mount command doesn't even attempt to autoload
+ requested vfs KLD, if it's not present in the kernel. In such
+ case, the mount operation will fail.
+
+* The code has been modularized (in similar way it was done for ELKS
+ version), so you can easier select which parts you want to include.
+ See the Makefile for the options.
+
+Andrzej Bialecki
+<abial@FreeBSD.org>
+Stockholm, 22.01.2000

View file

@ -0,0 +1,19 @@
diff -NPru cmd_ar.c.orig cmd_ar.c
--- cmd_ar.c.orig Sat Oct 2 12:09:04 1999
+++ cmd_ar.c Sat Jan 22 23:45:10 2000
@@ -13,6 +13,8 @@
* This allows extraction and listing of ar files.
*/
+#ifdef HAVE_AR
+
#include <ar.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -1007,5 +1009,6 @@
arch->name);
}
+#endif /* HAVE_AR */
/* END CODE */

View file

@ -0,0 +1,20 @@
diff -NPru cmd_dd.c.orig cmd_dd.c
--- cmd_dd.c.orig Sun Apr 11 09:31:39 1999
+++ cmd_dd.c Sat Jan 22 23:45:39 2000
@@ -6,6 +6,8 @@
* The "dd" built-in command.
*/
+#ifdef HAVE_DD
+
#include "sash.h"
@@ -346,5 +348,7 @@
return value;
}
+
+#endif /* HAVE_DD */
/* END CODE */

View file

@ -0,0 +1,20 @@
diff -NPru cmd_ed.c.orig cmd_ed.c
--- cmd_ed.c.orig Mon Apr 19 16:57:32 1999
+++ cmd_ed.c Sat Jan 22 23:46:01 2000
@@ -6,6 +6,8 @@
* The "ed" built-in command (much simplified)
*/
+#ifdef HAVE_ED
+
#include "sash.h"
#define USERSIZE 1024 /* max line length typed in by user */
@@ -1432,5 +1434,7 @@
return TRUE;
}
+
+#endif /* HAVE_ED */
/* END CODE */

View file

@ -0,0 +1,20 @@
diff -NPru cmd_file.c.orig cmd_file.c
--- cmd_file.c.orig Sun Apr 11 09:31:39 1999
+++ cmd_file.c Sat Jan 22 23:46:23 2000
@@ -6,6 +6,8 @@
* The "file" built-in command.
*/
+#ifdef HAVE_FILE
+
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
@@ -229,5 +231,7 @@
return info;
}
+
+#endif /* HAVE_FILE */
/* END CODE */

View file

@ -0,0 +1,20 @@
diff -NPru cmd_find.c.orig cmd_find.c
--- cmd_find.c.orig Tue Apr 20 00:48:45 1999
+++ cmd_find.c Sat Jan 22 23:47:12 2000
@@ -6,6 +6,8 @@
* The "find" built-in command.
*/
+#ifdef HAVE_FIND
+
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
@@ -370,5 +372,7 @@
*/
return TRUE;
}
+
+#endif /* HAVE_FIND */
/* END CODE */

View file

@ -0,0 +1,20 @@
diff -NPru cmd_grep.c.orig cmd_grep.c
--- cmd_grep.c.orig Sun Apr 11 09:31:39 1999
+++ cmd_grep.c Sat Jan 22 23:47:32 2000
@@ -6,6 +6,8 @@
* The "grep" built-in command.
*/
+#ifdef HAVE_GREP
+
#include <ctype.h>
#include "sash.h"
@@ -187,5 +189,7 @@
string++;
}
}
+
+#endif /* HAVE_GREP */
/* END CODE */

View file

@ -0,0 +1,11 @@
diff -NPru cmd_gzip.c.orig cmd_gzip.c
--- cmd_gzip.c.orig Tue Apr 20 13:46:17 1999
+++ cmd_gzip.c Sat Jan 22 23:47:44 2000
@@ -666,6 +666,6 @@
}
-#endif
+#endif /* HAVE_GZIP */
/* END CODE */

View file

@ -0,0 +1,20 @@
diff -NPru cmd_ls.c.orig cmd_ls.c
--- cmd_ls.c.orig Wed Jun 16 13:01:43 1999
+++ cmd_ls.c Sat Jan 22 23:48:06 2000
@@ -6,6 +6,8 @@
* The "ls" built-in command.
*/
+#ifdef HAVE_LS
+
#include "sash.h"
#include <sys/types.h>
@@ -574,5 +576,7 @@
free(list[listUsed]);
}
}
+
+#endif /* HAVE_LS */
/* END CODE */

View file

@ -0,0 +1,20 @@
diff -NPru cmd_tar.c.orig cmd_tar.c
--- cmd_tar.c.orig Sun Apr 18 14:33:59 1999
+++ cmd_tar.c Sat Jan 22 23:48:24 2000
@@ -7,6 +7,8 @@
* This allows creation, extraction, and listing of tar files.
*/
+#ifdef HAVE_TAR
+
#include "sash.h"
#include <sys/types.h>
@@ -1229,5 +1231,7 @@
return FALSE;
}
+
+#endif /* HAVE_TAR */
/* END CODE */

138
shells/sash/files/patch-al Normal file
View file

@ -0,0 +1,138 @@
diff -NPru cmds.c.orig cmds.c
--- cmds.c.orig Thu Jun 3 23:42:39 1999
+++ cmds.c Sun Jan 23 00:35:15 2000
@@ -6,17 +6,22 @@
* Most simple built-in commands are here.
*/
-#include "sash.h"
-
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#endif
#include <sys/mount.h>
#include <signal.h>
#include <pwd.h>
#include <grp.h>
#include <utime.h>
#include <errno.h>
+#ifdef linux
#include <linux/fs.h>
+#endif
+
+#include "sash.h"
void
@@ -501,19 +506,34 @@
}
}
+#ifdef __FreeBSD__
+#include <ufs/ufs/ufsmount.h>
+#include <isofs/cd9660/cd9660_mount.h>
+#include <msdosfs/msdosfsmount.h>
+#endif
void
do_mount(int argc, const char ** argv)
{
- const char * str;
- const char * type;
- int flags;
+ const char * str;
+ const char * type;
+#ifdef __FreeBSD__
+ u_long flags=0;
+ struct ufs_args ufs;
+ struct msdosfs_args msdos;
+ struct iso_args iso;
+ void *args;
+#else
+ int flags=MS_MGC_VAL;
+#endif
argc--;
argv++;
+#ifdef linux
type = "ext2";
- flags = MS_MGC_VAL;
-
+#else
+ type = "ufs";
+#endif
while ((argc > 0) && (**argv == '-'))
{
argc--;
@@ -533,6 +553,7 @@
argc--;
break;
+#ifdef linux
case 'r':
flags |= MS_RDONLY;
break;
@@ -540,6 +561,16 @@
case 'm':
flags |= MS_REMOUNT;
break;
+#endif
+#ifdef __FreeBSD__
+ case 'r':
+ flags |= MNT_RDONLY;
+ break;
+
+ case 'u':
+ flags |= MNT_UPDATE;
+ break;
+#endif
default:
fprintf(stderr, "Unknown option\n");
@@ -555,15 +586,44 @@
return;
}
+#ifdef linux
if (mount(argv[0], argv[1], type, flags, 0) < 0)
perror("mount failed");
+#endif
+#ifdef __FreeBSD__
+ /* Select type of struct args */
+ if(strcmp(type,"ufs")==0) {
+ ufs.fspec=argv[0];
+ args=&ufs;
+ } else if(strcmp(type,"msdos")==0) {
+ msdos.fspec=argv[0];
+ args=&msdos;
+ } else if(strcmp(type,"ext2fs")==0) {
+ ufs.fspec=argv[0];
+ args=&ufs;
+ } else if(strcmp(type,"cd9660")==0) {
+ iso.fspec=argv[0];
+ flags|=MNT_RDONLY;
+ args=&iso;
+ } else {
+ fprintf(stderr,"Unsupported FS type %s\n",type);
+ return;
+ }
+ if(mount(type,argv[1],flags,args)!=0) {
+ perror("mount failed");
+ }
+#endif
}
void
do_umount(int argc, const char ** argv)
{
+#ifdef __FreeBSD__
+ if (unmount(argv[1],0) < 0)
+#else
if (umount(argv[1]) < 0)
+#endif
perror(argv[1]);
}

115
shells/sash/files/patch-am Normal file
View file

@ -0,0 +1,115 @@
diff -NPru sash.c.orig sash.c
--- sash.c.orig Sat Sep 25 06:03:51 1999
+++ sash.c Sat Jan 22 23:50:57 2000
@@ -57,11 +57,13 @@
""
},
+#ifdef HAVE_AR
{
"-ar", do_ar, 3, INFINITE_ARGS,
"Extract or list files from an AR file",
"[txp]v arFileName fileName ..."
},
+#endif
{
"cd", do_cd, 1, 2,
@@ -107,11 +109,13 @@
"srcName ... destName"
},
+#ifdef HAVE_DD
{
"-dd", do_dd, 3, INFINITE_ARGS,
"Copy data between two files",
"if=name of=name [bs=n] [count=n] [skip=n] [seek=n]"
},
+#endif
{
"-echo", do_echo, 1, INFINITE_ARGS,
@@ -119,11 +123,13 @@
"[args] ..."
},
+#ifdef HAVE_ED
{
"-ed", do_ed, 1, 2,
"Edit a fileName using simple line mode commands",
"[fileName]"
},
+#endif
{
"exec", do_exec, 2, INFINITE_ARGS,
@@ -137,23 +143,29 @@
""
},
+#ifdef HAVE_FILE
{
"-file", do_file, 1, INFINITE_ARGS,
"Describe information about files",
"fileName ..."
},
+#endif
+#ifdef HAVE_FIND
{
"-find", do_find, 2, INFINITE_ARGS,
"Find files in a directory tree meeting some conditions",
"dirName [-xdev] [-type chars] [-name pattern] [-size minSize]"
},
+#endif
+#ifdef HAVE_GREP
{
"-grep", do_grep, 3, INFINITE_ARGS,
"Look for lines containing a word in some files",
"[-in] word fileName ..."
},
+#endif
#ifdef HAVE_GZIP
{
@@ -187,11 +199,13 @@
"[-s] srcName ... destName"
},
+#ifdef HAVE_LS
{
"-ls", do_ls, 1, INFINITE_ARGS,
"List information about files or directories",
"[-lidFC] fileName ..."
},
+#endif
#ifdef HAVE_EXT2
{
@@ -222,7 +236,11 @@
{
"-mount", do_mount, 3, INFINITE_ARGS,
"Mount or remount a filesystem on a directory",
+#ifdef __FreeBSD__
+ "[-t type] [-r] [-u] devName dirName"
+#else
"[-t type] [-r] [-m] devName dirName"
+#endif
},
{
@@ -291,11 +309,13 @@
""
},
+#ifdef HAVE_TAR
{
"-tar", do_tar, 2, INFINITE_ARGS,
"Create, extract, or list files from a TAR file",
"[cxtv]f tarFileName fileName ..."
},
+#endif
{
"-touch", do_touch, 2, INFINITE_ARGS,

View file

@ -0,0 +1,13 @@
diff -NPru sash.h.orig sash.h
--- sash.h.orig Sat Sep 25 06:03:51 1999
+++ sash.h Sat Jan 22 19:38:16 2000
@@ -16,7 +16,9 @@
#include <fcntl.h>
#include <string.h>
#include <memory.h>
+#ifndef __FreeBSD__
#include <malloc.h>
+#endif
#include <time.h>
#include <ctype.h>

1
shells/sash/pkg-comment Normal file
View file

@ -0,0 +1 @@
A Stand-Alone shell combining many common utilities

18
shells/sash/pkg-descr Normal file
View file

@ -0,0 +1,18 @@
SASH (Stand-Alone SHell)
It is a nice combination of bare-bones shell and a dozen
or so most useful unix commands.
Shell includes: echo pwd cd mkdir mknod rmdir sync rm chmod
chown chgrp touch mv ln cp cmp more exit
setenv printenv umask kill where
Commands include: dd ed grep gzip ls tar file find mount chattr
SASH is a port from Linux version (David Bell) by Andrzej Bialecki
<abial@FreeBSD.org>.
WWW: http://www.pcug.org.au/~dbell/
Patrick Gardella
<patrick@freebsd.org>

3
shells/sash/pkg-plist Normal file
View file

@ -0,0 +1,3 @@
bin/sash
@exec echo "updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells
@unexec echo "updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells