diff options
author | John Ankarström <john@ankarstrom.se> | 2021-06-07 16:36:05 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-06-08 01:50:54 +0200 |
commit | 7aaf4f2423e2bcabce508e91255de673db50b728 (patch) | |
tree | cfdfc247185d7a97fce6f96110fb964f00b766fe /misc.c | |
parent | 60b250c267e9ce69f428fd2f0f56a4b1a54f2004 (diff) | |
download | ksh-7aaf4f2423e2bcabce508e91255de673db50b728.tar.gz |
ksh will write lines to write-file containing information about
the status of the shell:
after prompt: empty line
after command entry: "cmd" followed by command
after cwd change: "cwd" followed by new cwd
fg is handled specially, printing a new "cmd" line with the original
command associated with the job.
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -347,7 +347,7 @@ parse_args(argv, what, setargsp) int what; /* OF_CMDLINE or OF_SET */ int *setargsp; { - static char cmd_opts[NELEM(goptions) + 3]; /* o:\0 */ + static char cmd_opts[NELEM(goptions) + 5]; /* o:w:\0 */ static char set_opts[NELEM(goptions) + 5]; /* Ao;s\0 */ char *opts; char *array = (char *) 0; @@ -359,7 +359,7 @@ parse_args(argv, what, setargsp) char *p, *q; /* see cmd_opts[] declaration */ - strlcpy(cmd_opts, "o:", sizeof cmd_opts); + strlcpy(cmd_opts, "o:w:", sizeof cmd_opts); p = cmd_opts + strlen(cmd_opts); /* see set_opts[] declaration */ strlcpy(set_opts, "A:o;s", sizeof set_opts); @@ -423,6 +423,14 @@ parse_args(argv, what, setargsp) } break; + case 'w': + writefd = open(go.optarg, O_WRONLY); + if (writefd == -1) { + bi_errorf("could not open %s", go.optarg); + return -1; + } + break; + case '?': return -1; |