sash 3.6 update.

author has integrated the ffs patches.
This commit is contained in:
wcobb 2002-07-21 08:44:35 +00:00
parent 578b029afc
commit 9727dcaebd
8 changed files with 34 additions and 247 deletions

View File

@ -1,11 +1,10 @@
# $OpenBSD: Makefile,v 1.5 2002/05/08 19:28:39 wcobb Exp $
# $OpenBSD: Makefile,v 1.6 2002/07/21 08:44:35 wcobb Exp $
COMMENT= "stand-alone shell with built-in commands"
VERSION= 3.5
VERSION= 3.6
DISTNAME= sash-${VERSION}
CATEGORIES= shells
NEED_VERSION= 1.509
HOMEPAGE= http://www.canb.auug.org.au/~dbell/
PERMIT_PACKAGE_CDROM= Yes
@ -20,6 +19,14 @@ MASTER_SITES= http://www.canb.auug.org.au/~dbell/programs/ \
ALL_TARGET= sash
CFLAGS+= -DHAVE_GZIP=1 \
-DHAVE_LINUX_ATTR=0 \
-DHAVE_LINUX_MOUNT=0 \
-DHAVE_BSD_MOUNT=1 \
-DMOUNT_TYPE='\"ffs\"'
MAKE_FLAGS= CFLAGS="${CFLAGS}"
do-install:
cd ${WRKSRC} && ${INSTALL_PROGRAM} sash ${PREFIX}/bin
cd ${WRKSRC} && ${INSTALL_MAN} sash.1 ${PREFIX}/man/man1

View File

@ -1,3 +1,3 @@
MD5 (sash-3.5.tar.gz) = 8de625cd380fd35064f1d59b2dff48c9
RMD160 (sash-3.5.tar.gz) = 135eb0e6d798801d8d26489ffa6fd61e3c64ecc7
SHA1 (sash-3.5.tar.gz) = 118b521ae5d83d5aa63ce6c8d4a444be5ce7ca25
MD5 (sash-3.6.tar.gz) = 56dd73d91374e1f0c59b9860b2855119
RMD160 (sash-3.6.tar.gz) = db793a09ab7cbd38682e5a12197a350df272da00
SHA1 (sash-3.6.tar.gz) = f46e2ea118fb0221015270d16b688493f81f083c

View File

@ -1,33 +0,0 @@
$OpenBSD: patch-Makefile,v 1.2 2002/03/13 13:26:59 lebel Exp $
--- Makefile.orig Fri Mar 8 07:29:53 2002
+++ Makefile Wed Mar 13 06:44:16 2002
@@ -7,14 +7,16 @@
# The MOUNT_TYPE definition sets the default file system type for -mount.
#
HAVE_GZIP = 1
-HAVE_LINUX_ATTR = 1
-HAVE_LINUX_MOUNT = 1
-MOUNT_TYPE = '"ext3"'
+HAVE_LINUX_ATTR = 0
+HAVE_LINUX_MOUNT = 0
+HAVE_BSD_MOUNT = 1
+MOUNT_TYPE = '"ffs"'
-CFLAGS = -O3 -Wall -Wmissing-prototypes \
+CFLAGS += \
-DHAVE_GZIP=$(HAVE_GZIP) \
-DHAVE_LINUX_ATTR=$(HAVE_LINUX_ATTR) \
-DHAVE_LINUX_MOUNT=$(HAVE_LINUX_MOUNT) \
+ -DHAVE_BSD_MOUNT=$(HAVE_BSD_MOUNT) \
-DMOUNT_TYPE=$(MOUNT_TYPE)
LDFLAGS = -static -s
@@ -30,7 +32,7 @@ OBJS = sash.o cmds.o cmd_dd.o cmd_ed.o c
sash: $(OBJS)
- $(CC) $(LDFLAGS) -o sash $(OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o sash $(OBJS) $(LIBS)
clean:
rm -f $(OBJS) sash

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-cmd_ls_c,v 1.1 2002/07/21 08:44:35 wcobb Exp $
--- cmd_ls.c.orig Sun Jul 21 05:33:34 2002
+++ cmd_ls.c Sun Jul 21 05:34:27 2002
@@ -380,7 +380,7 @@ listFile(
*/
if (flags & LSF_INODE)
{
- sprintf(cp, "%7ld ", statBuf->st_ino);
+ sprintf(cp, "%7d ", statBuf->st_ino);
cp += strlen(cp);
}
@@ -434,7 +434,7 @@ listFile(
((unsigned long) statBuf->st_rdev) & 0xff);
}
else
- sprintf(cp, "%8ld ", statBuf->st_size);
+ sprintf(cp, "%8lld ", statBuf->st_size);
cp += strlen(cp);

View File

@ -1,128 +0,0 @@
$OpenBSD: patch-cmds_c,v 1.2 2002/03/13 13:26:59 lebel Exp $
--- cmds.c.orig Fri Mar 8 03:27:36 2002
+++ cmds.c Wed Mar 13 06:53:25 2002
@@ -10,7 +10,9 @@
#include <sys/types.h>
#include <sys/stat.h>
+#if HAVE_BSD_MOUNT
#include <sys/mount.h>
+#endif
#include <signal.h>
#include <pwd.h>
#include <grp.h>
@@ -21,7 +23,6 @@
#include <linux/fs.h>
#endif
-
void
do_echo(int argc, const char ** argv)
{
@@ -550,8 +551,19 @@ do_mount(int argc, const char ** argv)
case 'm':
flags |= MS_REMOUNT;
break;
-#endif
+#elif HAVE_BSD_MOUNT
+ case 'r':
+ flags |= MNT_RDONLY;
+ break;
+
+ case 's':
+ flags |= MNT_NOSUID;
+ break;
+ case 'e':
+ flags |= MNT_NOEXEC;
+ break;
+#endif
default:
fprintf(stderr, "Unknown option\n");
@@ -566,16 +578,83 @@ do_mount(int argc, const char ** argv)
return;
}
- if (mount(argv[0], argv[1], type, flags, 0) < 0)
- perror("mount failed");
+#if HAVE_LINUX_MOUNT
+
+ if (mount(argv[0], argv[1], type, flags, 0) < 0)
+ perror("mount failed");
+
+#elif HAVE_BSD_MOUNT
+ {
+ struct ufs_args ufs;
+ struct adosfs_args adosfs;
+ struct iso_args iso;
+ struct mfs_args mfs;
+ struct msdosfs_args msdosfs;
+ void * args;
+
+ if(!strcmp(type, "ffs") || !strcmp(type, "ufs")) {
+ ufs.fspec = (char*) argv[0];
+ args = &ufs;
+ } else if(!strcmp(type, "adosfs")) {
+ adosfs.fspec = (char*) argv[0];
+ adosfs.uid = 0;
+ adosfs.gid = 0;
+ args = &adosfs;
+ } else if(!strcmp(type, "cd9660")) {
+ iso.fspec = (char*) argv[0];
+ args = &iso;
+ } else if(!strcmp(type, "mfs")) {
+ mfs.fspec = (char*) argv[0];
+ args = &mfs;
+ } else if(!strcmp(type, "msdos")) {
+ msdosfs.fspec = (char*) argv[0];
+ msdosfs.uid = 0;
+ msdosfs.gid = 0;
+ args = &msdosfs;
+ } else {
+ fprintf(stderr, "Unknown filesystem type: %s", type);
+ fprintf(stderr,
+ "Supported: ffs ufs adosfs cd9660 mfs msdos\n");
+ return;
+ }
+
+ if (mount(type, argv[1], flags, args) < 0)
+ perror(argv[0]);
+ }
+#endif
}
void
do_umount(int argc, const char ** argv)
{
+#if HAVE_LINUX_MOUNT
if (umount(argv[1]) < 0)
perror(argv[1]);
+#elif HAVE_BSD_MOUNT
+ {
+ const char * str;
+ int flags = 0;
+
+ for (argc--, argv++;
+ (argc > 0) && (**argv == '-');) {
+ argc--;
+ str = *argv++;
+
+ while (*++str) {
+ switch (*str)
+ {
+ case 'f':
+ flags = MNT_FORCE;
+ break;
+ }
+ }
+ }
+
+ if (unmount(argv[0], flags) < 0)
+ perror(argv[0]);
+ }
+#endif
}

