commit 0a1ecd59e87e2a3f394be2bcf9bf14d2eb293fc8
parent 969af168ea450bf79f800da620efefa91ed1f174
Author: Toby Goodwin <toby@paccrat.org>
Date: Mon, 26 Mar 2018 18:21:22 +0100
Merge branch 'master' into ifnot
Diffstat:
9 files changed, 93 insertions(+), 87 deletions(-)
diff --git a/.vimrc b/.vimrc
@@ -0,0 +1 @@
+set noet sw=8
diff --git a/ChangeLog b/ChangeLog
@@ -174,19 +174,19 @@ Changes since rc-1.4:
General changes:
- Some small memory leaks/uninit references revealed by Purify.
+ Some small memory leaks/uninit references revealed by Purify.
- $bqstatus for querying the exit status of a backquote.
+ $bqstatus for querying the exit status of a backquote.
- Globbing through unreadable directories.
+ Globbing through unreadable directories.
- More options to whatis.
+ More options to whatis.
- History append which always re-opens the file (avoids
- inconsistencies over multiple NFS-mounted accesses to
- $history).
+ History append which always re-opens the file (avoids
+ inconsistencies over multiple NFS-mounted accesses to
+ $history).
- Support "rc -s".
+ Support "rc -s".
---------
@@ -921,3 +921,8 @@ Changes since rc-1.5b2
Feature: implement `if not`.
Feature: default values for $nl and $tab (github #43).
+
+2018-03-20
+
+ Tidiness: be consistent about using tabs everywhere, and add a .vimrc to
+ keep it so in the future.
diff --git a/EXAMPLES b/EXAMPLES
@@ -110,19 +110,19 @@ in your path.)
#!/bin/rc
if (~ $#* 0)
- exec openfile
+ exec openfile
create = ()
files = ()
for (i in $*)
- if (test -f $i) {
- files = ($files $i)
- } else {
- create = ($create $i)
+ if (test -f $i) {
+ files = ($files $i)
+ } else {
+ create = ($create $i)
}
create = `{ pick $create }
files = ($files $create)
for (i in $create)
- > $i
+ > $i
if (! ~ $#files 0)
openfile $files
@@ -139,12 +139,12 @@ to set $foo to a single line from the terminal.
(due to John Mackin <john@syd.dit.csiro.au>)
fn read {
- x=() {
- x = `` ($nl) { awk '{print; print 0; exit}' ^ $nl ^ \
- 'END {print 1; print 1}' }
- $1 = $x(1)
- return $x(2)
- }
+ x=() {
+ x = `` ($nl) { awk '{print; print 0; exit}' ^ $nl ^ \
+ 'END {print 1; print 1}' }
+ $1 = $x(1)
+ return $x(2)
+ }
}
From cs.wisc.edu!dws Fri Aug 2 18:16:14 1991
@@ -280,62 +280,62 @@ static void b_kill(char **av)
boolean res;
if (!av[1]) {
- set(TRUE);
- return;
+ set(TRUE);
+ return;
}
#undef STRCMP
#define STRCMP strcmp
if ( '-' == av[1][0]) {
- char *p = 1+av[1];
- if (0 == strcmp(av[1], "-l")){
- int r; const int nsig = NUMOFSIGNALS;
- const int C = 4, R = 1 + (int)((nsig-2)/C);
- for (r=1; r<=R; r++){
- int j;
- for (j=r; j<nsig; j+=R){
- fprint(1, "%s%d. %s\t", j<10?" ":"", j, signals[j][0]);
- }
- fprint(1,"\n");
- }
- set(TRUE);
- return;
- }
- n++;
- if ( (signal=a2u(p)) < 0){
- int i;
- for (i = 1; i < NUMOFSIGNALS; i++){
- char UPPER[31], *u=UPPER, *q;
- for (q=signals[i][0]; *q; q++, u++) *u = toupper(*q);
- *u = '\0';
-
- if (*signals[i][0] &&
- (!STRCMP(signals[i][0], p) || !STRCMP(3+signals[i][0],p)
- || !STRCMP(UPPER, p) || !STRCMP(3+UPPER, p) ) )
- {
- signal = i;
- break;
- }
- }
- if (signal < 0){
- fprint(2,"kill: bad signal %s\n", av[1]);
- set(FALSE);
- return;
- }
- }
+ char *p = 1+av[1];
+ if (0 == strcmp(av[1], "-l")){
+ int r; const int nsig = NUMOFSIGNALS;
+ const int C = 4, R = 1 + (int)((nsig-2)/C);
+ for (r=1; r<=R; r++){
+ int j;
+ for (j=r; j<nsig; j+=R){
+ fprint(1, "%s%d. %s\t", j<10?" ":"", j, signals[j][0]);
+ }
+ fprint(1,"\n");
+ }
+ set(TRUE);
+ return;
+ }
+ n++;
+ if ( (signal=a2u(p)) < 0){
+ int i;
+ for (i = 1; i < NUMOFSIGNALS; i++){
+ char UPPER[31], *u=UPPER, *q;
+ for (q=signals[i][0]; *q; q++, u++) *u = toupper(*q);
+ *u = '\0';
+
+ if (*signals[i][0] &&
+ (!STRCMP(signals[i][0], p) || !STRCMP(3+signals[i][0],p)
+ || !STRCMP(UPPER, p) || !STRCMP(3+UPPER, p) ) )
+ {
+ signal = i;
+ break;
+ }
+ }
+ if (signal < 0){
+ fprint(2,"kill: bad signal %s\n", av[1]);
+ set(FALSE);
+ return;
+ }
+ }
}
#undef STRCMP
for (res=TRUE; av[n]; n++){
- if( (pid = (pid_t) a2u(av[n])) < 0){
- fprint(2, "kill: bad process number %s\n", av[n]);
- res = FALSE;
- continue;
- }
- if (kill(pid,signal)){
- uerror("kill");
- res = FALSE;
- continue;
- }
+ if( (pid = (pid_t) a2u(av[n])) < 0){
+ fprint(2, "kill: bad process number %s\n", av[n]);
+ res = FALSE;
+ continue;
+ }
+ if (kill(pid,signal)){
+ uerror("kill");
+ res = FALSE;
+ continue;
+ }
}
set(res);
}
@@ -513,13 +513,13 @@ while (~ $1 -*)
macros=$1;
case -k
fflag=(); kflag=1;
- shift;
- break;
+ shift;
+ break;
case -f
# locate related too filenames
kflag=(); fflag=1;
- shift;
- break;
+ shift;
+ break;
case -*
echo bad flag '`'^$1^'''' >[1=2];
usage;
@@ -585,7 +585,7 @@ while (!~ $1 ()) {
dont=()
for (x in $Cat) {
if (~ `{echo $x | sed 's/\/[mc]a[nt][1-8l]//'} \
- `{echo $file | sed 's/\/[mc]a[nt][1-8l]//'}) {
+ `{echo $file | sed 's/\/[mc]a[nt][1-8l]//'}) {
dont=1;
break;
}
diff --git a/configure.ac b/configure.ac
@@ -101,7 +101,7 @@ AC_ARG_ENABLE(protect-env, [ --disable-protect-env Don't protect environment
AC_ARG_ENABLE(def-interp,
[ --enable-def-interp=/bin/foo
- Use /bin/foo as default interpreter [[/bin/sh]]],
+ Use /bin/foo as default interpreter [[/bin/sh]]],
[
case "$enableval" in
no)
@@ -117,8 +117,8 @@ AC_ARG_ENABLE(def-interp,
AC_ARG_ENABLE(def-path,
[ --enable-def-path=\"/usr/local/bin/\",\"/usr/bin\"
- Default path [[All of these that exist
- (/usr/local/bin /usr/bin /usr/bsd /usr/ucb /bin .)]]],
+ Default path [[All of these that exist
+ (/usr/local/bin /usr/bin /usr/bsd /usr/ucb /bin .)]]],
[
case "$enableval" in
no|yes) ;;
@@ -159,9 +159,9 @@ AM_CONDITIONAL(AMC_DEVELOP, test "$rc_develop" = true)
AC_ARG_WITH(history,
[ --with-history Build history subprograms],[
case "$withval" in
- yes) rc_history=yes ;;
- *) rc_history=no ;;
- esac
+ yes) rc_history=yes ;;
+ *) rc_history=no ;;
+ esac
], rc_history=no)
AM_CONDITIONAL(AMC_HISTORY, test "$rc_history" = yes)
diff --git a/configure.scan b/configure.scan
@@ -43,7 +43,7 @@ AC_FUNC_STAT
AC_CHECK_FUNCS([dup2 memset mkfifo strchr strerror strrchr strspn])
AC_CONFIG_FILES([Makefile
- rc-1.7s20020820/Makefile
- rc-1.7s20021127/=build/Makefile
- rc-1.7s20021127/Makefile])
+ rc-1.7s20020820/Makefile
+ rc-1.7s20021127/=build/Makefile
+ rc-1.7s20021127/Makefile])
AC_OUTPUT
diff --git a/mkinstalldirs b/mkinstalldirs
@@ -98,7 +98,7 @@ case $dirmode in
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
- test -d $d && rmdir $d
+ test -d $d && rmdir $d
done
fi
;;
diff --git a/parse.y b/parse.y
@@ -114,7 +114,7 @@ cmd : /* empty */ %prec WHILE { $$ = NULL; }
| TWIDDLE optcaret word words { $$ = mk(nMatch,$3,$4); }
| cmd ANDAND optnl cmd { $$ = mk(nAndalso,$1,$4); }
| cmd OROR optnl cmd { $$ = mk(nOrelse,$1,$4); }
- | cmd PIPE optnl cmd { $$ = mk(nPipe,$2.left,$2.right,$1,$4); }
+ | cmd PIPE optnl cmd { $$ = mk(nPipe,$2.left,$2.right,$1,$4); }
| redir cmd %prec PREDIR { $$ = ($2 != NULL ? mk(nPre,$1,$2) : $1); }
| assign cmd %prec BANG { $$ = ($2 != NULL ? mk(nPre,$1,$2) : $1); }
| BANG optcaret cmd { $$ = mk(nBang,$3); }
diff --git a/rc.1 b/rc.1
@@ -2105,7 +2105,7 @@ cmd : /* empty */ %prec WHILE
| TWIDDLE optcaret word words
| cmd ANDAND optnl cmd
| cmd OROR optnl cmd
- | cmd PIPE optnl cmd
+ | cmd PIPE optnl cmd
| redir cmd %prec BANG
| assign cmd %prec BANG
| BANG optcaret cmd
diff --git a/trip.rc b/trip.rc
@@ -128,11 +128,11 @@ $abc^n $x^here$x^doc
EOF
{if (!~ `` $nl cat ' ') fail quoted heredoc} << ' '
-
+
<<<[9] ``''{cat $bigfile} \
{
- if(!~ ``''{cat <[0=9]}``'' cat)fail large herestrings
+ if(!~ ``''{cat <[0=9]}``'' cat)fail large herestrings
} < \
$bigfile