diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2016-03-30 12:50:25 -0500 |
---|---|---|
committer | Luiz Otavio O Souza <luiz@netgate.com> | 2016-03-30 12:50:25 -0500 |
commit | cda345b593ec84d7abbf45b2ce284a9d7f53307c (patch) | |
tree | 7ad875acd35d7cd5a18a7676761b35e5385b1b0c /usr.bin/script | |
parent | c35924db4e1edd83f5a845760098fc8cbd7f7456 (diff) | |
parent | f08e8e5dd415880269fb4ce4cb2fd7bccefe336d (diff) | |
download | FreeBSD-src-cda345b593ec84d7abbf45b2ce284a9d7f53307c.zip FreeBSD-src-cda345b593ec84d7abbf45b2ce284a9d7f53307c.tar.gz |
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'usr.bin/script')
-rw-r--r-- | usr.bin/script/script.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index c990849..82a9b2e 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -74,7 +74,7 @@ static int child; static const char *fname; static char *fmfname; static int fflg, qflg, ttyflg; -static int usesleep, rawout; +static int usesleep, rawout, showexit; static struct termios tt; @@ -107,6 +107,7 @@ main(int argc, char *argv[]) flushtime = 30; fm_fd = -1; /* Shut up stupid "may be used uninitialized" GCC warning. (not needed w/clang) */ + showexit = 0; while ((ch = getopt(argc, argv, "adfkpqrt:")) != -1) switch(ch) { @@ -195,7 +196,8 @@ main(int argc, char *argv[]) (void)fprintf(fscript, "Script started on %s", ctime(&tvec)); if (argv[0]) { - fprintf(fscript, "command: "); + showexit = 1; + fprintf(fscript, "Command: "); for (k = 0 ; argv[k] ; ++k) fprintf(fscript, "%s%s", k ? " " : "", argv[k]); @@ -355,9 +357,13 @@ done(int eno) if (rawout) record(fscript, NULL, 0, 'e'); if (!qflg) { - if (!rawout) + if (!rawout) { + if (showexit) + (void)fprintf(fscript, "\nCommand exit status:" + " %d", eno); (void)fprintf(fscript,"\nScript done on %s", ctime(&tvec)); + } (void)printf("\nScript done, output file is %s\n", fname); if (fflg) { (void)printf("Filemon done, output file is %s\n", |