Remove samsave as a separate installable. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 9a2a2de089d56d96ddd10155a25c38f148d2f947
(DIR) parent 8bd039bda9589be301e4621d597a0b8792d9bbba
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Sun, 4 Sep 2016 22:14:07 -0500
Remove samsave as a separate installable.
The functionality provided is simple enough that we can just include it
as a shell funtion that's written out on rescue.
Diffstat:
doc/Makefile | 2 --
sam/Makefile | 11 ++---------
sam/sam.c | 9 ++++++++-
sam/samsave | 14 --------------
4 files changed, 10 insertions(+), 26 deletions(-)
---
(DIR) diff --git a/doc/Makefile b/doc/Makefile
@@ -13,5 +13,3 @@ install: sam.1 B
ln -sf "$(MANDIR)/sam.1" "$(MANDIR)/samterm.1"
ln -sf "$(MANDIR)/sam.1" "$(MANDIR)/rsam.1"
ln -sf "$(MANDIR)/sam.1" "$(MANDIR)/sam.save.1"
- ln -sf "$(MANDIR)/sam.1" "$(MANDIR)/samsave.1"
-
(DIR) diff --git a/sam/Makefile b/sam/Makefile
@@ -10,12 +10,10 @@ INCS=-I../include
# RSAMNAME and TERMNAME contain the names of the files containing the
# sam and samterm executables, respectively. SAMDIR is the directory
-# where sam is to be installed. SAMSAVEDIR is the name of the directory
-# where the samsave file restoration script is stored.
+# where sam is to be installed.
RSAMNAME=sam
TERMNAME=samterm
SAMDIR=$(BINDIR)
-SAMSAVEDIR=$(BINDIR)
# Set SHELLNAME and SHELLPATH to the name of a shell and the pathname
# of its executable
@@ -30,9 +28,7 @@ RXPATHNAME=/usr/bin/ssh
# Set RXSAMNAME to the name of the command to run on the remote host.
RXSAMNAME=rsam
-SAMSAVE=/bin/sh\\n$(SAMSAVEDIR)/samsave
-
-CFLAGS=$(STANDARDS) $(INCS) $(INCLUDES) -DSAMSAVEDIR='"$(SAMSAVEDIR)"'
+CFLAGS=$(STANDARDS) $(INCS) $(INCLUDES)
LIB=../libframe/libframe.a ../libXg/libXg.a
CC?=c99
@@ -54,10 +50,7 @@ nuke: clean
install: sam
mkdir -p $(SAMDIR)
- mkdir -p $(SAMSAVEDIR)
cp sam $(SAMDIR)/$(RSAMNAME)
- cp samsave $(SAMSAVEDIR)/samsave
- chmod +x $(SAMSAVEDIR)/samsave
$(OBJ): sam.h ../include/u.h ../include/libc.h errors.h mesg.h
(DIR) diff --git a/sam/sam.c b/sam/sam.c
@@ -149,6 +149,13 @@ rescue(void)
io = create(buf, 1, 0700);
if(io<0)
return;
+ fprint(io, "samsave() {\n"
+ " echo \"${1}?\"\n"
+ " read yn < /dev/tty\n"
+ " case \"${yn}\" in\n"
+ " [Yy]*) cat > \"${1}\"\n"
+ " esac\n"
+ "}\n");
}
if(f->name.s[0]){
c = Strtoc(&f->name);
@@ -157,7 +164,7 @@ rescue(void)
free(c);
}else
sprint(buf, "nameless.%d", nblank++);
- fprint(io, "%s '%s' $* <<'---%s'\n", SAMSAVEDIR "/samsave", buf, buf);
+ fprint(io, "samsave %s <<'---%s'\n", buf, buf);
addr.r.p1 = 0, addr.r.p2 = f->nrunes;
writeio(f);
fprint(io, "\n---%s\n", (char *)buf);
(DIR) diff --git a/sam/samsave b/sam/samsave
@@ -1,14 +0,0 @@
-#!/bin/sh
-# Copyright (c) 1998 Lucent Technologies - All rights reserved.
-PATH=/bin:/usr/bin
-file=$1
-case "$2" in
--f) echo "$file"
- cat > $file
- ;;
-"") echo "$file?"
- read yn < /dev/tty
- case "$yn" in
- [Yy]*) cat > $file
- esac
-esac