diff options
| author | Shokara Kou <kou@13f0.net> | 2022-05-13 11:35:31 -0400 |
|---|---|---|
| committer | Shokara Kou <kou@13f0.net> | 2022-12-10 16:12:53 -0500 |
| commit | 7f8d9adc5b1bc307309c22c6fdcde9b509b81062 (patch) | |
| tree | 6d483b086c0ff91111bd0e8ef5326f035ec8bbac | |
| parent | 720e44ce19bf3adb43d32727a53210efc21c5555 (diff) | |
add standalone mk and rc ports from plan9
| -rw-r--r-- | mk/.footprint | 30 | ||||
| -rw-r--r-- | mk/.md5sum | 2 | ||||
| -rw-r--r-- | mk/Pkgfile | 20 | ||||
| -rw-r--r-- | mk/makefile_destdir.patch | 122 | ||||
| -rw-r--r-- | rc/.footprint | 9 | ||||
| -rw-r--r-- | rc/.md5sum | 2 | ||||
| -rw-r--r-- | rc/Pkgfile | 23 | ||||
| -rw-r--r-- | rc/frobnitzem-globals.patch | 265 | ||||
| -rw-r--r-- | rc/makefile.patch | 16 |
9 files changed, 489 insertions, 0 deletions
diff --git a/mk/.footprint b/mk/.footprint new file mode 100644 index 0000000..1a86661 --- /dev/null +++ b/mk/.footprint | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | drwxr-xr-x root/root usr/ | ||
| 2 | drwxr-xr-x root/root usr/bin/ | ||
| 3 | -rwxr-xr-x root/root usr/bin/mk | ||
| 4 | drwxr-xr-x root/root usr/doc/ | ||
| 5 | -rw-r--r-- root/root usr/doc/mk.pdf | ||
| 6 | drwxr-xr-x root/root usr/include/ | ||
| 7 | -rw-r--r-- root/root usr/include/bio.h | ||
| 8 | -rw-r--r-- root/root usr/include/fmt.h | ||
| 9 | -rw-r--r-- root/root usr/include/regexp9.h | ||
| 10 | -rw-r--r-- root/root usr/include/utf.h | ||
| 11 | drwxr-xr-x root/root usr/lib/ | ||
| 12 | -rw-r--r-- root/root usr/lib/libbio.a | ||
| 13 | -rw-r--r-- root/root usr/lib/libfmt.a | ||
| 14 | -rw-r--r-- root/root usr/lib/libregexp9.a | ||
| 15 | -rw-r--r-- root/root usr/lib/libutf.a | ||
| 16 | drwxr-xr-x root/root usr/share/ | ||
| 17 | drwxr-xr-x root/root usr/share/man/ | ||
| 18 | drwxr-xr-x root/root usr/share/man/man1/ | ||
| 19 | -rw-r--r-- root/root usr/share/man/man1/mk.1.gz | ||
| 20 | drwxr-xr-x root/root usr/share/man/man3/ | ||
| 21 | -rw-r--r-- root/root usr/share/man/man3/bio.3.gz | ||
| 22 | -rw-r--r-- root/root usr/share/man/man3/fmtinstall.3.gz | ||
| 23 | -rw-r--r-- root/root usr/share/man/man3/isalpharune.3.gz | ||
| 24 | -rw-r--r-- root/root usr/share/man/man3/print.3.gz | ||
| 25 | -rw-r--r-- root/root usr/share/man/man3/regexp9.3.gz | ||
| 26 | -rw-r--r-- root/root usr/share/man/man3/rune.3.gz | ||
| 27 | -rw-r--r-- root/root usr/share/man/man3/runestrcat.3.gz | ||
| 28 | drwxr-xr-x root/root usr/share/man/man7/ | ||
| 29 | -rw-r--r-- root/root usr/share/man/man7/regexp9.7.gz | ||
| 30 | -rw-r--r-- root/root usr/share/man/man7/utf.7.gz | ||
diff --git a/mk/.md5sum b/mk/.md5sum new file mode 100644 index 0000000..95ad668 --- /dev/null +++ b/mk/.md5sum | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | 4cf585b5076cb487454baee0495e5352 makefile_destdir.patch | ||
| 2 | f3cd7b91cdece5efe55d41754438e658 mk-with-libs.tgz | ||
diff --git a/mk/Pkgfile b/mk/Pkgfile new file mode 100644 index 0000000..4d755de --- /dev/null +++ b/mk/Pkgfile | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | # Description: Mk is a simple replacment for make | ||
| 2 | # URL: https://9fans.github.io/plan9port/unix | ||
| 3 | # Maintainer: Shokara Kou, kou at 13f0 dot net | ||
| 4 | # Depends on: | ||
| 5 | |||
| 6 | name=mk | ||
| 7 | version=1 | ||
| 8 | release=1 | ||
| 9 | source=(https://9fans.github.io/plan9port/unix/$name-with-libs.tgz | ||
| 10 | makefile_destdir.patch) | ||
| 11 | |||
| 12 | build() { | ||
| 13 | cd $name | ||
| 14 | |||
| 15 | patch -Np1 <$SRC/makefile_destdir.patch | ||
| 16 | make PREFIX=/usr DESTDIR=$PKG install | ||
| 17 | |||
| 18 | mv -f $PKG/usr/man/* $PKG/usr/share/man/ | ||
| 19 | rmdir $PKG/usr/man | ||
| 20 | } | ||
diff --git a/mk/makefile_destdir.patch b/mk/makefile_destdir.patch new file mode 100644 index 0000000..5f36b9e --- /dev/null +++ b/mk/makefile_destdir.patch | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | diff -ur a/libbio/Makefile b/libbio/Makefile | ||
| 2 | --- a/libbio/Makefile 2022-05-09 13:46:34.071447416 -0400 | ||
| 3 | +++ b/libbio/Makefile 2022-05-09 13:47:41.857445218 -0400 | ||
| 4 | @@ -50,12 +50,12 @@ | ||
| 5 | all: $(LIB) | ||
| 6 | |||
| 7 | install: $(LIB) | ||
| 8 | - mkdir -p $(PREFIX)/share/man/man3 | ||
| 9 | - install -m 0644 bio.3 $(PREFIX)/share/man/man3/bio.3 | ||
| 10 | - mkdir -p $(PREFIX)/include | ||
| 11 | - install -m 0644 bio.h $(PREFIX)/include | ||
| 12 | - mkdir -p $(PREFIX)/lib | ||
| 13 | - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) | ||
| 14 | + mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3 | ||
| 15 | + install -m 0644 bio.3 $(DESTDIR)$(PREFIX)/share/man/man3/bio.3 | ||
| 16 | + mkdir -p $(DESTDIR)$(PREFIX)/include | ||
| 17 | + install -m 0644 bio.h $(DESTDIR)$(PREFIX)/include | ||
| 18 | + mkdir -p $(DESTDIR)$(PREFIX)/lib | ||
| 19 | + install -m 0644 $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB) | ||
| 20 | |||
| 21 | bcat: bcat.$O $(LIB) | ||
| 22 | $(CC) -o bcat bcat.$O $(LIB) -L/usr/local/lib -lfmt -lutf | ||
| 23 | diff -ur a/libfmt/Makefile b/libfmt/Makefile | ||
| 24 | --- a/libfmt/Makefile 2022-05-09 13:46:34.072447416 -0400 | ||
| 25 | +++ b/libfmt/Makefile 2022-05-09 13:48:10.943444275 -0400 | ||
| 26 | @@ -74,13 +74,13 @@ | ||
| 27 | all: $(LIB) | ||
| 28 | |||
| 29 | install: $(LIB) | ||
| 30 | - test -d $(PREFIX)/share/man/man3 || mkdir -p $(PREFIX)/share/man/man3 | ||
| 31 | - install -m 0644 print.3 $(PREFIX)/share/man/man3/print.3 | ||
| 32 | - install -m 0644 fmtinstall.3 $(PREFIX)/share/man/man3/fmtinstall.3 | ||
| 33 | - mkdir -p $(PREFIX)/include | ||
| 34 | - install -m 0644 fmt.h $(PREFIX)/include/fmt.h | ||
| 35 | - mkdir -p $(PREFIX)/lib | ||
| 36 | - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) | ||
| 37 | + test -d $(DESTDIR)$(PREFIX)/share/man/man3 || mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3 | ||
| 38 | + install -m 0644 print.3 $(DESTDIR)$(PREFIX)/share/man/man3/print.3 | ||
| 39 | + install -m 0644 fmtinstall.3 $(DESTDIR)$(PREFIX)/share/man/man3/fmtinstall.3 | ||
| 40 | + mkdir -p $(DESTDIR)$(PREFIX)/include | ||
| 41 | + install -m 0644 fmt.h $(DESTDIR)$(PREFIX)/include/fmt.h | ||
| 42 | + mkdir -p $(DESTDIR)$(PREFIX)/lib | ||
| 43 | + install -m 0644 $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB) | ||
| 44 | |||
| 45 | $(NAN).$O: nan.h | ||
| 46 | strtod.$O: nan.h | ||
| 47 | diff -ur a/libregexp/Makefile b/libregexp/Makefile | ||
| 48 | --- a/libregexp/Makefile 2022-05-09 13:46:34.071447416 -0400 | ||
| 49 | +++ b/libregexp/Makefile 2022-05-09 13:48:45.939443140 -0400 | ||
| 50 | @@ -41,13 +41,13 @@ | ||
| 51 | all: $(LIB) | ||
| 52 | |||
| 53 | install: $(LIB) | ||
| 54 | - mkdir -p $(PREFIX)/share/man/man3 $(PREFIX)/man/man7 | ||
| 55 | - install -m 0644 regexp9.3 $(PREFIX)/share/man/man3/regexp9.3 | ||
| 56 | - install -m 0644 regexp9.7 $(PREFIX)/man/man7/regexp9.7 | ||
| 57 | - mkdir -p $(PREFIX)/lib | ||
| 58 | - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) | ||
| 59 | - mkdir -p $(PREFIX)/include | ||
| 60 | - install -m 0644 regexp9.h $(PREFIX)/include/regexp9.h | ||
| 61 | + mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3 $(DESTDIR)$(PREFIX)/man/man7 | ||
| 62 | + install -m 0644 regexp9.3 $(DESTDIR)$(PREFIX)/share/man/man3/regexp9.3 | ||
| 63 | + install -m 0644 regexp9.7 $(DESTDIR)$(PREFIX)/man/man7/regexp9.7 | ||
| 64 | + mkdir -p $(DESTDIR)$(PREFIX)/lib | ||
| 65 | + install -m 0644 $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB) | ||
| 66 | + mkdir -p $(DESTDIR)$(PREFIX)/include | ||
| 67 | + install -m 0644 regexp9.h $(DESTDIR)$(PREFIX)/include/regexp9.h | ||
| 68 | |||
| 69 | test: test.$O $(LIB) | ||
| 70 | $(CC) -o test test.$O $(LIB) -L/usr/local/lib -lfmt -lutf | ||
| 71 | diff -ur a/libutf/Makefile b/libutf/Makefile | ||
| 72 | --- a/libutf/Makefile 2022-05-09 13:46:34.071447416 -0400 | ||
| 73 | +++ b/libutf/Makefile 2022-05-09 13:49:10.549442342 -0400 | ||
| 74 | @@ -53,15 +53,15 @@ | ||
| 75 | all: $(LIB) | ||
| 76 | |||
| 77 | install: $(LIB) | ||
| 78 | - mkdir -p $(PREFIX)/share/man/man3 $(PREFIX)/man/man7 | ||
| 79 | - install -c -m 0644 isalpharune.3 $(PREFIX)/share/man/man3/isalpharune.3 | ||
| 80 | - install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7 | ||
| 81 | - install -c -m 0644 rune.3 $(PREFIX)/share/man/man3/rune.3 | ||
| 82 | - install -c -m 0644 runestrcat.3 $(PREFIX)/share/man/man3/runestrcat.3 | ||
| 83 | - mkdir -p $(PREFIX)/include | ||
| 84 | - install -c -m 0644 utf.h $(PREFIX)/include/utf.h | ||
| 85 | - mkdir -p $(PREFIX)/lib | ||
| 86 | - install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) | ||
| 87 | + mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3 $(DESTDIR)$(PREFIX)/man/man7 | ||
| 88 | + install -c -m 0644 isalpharune.3 $(DESTDIR)$(PREFIX)/share/man/man3/isalpharune.3 | ||
| 89 | + install -c -m 0644 utf.7 $(DESTDIR)$(PREFIX)/man/man7/utf.7 | ||
| 90 | + install -c -m 0644 rune.3 $(DESTDIR)$(PREFIX)/share/man/man3/rune.3 | ||
| 91 | + install -c -m 0644 runestrcat.3 $(DESTDIR)$(PREFIX)/share/man/man3/runestrcat.3 | ||
| 92 | + mkdir -p $(DESTDIR)$(PREFIX)/include | ||
| 93 | + install -c -m 0644 utf.h $(DESTDIR)$(PREFIX)/include/utf.h | ||
| 94 | + mkdir -p $(DESTDIR)$(PREFIX)/lib | ||
| 95 | + install -c -m 0644 $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB) | ||
| 96 | |||
| 97 | $(LIB): $(OFILES) | ||
| 98 | $(AR) $(ARFLAGS) $(LIB) $(OFILES) | ||
| 99 | diff -ur a/mk/Makefile b/mk/Makefile | ||
| 100 | --- a/mk/Makefile 2022-05-09 13:46:34.071447416 -0400 | ||
| 101 | +++ b/mk/Makefile 2022-05-09 13:49:41.475441339 -0400 | ||
| 102 | @@ -61,13 +61,13 @@ | ||
| 103 | TGZFILES+=mk.pdf | ||
| 104 | |||
| 105 | install: $(TARG) | ||
| 106 | - mkdir -p $(PREFIX)/bin | ||
| 107 | - install -m 0755 mk $(PREFIX)/bin/mk | ||
| 108 | - cat mk.1 | sed 's;DOCPREFIX;$(PREFIX);g' >mk.1a | ||
| 109 | - mkdir -p $(PREFIX)/man/man1 | ||
| 110 | - install -m 0644 mk.1a $(PREFIX)/man/man1/mk.1 | ||
| 111 | - mkdir -p $(PREFIX)/doc | ||
| 112 | - install -m 0644 mk.pdf $(PREFIX)/doc/mk.pdf | ||
| 113 | + mkdir -p $(DESTDIR)$(PREFIX)/bin | ||
| 114 | + install -m 0755 mk $(DESTDIR)$(PREFIX)/bin/mk | ||
| 115 | + sed 's;DOCPREFIX;$(PREFIX);g' <mk.1 >mk.1a | ||
| 116 | + mkdir -p $(DESTDIR)$(PREFIX)/man/man1 | ||
| 117 | + install -m 0644 mk.1a $(DESTDIR)$(PREFIX)/man/man1/mk.1 | ||
| 118 | + mkdir -p $(DESTDIR)$(PREFIX)/doc | ||
| 119 | + install -m 0644 mk.pdf $(DESTDIR)$(PREFIX)/doc/mk.pdf | ||
| 120 | |||
| 121 | $(LIB): $(OFILES) | ||
| 122 | $(AR) $(ARFLAGS) $(LIB) $(OFILES) | ||
diff --git a/rc/.footprint b/rc/.footprint new file mode 100644 index 0000000..74a5adb --- /dev/null +++ b/rc/.footprint | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | drwxr-xr-x root/root usr/ | ||
| 2 | drwxr-xr-x root/root usr/bin/ | ||
| 3 | -rwxr-xr-x root/root usr/bin/rc | ||
| 4 | drwxr-xr-x root/root usr/lib/ | ||
| 5 | -rw-r--r-- root/root usr/lib/rcmain | ||
| 6 | drwxr-xr-x root/root usr/share/ | ||
| 7 | drwxr-xr-x root/root usr/share/man/ | ||
| 8 | drwxr-xr-x root/root usr/share/man/man1/ | ||
| 9 | -rw-r--r-- root/root usr/share/man/man1/rc.1.gz | ||
diff --git a/rc/.md5sum b/rc/.md5sum new file mode 100644 index 0000000..95aa6e9 --- /dev/null +++ b/rc/.md5sum | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | dee21069ebf18a311961443314aa4015 destdir.patch | ||
| 2 | 7493a450d80bcd01c5c55a3a2892607e frobnitzem-globals.patch | ||
diff --git a/rc/Pkgfile b/rc/Pkgfile new file mode 100644 index 0000000..ab7e1fa --- /dev/null +++ b/rc/Pkgfile | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | # Description: standalone Unix port for Plan 9's shell rc | ||
| 2 | # URL: https://github.com/benavento/rc | ||
| 3 | # Maintainer: Shokara Kou, kou at 13f0 dot net | ||
| 4 | # Depends on: | ||
| 5 | |||
| 6 | name=rc | ||
| 7 | commit=50b729e | ||
| 8 | version=git-$commit | ||
| 9 | release=1 | ||
| 10 | source=(makefile.patch frobnitzem-globals.patch) | ||
| 11 | |||
| 12 | cloneurl=https://github.com/benavento/rc | ||
| 13 | |||
| 14 | build() { | ||
| 15 | git clone $cloneurl | ||
| 16 | cd $name | ||
| 17 | git checkout $commit | ||
| 18 | |||
| 19 | patch -Np1 <$SRC/makefile.patch | ||
| 20 | patch -Np1 <$SRC/frobnitzem-globals.patch | ||
| 21 | |||
| 22 | make DESTDIR=$PKG PREFIX=/usr install | ||
| 23 | } | ||
diff --git a/rc/frobnitzem-globals.patch b/rc/frobnitzem-globals.patch new file mode 100644 index 0000000..9ec69c0 --- /dev/null +++ b/rc/frobnitzem-globals.patch | |||
| @@ -0,0 +1,265 @@ | |||
| 1 | commit 553b6890624d04e64ca0973d8fe86b107cb363b7 | ||
| 2 | Author: David M. Rogers <predictivestatmech@gmail.com> | ||
| 3 | Date: Wed Oct 13 11:45:42 2021 -0400 | ||
| 4 | |||
| 5 | Moved global variables into globals.c | ||
| 6 | |||
| 7 | diff --git a/Makefile b/Makefile | ||
| 8 | index 6de563b..c8b7566 100644 | ||
| 9 | --- a/Makefile | ||
| 10 | +++ b/Makefile | ||
| 11 | @@ -3,6 +3,7 @@ include Make.$(shell uname) | ||
| 12 | TARG=rc | ||
| 13 | |||
| 14 | OFILES=\ | ||
| 15 | + globals.$O \ | ||
| 16 | code.$O\ | ||
| 17 | exec.$O\ | ||
| 18 | getflags.$O\ | ||
| 19 | diff --git a/code.c b/code.c | ||
| 20 | index eeaa3ed..876da4b 100644 | ||
| 21 | --- a/code.c | ||
| 22 | +++ b/code.c | ||
| 23 | @@ -15,7 +15,6 @@ char *fnstr(tree*); | ||
| 24 | void outcode(tree*, int); | ||
| 25 | void codeswitch(tree*, int); | ||
| 26 | int iscase(tree*); | ||
| 27 | -code *codecopy(code*); | ||
| 28 | void codefree(code*); | ||
| 29 | |||
| 30 | int | ||
| 31 | diff --git a/exec.c b/exec.c | ||
| 32 | index 3ad8a0d..a24cd74 100644 | ||
| 33 | --- a/exec.c | ||
| 34 | +++ b/exec.c | ||
| 35 | @@ -6,7 +6,6 @@ | ||
| 36 | /* | ||
| 37 | * Start executing the given code at the given pc with the given redirection | ||
| 38 | */ | ||
| 39 | -char *argv0="rc"; | ||
| 40 | |||
| 41 | void | ||
| 42 | start(code *c, int pc, var *local) | ||
| 43 | diff --git a/exec.h b/exec.h | ||
| 44 | index 06d2991..fcab495 100644 | ||
| 45 | --- a/exec.h | ||
| 46 | +++ b/exec.h | ||
| 47 | @@ -56,18 +56,22 @@ struct thread{ | ||
| 48 | tree *treenodes; /* tree nodes created by this process */ | ||
| 49 | thread *ret; /* who continues when this finishes */ | ||
| 50 | }; | ||
| 51 | -thread *runq; | ||
| 52 | + | ||
| 53 | code *codecopy(code*); | ||
| 54 | -code *codebuf; /* compiler output */ | ||
| 55 | -int ntrap; /* number of outstanding traps */ | ||
| 56 | -int trap[NSIG]; /* number of outstanding traps per type */ | ||
| 57 | + | ||
| 58 | +/* globals.c */ | ||
| 59 | +extern thread *runq; | ||
| 60 | +extern code *codebuf; /* compiler output */ | ||
| 61 | +extern int ntrap; /* number of outstanding traps */ | ||
| 62 | +extern int trap[NSIG]; /* number of outstanding traps per type */ | ||
| 63 | +extern int eflagok; /* kludge flag so that -e doesn't exit in startup */ | ||
| 64 | +extern int havefork; | ||
| 65 | + | ||
| 66 | struct builtin{ | ||
| 67 | char *name; | ||
| 68 | void (*fnc)(void); | ||
| 69 | }; | ||
| 70 | extern struct builtin Builtin[]; | ||
| 71 | -int eflagok; /* kludge flag so that -e doesn't exit in startup */ | ||
| 72 | -int havefork; | ||
| 73 | |||
| 74 | void execcd(void), execwhatis(void), execeval(void), execexec(void); | ||
| 75 | int execforkexec(void); | ||
| 76 | diff --git a/globals.c b/globals.c | ||
| 77 | new file mode 100644 | ||
| 78 | index 0000000..b29bfe3 | ||
| 79 | --- /dev/null | ||
| 80 | +++ b/globals.c | ||
| 81 | @@ -0,0 +1,30 @@ | ||
| 82 | +#include "rc.h" | ||
| 83 | +#include "io.h" | ||
| 84 | + | ||
| 85 | +int mypid; | ||
| 86 | + | ||
| 87 | +/* globals associated with lex.c and subr.c */ | ||
| 88 | +int doprompt = 1; /* is it time for a prompt? */ | ||
| 89 | +int lastdol; /* was the last token read '$' or '$#' or '"'? */ | ||
| 90 | +int lastword; /* was the last token read a word or compound word terminator? */ | ||
| 91 | +char tok[NTOK]; | ||
| 92 | +int ndot = 0; // FIXME - never decreases? | ||
| 93 | +int lastc; | ||
| 94 | +int lastword; | ||
| 95 | +int kidpid; | ||
| 96 | + | ||
| 97 | +io *rc_err; | ||
| 98 | + | ||
| 99 | +/* globals associated with exec.c */ | ||
| 100 | +char *promptstr; | ||
| 101 | +tree *cmdtree; | ||
| 102 | +thread *runq; | ||
| 103 | +code *codebuf; /* compiler output */ | ||
| 104 | +int ntrap; /* number of outstanding traps */ | ||
| 105 | +int trap[NSIG]; /* number of outstanding traps per type */ | ||
| 106 | +int eflagok; /* kludge flag so that -e doesn't exit in startup */ | ||
| 107 | + | ||
| 108 | +char *argv0="rc"; | ||
| 109 | +var *gvar[NVAR]; /* hash for globals */ | ||
| 110 | + | ||
| 111 | +int nerror = 0; /* number of errors encountered during compilation */ | ||
| 112 | diff --git a/io.h b/io.h | ||
| 113 | index 21cc6b8..68b9e89 100644 | ||
| 114 | --- a/io.h | ||
| 115 | +++ b/io.h | ||
| 116 | @@ -10,7 +10,7 @@ struct io{ | ||
| 117 | int fd; | ||
| 118 | char *bufp, *ebuf, *strp, buf[NBUF]; | ||
| 119 | }; | ||
| 120 | -io *err; | ||
| 121 | +extern io *err; | ||
| 122 | io *openfd(int), *openstr(void), *opencore(char *, int); | ||
| 123 | int emptybuf(io*); | ||
| 124 | void pchr(io*, int); | ||
| 125 | diff --git a/lex.c b/lex.c | ||
| 126 | index d2bef32..f1e40e2 100644 | ||
| 127 | --- a/lex.c | ||
| 128 | +++ b/lex.c | ||
| 129 | @@ -3,7 +3,11 @@ | ||
| 130 | #include "io.h" | ||
| 131 | #include "getflags.h" | ||
| 132 | #include "fns.h" | ||
| 133 | -int getnext(void); | ||
| 134 | + | ||
| 135 | +static int future = EOF; | ||
| 136 | +static int inquote; | ||
| 137 | +static int incomm; | ||
| 138 | +static int getnext(void); | ||
| 139 | |||
| 140 | int | ||
| 141 | wordchr(int c) | ||
| 142 | @@ -21,10 +25,6 @@ idchr(int c) | ||
| 143 | */ | ||
| 144 | return c>' ' && !strchr("!\"#$%&'()+,-./:;<=>?@[\\]^`{|}~", c); | ||
| 145 | } | ||
| 146 | -int future = EOF; | ||
| 147 | -int doprompt = 1; | ||
| 148 | -int inquote; | ||
| 149 | -int incomm; | ||
| 150 | /* | ||
| 151 | * Look ahead in the input stream | ||
| 152 | */ | ||
| 153 | @@ -52,7 +52,7 @@ advance(void) | ||
| 154 | * read a character from the input stream | ||
| 155 | */ | ||
| 156 | |||
| 157 | -int | ||
| 158 | +static int | ||
| 159 | getnext(void) | ||
| 160 | { | ||
| 161 | int c; | ||
| 162 | @@ -163,8 +163,6 @@ addutf(char *p, int c) | ||
| 163 | } | ||
| 164 | return p; | ||
| 165 | } | ||
| 166 | -int lastdol; /* was the last token read '$' or '$#' or '"'? */ | ||
| 167 | -int lastword; /* was the last token read a word or compound word terminator? */ | ||
| 168 | |||
| 169 | int | ||
| 170 | yylex(void) | ||
| 171 | diff --git a/rc.h b/rc.h | ||
| 172 | index 8a6a5bb..1d87051 100644 | ||
| 173 | --- a/rc.h | ||
| 174 | +++ b/rc.h | ||
| 175 | @@ -53,7 +53,7 @@ tree *mung1(tree*, tree*), *mung2(tree*, tree*, tree*); | ||
| 176 | tree *mung3(tree*, tree*, tree*, tree*), *epimung(tree*, tree*); | ||
| 177 | tree *simplemung(tree*), *heredoc(tree*); | ||
| 178 | void freetree(tree*); | ||
| 179 | -tree *cmdtree; | ||
| 180 | +extern tree *cmdtree; | ||
| 181 | /* | ||
| 182 | * The first word of any code vector is a reference count. | ||
| 183 | * Always create a new reference to a code vector by calling codecopy(.). | ||
| 184 | @@ -64,10 +64,10 @@ union code{ | ||
| 185 | int i; | ||
| 186 | char *s; | ||
| 187 | }; | ||
| 188 | -char *promptstr; | ||
| 189 | -int doprompt; | ||
| 190 | +extern char *promptstr; | ||
| 191 | +extern int doprompt; | ||
| 192 | #define NTOK 8192 | ||
| 193 | -char tok[NTOK]; | ||
| 194 | +extern char tok[NTOK]; | ||
| 195 | #define APPEND 1 | ||
| 196 | #define WRITE 2 | ||
| 197 | #define READ 3 | ||
| 198 | @@ -87,7 +87,7 @@ struct var{ | ||
| 199 | }; | ||
| 200 | var *vlook(char*), *gvlook(char*), *newvar(char*, var*); | ||
| 201 | #define NVAR 521 | ||
| 202 | -var *gvar[NVAR]; /* hash for globals */ | ||
| 203 | +extern var *gvar[NVAR]; /* hash for globals */ | ||
| 204 | #define new(type) ((type *)emalloc(sizeof(type))) | ||
| 205 | void *emalloc(long); | ||
| 206 | void *Malloc(ulong); | ||
| 207 | @@ -98,7 +98,7 @@ struct here{ | ||
| 208 | char *name; | ||
| 209 | struct here *next; | ||
| 210 | }; | ||
| 211 | -int mypid; | ||
| 212 | +extern int mypid; | ||
| 213 | /* | ||
| 214 | * Glob character escape in strings: | ||
| 215 | * In a string, GLOB must be followed by *?[ or GLOB. | ||
| 216 | @@ -117,10 +117,13 @@ int mypid; | ||
| 217 | #define threebyte(c) ((c&0xf0)==0xe0) | ||
| 218 | #define fourbyte(c) ((c&0xf8)==0xf0) | ||
| 219 | |||
| 220 | -char **argp; | ||
| 221 | -char **args; | ||
| 222 | -int nerror; /* number of errors encountered during compilation */ | ||
| 223 | -int doprompt; /* is it time for a prompt? */ | ||
| 224 | +extern char *argv0; | ||
| 225 | +//char **argp; | ||
| 226 | +//char **args; | ||
| 227 | +extern int nerror; /* number of errors encountered during compilation */ | ||
| 228 | +extern int doprompt; /* is it time for a prompt? */ | ||
| 229 | +extern int lastword, lastdol; | ||
| 230 | + | ||
| 231 | /* | ||
| 232 | * Which fds are the reading/writing end of a pipe? | ||
| 233 | * Unfortunately, this can vary from system to system. | ||
| 234 | @@ -129,14 +132,14 @@ int doprompt; /* is it time for a prompt? */ | ||
| 235 | */ | ||
| 236 | #define PRD 0 | ||
| 237 | #define PWR 1 | ||
| 238 | -char *Rcmain, *Fdprefix; | ||
| 239 | +extern char *Rcmain, *Fdprefix; | ||
| 240 | #define register | ||
| 241 | /* | ||
| 242 | * How many dot commands have we executed? | ||
| 243 | * Used to ensure that -v flag doesn't print rcmain. | ||
| 244 | */ | ||
| 245 | -int ndot; | ||
| 246 | +extern int ndot; | ||
| 247 | char *getstatus(void); | ||
| 248 | -int lastc; | ||
| 249 | -int lastword; | ||
| 250 | -int kidpid; | ||
| 251 | +extern int lastc; | ||
| 252 | +extern int lastword; | ||
| 253 | +extern int kidpid; | ||
| 254 | diff --git a/subr.c b/subr.c | ||
| 255 | index a2d8a18..1fe3b9b 100644 | ||
| 256 | --- a/subr.c | ||
| 257 | +++ b/subr.c | ||
| 258 | @@ -22,7 +22,6 @@ efree(void *p) | ||
| 259 | free(p); | ||
| 260 | else pfmt(err, "free 0\n"); | ||
| 261 | } | ||
| 262 | -extern int lastword, lastdol; | ||
| 263 | |||
| 264 | void | ||
| 265 | yyerror(char *m) | ||
diff --git a/rc/makefile.patch b/rc/makefile.patch new file mode 100644 index 0000000..ea3b66b --- /dev/null +++ b/rc/makefile.patch | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | diff -ur a/Makefile b/Makefile | ||
| 2 | --- a/Makefile 2022-05-10 23:02:55.921563498 -0400 | ||
| 3 | +++ b/Makefile 2022-05-10 23:03:49.446561763 -0400 | ||
| 4 | @@ -46,9 +46,9 @@ | ||
| 5 | cmp -s x.tab.h y.tab.h || cp y.tab.h x.tab.h | ||
| 6 | |||
| 7 | install: all rcmain.unix rc.1 | ||
| 8 | - install -m 755 $(TARG) $(PREFIX)/bin | ||
| 9 | - install -m 644 rcmain.unix $(PREFIX)/lib/rcmain | ||
| 10 | - install -m 644 rc.1 $(PREFIX)/share/man/man1 | ||
| 11 | + install -Dm755 -t $(DESTDIR)$(PREFIX)/bin $(TARG) | ||
| 12 | + install -Dm644 rcmain.unix $(DESTDIR)$(PREFIX)/lib/rcmain | ||
| 13 | + install -Dm644 -t $(DESTDIR)$(PREFIX)/share/man/man1 rc.1 | ||
| 14 | |||
| 15 | %: %.c $(HFILES) | ||
| 16 | $(CC) $(ARCHS) -o $@ $< $(LFLAGS) | ||
