/* VTY shell pager name. */
char *vtysh_pager_name = NULL;
+/* VTY should add timestamp */
+bool vtysh_add_timestamp;
+
/* VTY shell client structure */
struct vtysh_client {
int fd;
}
}
+ if (vtysh_add_timestamp && strncmp(line, "exit", 4)) {
+ char ts[48];
+
+ (void)quagga_timestamp(3, ts, sizeof(ts));
+ vty_out(vty, "%% %s\n\n", ts);
+ }
+
saved_ret = ret = cmd_execute(vty, line, &cmd, 1);
saved_node = vty->node;
int vtysh_read_config(const char *config_default_dir, bool dry_run)
{
FILE *confp = NULL;
+ bool save;
int ret;
confp = fopen(config_default_dir, "r");
return CMD_ERR_NO_FILE;
}
+ save = vtysh_add_timestamp;
+ vtysh_add_timestamp = false;
+
ret = vtysh_read_file(confp, dry_run);
fclose(confp);
+ vtysh_add_timestamp = save;
+
return (ret);
}
{"writeconfig", no_argument, NULL, 'w'},
{"pathspace", required_argument, NULL, 'N'},
{"user", no_argument, NULL, 'u'},
+ {"timestamp", no_argument, NULL, 't'},
{0}};
/* Read a string, and return a pointer to it. Returns NULL on EOF. */
int opt;
int dryrun = 0;
int boot_flag = 0;
+ bool ts_flag = false;
const char *daemon_name = NULL;
const char *inputfile = NULL;
struct cmd_rec {
/* Option handling. */
while (1) {
- opt = getopt_long(argc, argv, "be:c:d:nf:H:mEhCwN:u", longopts,
+ opt = getopt_long(argc, argv, "be:c:d:nf:H:mEhCwN:ut", longopts,
0);
if (opt == EOF)
case 'u':
user_mode = 1;
break;
+ case 't':
+ ts_flag = true;
+ break;
case 'w':
writeconfig = 1;
break;
if (!user_mode)
vtysh_execute("enable");
+ vtysh_add_timestamp = ts_flag;
+
while (cmd != NULL) {
char *eol;
if (!user_mode)
vtysh_execute("enable");
+ vtysh_add_timestamp = ts_flag;
+
/* Preparation for longjmp() in sigtstp(). */
sigsetjmp(jmpbuf, 1);
jmpflag = 1;