summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-03-29 13:16:46 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-03-29 13:16:46 -0700
commitc6e5383217c70914a933f1911bf48a1e54b26595 (patch)
tree5e40a74c23c75fc2bd786490732682618585ec9e /txr.c
parent084bde656bac142bba5311b519c7bb78e2c45dad (diff)
downloadtxr-c6e5383217c70914a933f1911bf48a1e54b26595.tar.gz
txr-c6e5383217c70914a933f1911bf48a1e54b26595.tar.bz2
txr-c6e5383217c70914a933f1911bf48a1e54b26595.zip
New -n option. New "i" mode letter in file opening functions.
* stream.c (struct stdio_mode): New struct type. (stdio_mode_init_trivial): New initializer macro. (parse_mode, format_mode, normalize_mode, set_mode_props): New static functions. (make_stdio_stream_common): the isatty check, and automatic marking of tty device streams as real-time is no longer done, unless backward compatibility 105 or earlier is requested. (open_file, open_tail, open_command, open_process): Use new mode parsing, which supports the "i" flag. (stream_init): If we have isatty, and standard input is a tty, then mark the *std-input* stream as real-time. * txr.1: Document -n/--noninteractive option. Fix typo where real-time-stream-p is referred to as stream-real-time-p. Document "i" flag on open-file and others. * txr.c (opt_noninteractive): New global. (help): Help text for -n/--noninteractive. (txr_main): Handle new options. * txr.h (opt_noninteractive): Declared.
Diffstat (limited to 'txr.c')
-rw-r--r--txr.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/txr.c b/txr.c
index d0e97a42..7a774b69 100644
--- a/txr.c
+++ b/txr.c
@@ -60,6 +60,7 @@ const wchli_t *version = wli(TXR_VER);
const wchar_t *progname = L"txr";
static const char *progname_u8;
static val progpath = nil;
+int opt_noninteractive;
int opt_compat;
/*
@@ -111,6 +112,8 @@ static void help(void)
" if termination is unsuccessful.\n"
"-l If dumping bindings, use TXR Lisp format.\n"
"-d Debugger mode.\n"
+"-n Noninteractive input mode for standard input stream,\n"
+" even if its connected to a terminal device.\n"
"-a N Generate array variables up to N dimensions.\n"
" N is a decimal integer. The default value is 1.\n"
" Additional dimensions beyond N are fudged\n"
@@ -137,6 +140,7 @@ static void help(void)
" section at the bottom of the license.\n"
"--lisp-bindings Synonym for -l\n"
"--debugger Synonym for -d\n"
+"--noninteractive Synonym for -n\n"
"--compat=N Synonym for -C N\n"
"--gc-delta=N Invoke garbage collection when malloc activity\n"
" increments by N megabytes since last collection.\n"
@@ -499,6 +503,10 @@ int txr_main(int argc, char **argv)
prog_string, arg, nao);
return EXIT_FAILURE;
#endif
+ } else if (equal(opt, lit("noninteractive"))) {
+ opt_noninteractive = 1;
+ stream_set_prop(std_input, real_time_k, nil);
+ continue;
}
}
@@ -587,6 +595,10 @@ int txr_main(int argc, char **argv)
return EXIT_FAILURE;
#endif
break;
+ case 'n':
+ opt_noninteractive = 1;
+ stream_set_prop(std_input, real_time_k, nil);
+ break;
case 'a':
case 'c':
case 'e':