diff options
author | Kipling Inscore <kinscore@synaptics.com> | 2010-04-01 15:53:29 -0400 |
---|---|---|
committer | Sadrul Habib Chowdhury <sadrul@users.sourceforge.net> | 2010-04-01 15:53:29 -0400 |
commit | fd8832ccdbf807fe9a6ecd04d6166191c3b7ae90 (patch) | |
tree | f9abd86c1066e1a0ca0e9ab47cbd4cbe5dc9bcf9 | |
parent | a881bb274ae2d3c4027ae61e1707576bc8d35cab (diff) | |
download | screen-fd8832ccdbf807fe9a6ecd04d6166191c3b7ae90.tar.gz |
Fix 'hardcopy -h'.
Make -h save scrollback with or without a file name given. Also,
preserve the unlikely case in which someone actually does want to
save display to '-h'; with
:hardcopy -- -h
or, to save both history and display to '-h'
:hardcopy -h -h
Also,
:hardcopy --
:hardcopy -h --
will, as they always have, save display or history and display to
'--'.
-rw-r--r-- | src/ChangeLog | 1 | ||||
-rw-r--r-- | src/process.c | 20 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b877ebc..c2e356f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -107,6 +107,7 @@ Version 4.1.0 (??/??/20??): * Romain Francoise <romain@orebokech.com> * Emanuele Giaquinta <e.giaquinta@glauco.it> * Yi-Hsuan Hsin <mhsin@mhsin.org> + * Kipling Inscore <kinscore@synaptics.com> * Chris Jones <cjns1989@gmail.com> * Max Kalashnikov <mmt@maxkalashnikov.com> * Steve Kemp <steve@steve.org.uk> diff --git a/src/process.c b/src/process.c index cc2b56f..783fdd7 100644 --- a/src/process.c +++ b/src/process.c @@ -1271,14 +1271,22 @@ int key; case RC_HARDCOPY: { int mode = DUMP_HARDCOPY; + char *file = NULL; - if (argc > 1 && !strcmp(*args, "-h")) + if (args[0]) { - mode = DUMP_SCROLLBACK; - args++; - argc--; + if (!strcmp(*args, "-h")) + { + mode = DUMP_SCROLLBACK; + file = args[1]; + } + else if (!strcmp(*args, "--") && args[1]) + file = args[1]; + else + file = args[0]; } - if (*args && args[1]) + + if (args[0] && file == args[0] && args[1]) { OutputMsg(0, "%s: hardcopy: too many arguments", rc_name); break; @@ -1286,7 +1294,7 @@ int key; if (fore == 0 && *args == 0) OutputMsg(0, "%s: hardcopy: window required", rc_name); else - WriteFile(user, *args, mode); + WriteFile(user, file, mode); } break; case RC_DEFLOG: |