commit ddb6f58b357a44d4dee8918f2e80ce93da05c6ec
parent d4c15896696e818486e36db01462b328ac84117c
Author: Ohad Ben-Cohen <ohad@wizery.com>
Date: Tue, 1 Mar 2011 23:53:09 +0200
allow user to specify the logfile name (but keep the default console.log)
History is sometimes priceless, so when things heat up, I tend to fire up debugging sessions using different logfiles.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sconsole.c b/sconsole.c
@@ -134,6 +134,7 @@ int main(int argc, char *argv[])
struct pollfd fds[2];
int speed = B115200;
const char *device = "/dev/ttyUSB0";
+ const char *logfile = "console.log";
int fd, n;
int escape = 0;
int logfd = -1;
@@ -156,7 +157,9 @@ int main(int argc, char *argv[])
break;
case 'l':
/* log */
- logfd = open("console.log", O_CREAT | O_WRONLY, 0644);
+ if (argv[1][2])
+ logfile = &argv[1][2];
+ logfd = open(logfile, O_CREAT | O_WRONLY, 0644);
break;
default:
fprintf(stderr, "unknown option %s\n", argv[1]);