summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-03-08 19:54:35 -0800
committerKaz Kylheku <kaz@kylheku.com>2017-03-08 19:54:35 -0800
commit4abffc416e2bc48547e7b8753643abce063dc729 (patch)
tree974759b74c7224e26dad66858b4f33d03640f0e3
parentfd87267eb4802d1e3ec3c22a48e09a86f76810ad (diff)
downloadtxr-4abffc416e2bc48547e7b8753643abce063dc729.tar.gz
txr-4abffc416e2bc48547e7b8753643abce063dc729.tar.bz2
txr-4abffc416e2bc48547e7b8753643abce063dc729.zip
Drop the annoying need for - for standard input.
* match.c (open_data_source): If there is nothing in the files array and data is t (indicating a request to open a data source), then use standard input. Subject to the compatibility option. * Makefile (txr-manpage.html): Drop use of the txr - argument in rule recipe. * txr.1: Document that - isn't necessary. Added to compatibility notes.
-rw-r--r--Makefile2
-rw-r--r--match.c10
-rw-r--r--txr.118
3 files changed, 28 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 1024cf04..deef23f8 100644
--- a/Makefile
+++ b/Makefile
@@ -443,7 +443,7 @@ install-tests:
# Generate web page from man page
#
txr-manpage.html: txr.1 genman.txr
- man2html $< | $(TXR) genman.txr - > $@
+ man2html $< | $(TXR) genman.txr > $@
txr-manpage.pdf: txr.1 checkman.txr
$(TXR) checkman.txr $<
diff --git a/match.c b/match.c
index ef758580..f183c509 100644
--- a/match.c
+++ b/match.c
@@ -4427,7 +4427,15 @@ static void open_data_source(match_files_ctx *c)
c->data = nil;
}
} else if (c->data == t && c->files == nil) {
- c->data = nil;
+ if (opt_compat && opt_compat <= 170) {
+ c->data = nil;
+ } else {
+ spec_bind (specline, first_spec, c->spec);
+ debuglf(first_spec, lit("opening standard input as data source"), nao);
+ c->curfile = lit("-");
+ c->data = lazy_stream_cons(std_input);
+ c->data_lineno = one;
+ }
}
}
diff --git a/txr.1 b/txr.1
index 02961abe..e1894f19 100644
--- a/txr.1
+++ b/txr.1
@@ -864,6 +864,12 @@ or one of the related options. A file argument consisting of a single
.code -
means to read the standard input instead of opening a file.
+Specifying standard input as a source with an explicit
+.code -
+argument is unnecessary. If no data source arguments are present, then
+\*(TX scans standard input by default. This was not true in versions of \*(TX
+prior to 171; see the COMPATIBILITY section.
+
.PP
\*(TX begins by reading the script. In the case of the \*(TX pattern language,
the entire query is scanned, internalized and then begins executing, if it is
@@ -52657,6 +52663,18 @@ of these version values, the described behaviors are provided if
is given an argument which is equal or lower. For instance
.code "-C 103"
selects the behaviors described below for version 105, but not those for 102.
+.IP 170
+A value of 170 or lower disables the behavior that \*(TX scans standard input
+when no input sources are specified on the command line. Standard input must
+be requested explicitly using the
+.code -
+argument. This is how it was in all versions of \*(TX up to 170.
+Some programs may behave differently because of this. Specifically, programs
+which do not take any arguments, and do not select an input source using the
+.code @(next)
+directive, or suppress the use of an input source using
+.codn "@(next nil)" ,
+may now accidentally read from standard input.
.IP 165
A value of 165 restores the following behaviors, which changed starting in 166.
There was a in Lisp evaluation support of the \*(TX pattern language.