From 7e140a2c5f37c1a4a0e227217340cd29a54ddfbb Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Thu, 2 Sep 2004 21:32:24 +0000 Subject: [PATCH] add support for "set" command for setting up session variables in shell/exec, add support for help and up-arrow key in shell mode --- ipmitool/src/ipmitool.c | 126 +++++++++++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 15 deletions(-) diff --git a/ipmitool/src/ipmitool.c b/ipmitool/src/ipmitool.c index c1a545a..ad7f2a8 100644 --- a/ipmitool/src/ipmitool.c +++ b/ipmitool/src/ipmitool.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2003, 2004 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -77,16 +77,16 @@ int verbose = 0; extern const struct valstr ipmi_privlvl_vals[]; extern const struct valstr ipmi_authtype_session_vals[]; +static int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv); static int ipmi_exec_main(struct ipmi_intf * intf, int argc, char ** argv); static int ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv); +static int ipmi_delay_main(struct ipmi_intf * intf, int argc, char ** argv); struct ipmi_cmd { int (*func)(struct ipmi_intf * intf, int argc, char ** argv); char * name; char * desc; } ipmi_cmd_list[] = { - { ipmi_shell_main, "shell", "Launch interactive IPMI shell" }, - { ipmi_exec_main, "exec", "Run list of commands from file" }, { ipmi_raw_main, "raw", "Send a RAW IPMI request and print response" }, { ipmi_lanp_main, "lan", "Configure LAN Channels" }, { ipmi_chassis_main, "chassis", "Get chassis status and set power state" }, @@ -101,6 +101,10 @@ struct ipmi_cmd { { ipmi_user_main, "user", "Configure BMC users" }, { ipmi_channel_main, "channel", "Configure BMC channels" }, { ipmi_session_main, "session", "Print session information" }, + { ipmi_shell_main, "shell", "Launch interactive IPMI shell" }, + { ipmi_exec_main, "exec", "Run list of commands from file" }, + { ipmi_set_main, "set", "Set runtime variable for shell and exec" }, + { ipmi_delay_main, "delay", NULL }, { NULL }, }; @@ -108,8 +112,11 @@ void ipmi_cmd_print(void) { struct ipmi_cmd * cmd; printf("Commands:\n"); - for (cmd=ipmi_cmd_list; cmd->func; cmd++) + for (cmd=ipmi_cmd_list; cmd->func; cmd++) { + if (!cmd->desc) + continue; printf("\t%-12s %s\n", cmd->name, cmd->desc); + } printf("\n"); } @@ -142,7 +149,7 @@ static void usage(void) printf(" -V Show version information\n"); printf(" -v Verbose (can use multiple times)\n"); printf(" -c Display output in comma separated format\n"); - printf(" -I intf Inteface to use\n"); + printf(" -I intf Interface to use\n"); printf(" -H hostname Remote host name for LAN interface\n"); printf(" -p port Remote RMCP port [default=623]\n"); printf(" -L level Remote session privilege level [default=USER]\n"); @@ -192,6 +199,82 @@ static char * ipmi_password_file_read(char * filename) return pass; } +static void ipmi_set_usage(void) +{ + printf("Usage: set