diff options
author | James Booth <boothj5@gmail.com> | 2014-04-13 22:20:15 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-04-13 22:20:15 +0100 |
commit | 67a109927cbb70f48198f4516c330c157bfc209a (patch) | |
tree | 53681754ec1993f0e1128d2373084a5ff09f450c /src/command | |
parent | c3418a290959a6b128c6224ccd01562850ae98c0 (diff) | |
download | profani-tty-67a109927cbb70f48198f4516c330c157bfc209a.tar.gz |
Added /log where command
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 4 | ||||
-rw-r--r-- | src/command/commands.c | 22 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/command/command.c b/src/command/command.c index 240a4ad6..5175a16b 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -639,10 +639,11 @@ static struct cmd_t command_defs[] = NULL } } }, { "/log", - cmd_log, parse_args, 2, 2, &cons_log_setting, + cmd_log, parse_args, 1, 2, &cons_log_setting, { "/log [property] [value]", "Manage system logging settings.", { "/log [property] [value]", "-----------------------", + "where : Show the current log file location.", "Property may be one of:", "rotate : Rotate log, accepts 'on' or 'off', defaults to 'on'.", "maxsize : With rotate enabled, specifies the max log size, defaults to 1048580 (1MB).", @@ -955,6 +956,7 @@ cmd_init(void) autocomplete_add(log_ac, "maxsize"); autocomplete_add(log_ac, "rotate"); autocomplete_add(log_ac, "shared"); + autocomplete_add(log_ac, "where"); autoaway_ac = autocomplete_new(); autocomplete_add(autoaway_ac, "mode"); diff --git a/src/command/commands.c b/src/command/commands.c index bebf9d3c..0fc8574b 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2287,6 +2287,10 @@ cmd_log(gchar **args, struct cmd_help_t help) int intval; if (strcmp(subcmd, "maxsize") == 0) { + if (value == NULL) { + cons_show("Usage: %s", help.usage); + return TRUE; + } if (_strtoi(value, &intval, PREFS_MIN_LOG_SIZE, INT_MAX) == 0) { prefs_set_max_log_size(intval); cons_show("Log maxinum size set to %d bytes", intval); @@ -2298,22 +2302,24 @@ cmd_log(gchar **args, struct cmd_help_t help) if (value == NULL) { cons_show("Usage: %s", help.usage); return TRUE; - } else { - return _cmd_set_boolean_preference(value, help, - "Log rotate", PREF_LOG_ROTATE); } + return _cmd_set_boolean_preference(value, help, "Log rotate", PREF_LOG_ROTATE); } if (strcmp(subcmd, "shared") == 0) { if (value == NULL) { cons_show("Usage: %s", help.usage); return TRUE; - } else { - gboolean result = _cmd_set_boolean_preference(value, help, - "Shared log", PREF_LOG_SHARED); - log_reinit(); - return result; } + gboolean result = _cmd_set_boolean_preference(value, help, "Shared log", PREF_LOG_SHARED); + log_reinit(); + return result; + } + + if (strcmp(subcmd, "where") == 0) { + char *logfile = get_log_file_location(); + cons_show("Log file: %s", logfile); + return TRUE; } cons_show("Usage: %s", help.usage); |