View File

@ -1,29 +0,0 @@
$OpenBSD: patch-sash_1,v 1.2 2002/03/13 13:26:59 lebel Exp $
--- sash.1.orig Wed Mar 13 06:29:36 2002
+++ sash.1 Wed Mar 13 06:36:54 2002
@@ -369,10 +369,14 @@ LINES and COLS can be used to set the pa
.TP
.B -mount [-t type] [-r] [-m] devName dirName
Mount a filesystem on a directory name. The -t option specifies the
-type of filesystem being mounted, and defaults to "ext3" for Linux.
+type of filesystem being mounted, and defaults to "ext3" for Linux
+and "ffs" for BSD.
The -r option indicates to mount the filesystem read-only.
The -m option indicates to remount an already mounted filesystem.
-The -r and -m options are only available on Linux.
+The -s option indicates to mount the filesystem nosuid.
+The -e option indicates to mount the filesystem noexec.
+The -r and -m options are only available on Linux. The -s and -e
+options are only availble on BSD.
.TP
.B -mv srcName ... destName
Moves one or more files from the
@@ -455,6 +459,8 @@ current umask value is printed. The mas
Unmounts a file system. The file name can either be the device name
which is mounted, or else the directory name which the file system
is mounted onto.
+The -f option unmounts the filesystem even if it is being used.
+The -f option is only available on BSD.
.TP
.B unalias name
Remove the definition for the specified alias.

View File

@ -1,28 +0,0 @@
$OpenBSD: patch-sash_c,v 1.2 2002/03/13 13:26:59 lebel Exp $
--- sash.c.orig Fri Mar 8 07:28:21 2002
+++ sash.c Wed Mar 13 07:11:35 2002
@@ -224,6 +224,8 @@ static const CommandEntry commandEntryTa
"Mount or remount a filesystem on a directory",
#if HAVE_LINUX_MOUNT
"[-t type] [-r] [-m] devName dirName"
+#elif HAVE_BSD_MOUNT
+ "[-t type] [-r] [-s] [-e] devName dirName"
#else
"[-t type] devName dirName"
#endif
@@ -314,9 +316,15 @@ static const CommandEntry commandEntryTa
},
{
+#if HAVE_BSD_MOUNT
+ "-umount", do_umount, 2, 3,
+ "Unmount a filesystem",
+ "[-f] fileName"
+#else
"-umount", do_umount, 2, 2,
"Unmount a filesystem",
"fileName"
+#endif
},
{

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-sash_h,v 1.2 2002/03/13 13:26:59 lebel Exp $
--- sash.h.orig Fri Mar 8 03:21:18 2002
+++ sash.h Wed Mar 13 06:53:22 2002
@@ -9,14 +9,18 @@
#ifndef SASH_H
#define SASH_H
-
+#if __OpenBSD__
+#include <sys/param.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <memory.h>
+#if __Linux__
#include <malloc.h>
+#endif
#include <time.h>
#include <ctype.h>