summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Naumov <alexander_naumov@opensuse.org>2017-01-21 01:08:36 +0100
committerAlexander Naumov <alexander_naumov@opensuse.org>2017-01-21 01:08:36 +0100
commitc14e05e7c36c64d85198ed0fc89177427ece48d4 (patch)
tree6c9db8318cfd0db0d60610f01b9cf78856ec2a70
parent285868e0e4a46cf50ccbc325b08217ffe3b8c94d (diff)
downloadscreen-c14e05e7c36c64d85198ed0fc89177427ece48d4.tar.gz
Ignore logfile's name that begins with the "-" symbol
This fixes API: To enable logging we use -L option. But in case of default logfile name (screenlog.0) we will need to define it anyway. Because screen will try to interpret next option as a parameter for -L option (which is logfile name). It will fails ALWAYS, because next parameter will always start with "-" symbol... what is not permited for logfile name of course. For example: $ screen -L -D -m ./configure In this case logfile name is screenlog.0, because "-D" will not be interpreted by screen as a name of logfile. Signed-off-by: Alexander Naumov <alexander_naumov@opensuse.org>
-rw-r--r--src/doc/screen.14
-rw-r--r--src/doc/screen.texinfo4
-rw-r--r--src/screen.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/doc/screen.1 b/src/doc/screen.1
index 23b4d7b..eabd763 100644
--- a/src/doc/screen.1
+++ b/src/doc/screen.1
@@ -262,8 +262,8 @@ Ask your system administrator if you are not sure. Remove sessions with the
tells
.I screen
to turn on automatic output logging for the windows. By default, logfile's name
-is screenlog.1. You can sets new name: add it right after -L option e.g. "screen
--L my_logfile".
+is screenlog.0. You can set new name: add it right after -L option e.g. "screen
+-L my_logfile". Keep in mind that name can not start with "-" symbol.
.TP 5
.B \-m
causes
diff --git a/src/doc/screen.texinfo b/src/doc/screen.texinfo
index 2ff39b0..c94993e 100644
--- a/src/doc/screen.texinfo
+++ b/src/doc/screen.texinfo
@@ -334,7 +334,9 @@ Remove sessions with the @samp{-wipe} option.
@item -L
Tell @code{screen} to turn on automatic output logging for the
-windows.
+windows. By default, logfile's name is screenlog.0. You can set new name:
+add it right after -L option e.g. "screen -L my_logfile". Keep in mind
+that name can not start with "-" symbol.
@item -m
Tell @code{screen} to ignore the @code{$STY} environment variable. When
diff --git a/src/screen.c b/src/screen.c
index e7a6cd2..5cf23e1 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -670,7 +670,7 @@ int main(int ac, char** av)
if (--ac != 0) {
screenlogfile = SaveStr(*++av);
if (screenlogfile[0] == '-')
- Panic(0, "-L: logfile name can not start with \"-\" symbol");
+ screenlogfile = SaveStr("screenlog.%n");
if (strlen(screenlogfile) > PATH_MAX)
Panic(0, "-L: logfile name too long. (max. %d char)", PATH_MAX);