runlisp.c, etc.: Rename `-p' to `-d'. COMPAT
authorMark Wooding <mdw@distorted.org.uk>
Sat, 15 May 2021 13:45:20 +0000 (14:45 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 15 May 2021 13:59:01 +0000 (14:59 +0100)
This is to make way for a new `-p' option which works like `princ'.

runlisp.1.in
runlisp.c
tests.at

index 119c4e0..35378d4 100644 (file)
@@ -58,12 +58,12 @@ runlisp \- run Common Lisp programs as scripts
 .br
 .B runlisp
 .RI [ options ]
 .br
 .B runlisp
 .RI [ options ]
+.RB [ \-d
+.IR form ]
 .RB [ \-e
 .IR form ]
 .RB [ \-l
 .IR file ]
 .RB [ \-e
 .IR form ]
 .RB [ \-l
 .IR file ]
-.RB [ \-p
-.IR form ]
 .RB [ \-\- ]
 .RI [ arguments
 \*(..]
 .RB [ \-\- ]
 .RI [ arguments
 \*(..]
@@ -199,6 +199,25 @@ All of the files are expected to be as described in
 .BR runlisp.conf (5).
 .
 .TP
 .BR runlisp.conf (5).
 .
 .TP
+.BI "\-d" "\fR, " "\-\-dump-expression=" expr
+Evaluate the expression(s)
+.I expr
+and print the resulting value(s)
+to standard output
+(as if by
+.BR prin1 ).
+If a form produces multiple values,
+they are printed on a single line,
+separated by a single space character;
+if a form produces no values at all,
+then nothing is printed \(en not even a newline character.
+This option causes
+.B runlisp
+to execute in
+.I eval
+mode.
+.
+.TP
 .BI "\-e" "\fR, " "\-\-evaluate-expression=" expr
 Evaluate the expression(s)
 .I expr
 .BI "\-e" "\fR, " "\-\-evaluate-expression=" expr
 Evaluate the expression(s)
 .I expr
@@ -247,25 +266,6 @@ and overrides any similarly named setting
 from the configuration file(s).
 .
 .TP
 from the configuration file(s).
 .
 .TP
-.BI "\-p" "\fR, " "\-\-print-expressin=" expr
-Evaluate the expression(s)
-.I expr
-and print the resulting value(s)
-to standard output
-(as if by
-.BR prin1 ).
-If a form produces multiple values,
-they are printed on a single line,
-separated by a single space character;
-if a form produces no values at all,
-then nothing is printed \(en not even a newline character.
-This option causes
-.B runlisp
-to execute in
-.I eval
-mode.
-.
-.TP
 .BR "\-q" ", " "\-\-quiet"
 Don't print warning messages.
 This option may be repeated:
 .BR "\-q" ", " "\-\-quiet"
 Don't print warning messages.
 This option may be repeated:
@@ -290,10 +290,10 @@ Higher verbosity levels print informational and debugging messages.
 .
 .PP
 The
 .
 .PP
 The
+.RB ` \-d ',
 .RB ` \-e ',
 .RB ` \-e ',
-.RB ` \-l ',
 and
 and
-.RB ` \-p '
+.RB ` \-l '
 options may only be given on the command-line itself,
 not following a
 .RB `@ RUNLISP: '
 options may only be given on the command-line itself,
 not following a
 .RB `@ RUNLISP: '
@@ -323,10 +323,10 @@ though the boundary may be marked explicitly using
 .RB ` \-\- '
 if desired.
 If the command line contains any of
 .RB ` \-\- '
 if desired.
 If the command line contains any of
+.RB ` \-d ',
 .RB ` \-e ',
 .RB ` \-e ',
-.RB ` \-l ',
 or
 or
-.RB ` \-p ',
+.RB ` \-l ',
 then
 .B runlisp
 treats all of its positional arguments as
 then
 .B runlisp
 treats all of its positional arguments as
@@ -422,10 +422,10 @@ and
 is now committed to
 .I script
 mode, so it's too late for
 is now committed to
 .I script
 mode, so it's too late for
+.RB ` \-d ',
 .RB ` \-e ',
 .RB ` \-e ',
-.RB ` \-l ',
 and
 and
-.RB ` \-p '
+.RB ` \-l '
 too.
 .PP
 (This feature allows scripts to provide options even if they use
 too.
 .PP
 (This feature allows scripts to provide options even if they use
index 5cd1320..4e13663 100644 (file)
--- a/runlisp.c
+++ b/runlisp.c
@@ -199,7 +199,7 @@ static void usage(FILE *fp)
   fprintf(fp, "\
 usage:\n\
        %s [OPTIONS] [--] SCRIPT [ARGUMENTS ...]\n\
   fprintf(fp, "\
 usage:\n\
        %s [OPTIONS] [--] SCRIPT [ARGUMENTS ...]\n\
-       %s [OPTIONS] [-e EXPR] [-p EXPR] [-l FILE] [--] [ARGUMENTS ...]\n\
+       %s [OPTIONS] [-e EXPR] [-d EXPR] [-l FILE] [--] [ARGUMENTS ...]\n\
 OPTIONS:\n\
        [-CDEnqv] [+DEn] [-L SYS,SYS,...] [-c CONF] [-o [SECT:]VAR=VAL]\n",
          progname, progname);
 OPTIONS:\n\
        [-CDEnqv] [+DEn] [-L SYS,SYS,...] [-c CONF] [-o [SECT:]VAR=VAL]\n",
          progname, progname);
@@ -228,9 +228,9 @@ Lisp implementation selection:\n\
   -L, --accept-lisp=SYS,SYS,...        Only use the listed Lisp systems.\n\
 \n\
 Evaluation mode:\n\
   -L, --accept-lisp=SYS,SYS,...        Only use the listed Lisp systems.\n\
 \n\
 Evaluation mode:\n\
+  -d, --dump-expression=EXPR   Print (`prin1') EXPR (repeatable).\n\
   -e, --evaluate-expression=EXPR Evaluate EXPR for effect (repeatable).\n\
   -e, --evaluate-expression=EXPR Evaluate EXPR for effect (repeatable).\n\
-  -l, --load-file=FILE         Load FILE (repeatable).\n\
-  -p, --print-expression=EXPR  Print (`prin1') EXPR (repeatable).\n",
+  -l, --load-file=FILE         Load FILE (repeatable).\n",
        fp);
 }
 
        fp);
 }
 
@@ -257,6 +257,7 @@ static void parse_options(int argc, char *argv[])
     { "command-line-only",     OPTF_NEGATE,    0,      'E' },
     { "accept-lisp",           OPTF_ARGREQ,    0,      'L' },
     { "config-file",           OPTF_ARGREQ,    0,      'c' },
     { "command-line-only",     OPTF_NEGATE,    0,      'E' },
     { "accept-lisp",           OPTF_ARGREQ,    0,      'L' },
     { "config-file",           OPTF_ARGREQ,    0,      'c' },
+    { "dump-expression",       OPTF_ARGREQ,    0,      'd' },
     { "evaluate-expression",   OPTF_ARGREQ,    0,      'e' },
     { "load-file",             OPTF_ARGREQ,    0,      'l' },
     { "dry-run",               OPTF_NEGATE,    0,      'n' },
     { "evaluate-expression",   OPTF_ARGREQ,    0,      'e' },
     { "load-file",             OPTF_ARGREQ,    0,      'l' },
     { "dry-run",               OPTF_NEGATE,    0,      'n' },
@@ -280,7 +281,7 @@ static void parse_options(int argc, char *argv[])
 
   optarg = 0; optind = 0; optprog = (/*unconst*/ char *)progname;
   for (;;) {
 
   optarg = 0; optind = 0; optprog = (/*unconst*/ char *)progname;
   for (;;) {
-    i = mdwopt(argc, argv, "+hVD+E+L:c:e:l:n+o:p:qv", opts, 0, 0,
+    i = mdwopt(argc, argv, "+hVD+E+L:c:d:e:l:n+o:qv", opts, 0, 0,
               OPTF_NEGATION | OPTF_NOPROGNAME);
     if (i < 0) break;
     switch (i) {
               OPTF_NEGATION | OPTF_NOPROGNAME);
     if (i < 0) break;
     switch (i) {
@@ -293,11 +294,11 @@ static void parse_options(int argc, char *argv[])
                    offsetof(struct lispsys, next_accept));
        break;
       case 'c': CMDL; read_config_path(optarg, 0); flags |= AF_SETCONF; break;
                    offsetof(struct lispsys, next_accept));
        break;
       case 'c': CMDL; read_config_path(optarg, 0); flags |= AF_SETCONF; break;
+      case 'd': CMDL; push_eval_op('?', optarg); break;
       case 'e': CMDL; push_eval_op('!', optarg); break;
       case 'l': CMDL; push_eval_op('<', optarg); break;
       FLAGOPT('n', AF_DRYRUN, { CMDL; });
       case 'o': CMDL; if (set_config_var(optarg)) flags |= AF_BOGUS; break;
       case 'e': CMDL; push_eval_op('!', optarg); break;
       case 'l': CMDL; push_eval_op('<', optarg); break;
       FLAGOPT('n', AF_DRYRUN, { CMDL; });
       case 'o': CMDL; if (set_config_var(optarg)) flags |= AF_BOGUS; break;
-      case 'p': CMDL; push_eval_op('?', optarg); break;
       case 'q': CMDL; if (verbose) verbose--; break;
       case 'v': CMDL; verbose++; break;
       default: flags |= AF_BOGUS; break;
       case 'q': CMDL; if (verbose) verbose--; break;
       case 'v': CMDL; verbose++; break;
       default: flags |= AF_BOGUS; break;
index 867ae5e..73b13ae 100644 (file)
--- a/tests.at
+++ b/tests.at
@@ -210,7 +210,7 @@ AT_CHECK([RUNLISP_PATH -e '(format t "Just another Lisp hacker!~%")'],,
 
 ## The `:runlisp-script' keyword should /not/ be in `*features*'.
 traceon
 
 ## The `:runlisp-script' keyword should /not/ be in `*features*'.
 traceon
-AT_CHECK([RUNLISP_PATH -p '(find :runlisp-script *features*)'],, [NIL
+AT_CHECK([RUNLISP_PATH -d '(find :runlisp-script *features*)'],, [NIL
 ])
 
 ## Check a mixture of all the kinds of evaluation.  We'll need a stunt script
 ])
 
 ## Check a mixture of all the kinds of evaluation.  We'll need a stunt script
@@ -232,11 +232,11 @@ AT_CHECK([RUNLISP_PATH \
            -e '(defpackage [#:]runlisp-test (:export [#:]foo [#:]bar))
                (defvar runlisp-test:foo 1)
                (defvar runlisp-test:bar "stoat!")' \
            -e '(defpackage [#:]runlisp-test (:export [#:]foo [#:]bar))
                (defvar runlisp-test:foo 1)
                (defvar runlisp-test:bar "stoat!")' \
-           -p runlisp-test:foo \
-           -p runlisp-test:bar \
+           -d runlisp-test:foo \
+           -d runlisp-test:bar \
            -e '(incf runlisp-test:foo)' \
            -l script.lisp \
            -e '(incf runlisp-test:foo)' \
            -l script.lisp \
-           -p runlisp-test:foo \
+           -d runlisp-test:foo \
            -- -e one two three],,
 [1
 "stoat!"
            -- -e one two three],,
 [1
 "stoat!"
@@ -280,9 +280,9 @@ echo Secondary Lisp = $lisp1
 echo Bad Lisp = $badlisp
 
 ## Check that our selection worked.
 echo Bad Lisp = $badlisp
 
 ## Check that our selection worked.
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0 -p 'WHICH_LISP'],, ["$lisp0"NL])
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1 -p 'WHICH_LISP'],, ["$lisp1"NL])
-AT_CHECK([RUNLISP_PATH -L$badlisp -p 'WHICH_LISP'], [127],,
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0 -d 'WHICH_LISP'],, ["$lisp0"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1 -d 'WHICH_LISP'],, ["$lisp1"NL])
+AT_CHECK([RUNLISP_PATH -L$badlisp -d 'WHICH_LISP'], [127],,
         [runlisp: no acceptable Lisp systems found[]NL])
 
 ## Unset all of the user preference mechanisms.
         [runlisp: no acceptable Lisp systems found[]NL])
 
 ## Unset all of the user preference mechanisms.
@@ -291,9 +291,9 @@ mkdir HOME config
 HOME=$here/HOME XDG_CONFIG_HOME=$here/config; export HOME XDG_CONFIG_HOME
 
 ## We generally take the first one listed that exists.
 HOME=$here/HOME XDG_CONFIG_HOME=$here/config; export HOME XDG_CONFIG_HOME
 
 ## We generally take the first one listed that exists.
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0,$lisp1 -p 'WHICH_LISP'],, ["$lisp0"NL])
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1,$lisp0 -p 'WHICH_LISP'],, ["$lisp1"NL])
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$badlisp,$lisp0,$lisp1 -p 'WHICH_LISP'],,
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0,$lisp1 -d 'WHICH_LISP'],, ["$lisp0"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1,$lisp0 -d 'WHICH_LISP'],, ["$lisp1"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$badlisp,$lisp0,$lisp1 -d 'WHICH_LISP'],,
                  ["$lisp0"NL])
 
 ## Check parsing of embedded options.
                  ["$lisp0"NL])
 
 ## Check parsing of embedded options.