Nit fixes: strncmp length fixes, usage info fixes/additions, spelling and white space fixes

This commit is contained in:
Carol Hebert 2008-06-10 21:48:28 +00:00
parent b3d5558a40
commit 1d3a7ff50a
11 changed files with 157 additions and 144 deletions

View File

@ -587,7 +587,7 @@ ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
break;
case 4:
{
printf( " Boot Info Acknoledge :\n");
printf( " Boot Info Acknowledge :\n");
if((rsp->data[3]&0x1f) != 0)
{
if((rsp->data[3]&0x10) == 0x10)

View File

@ -493,7 +493,7 @@ ipmi_ekanalyzer_main( struct ipmi_intf * intf, int argc, char ** argv )
if ( file_type[type_offset] != ERROR_STATUS ){
if ( file_type[type_offset] != CONFIG_FILE ){
/* because of strlen doesn't count '\0', we need to add 1 byte for
* this caracter to filename size
* this character to filename size
*/
filename[type_offset] = malloc( strlen(argv[argument_offset]) + 1
- SIZE_OF_FILE_TYPE

View File

@ -597,7 +597,7 @@ ipmi_event_usage(void)
lprintf(LOG_NOTICE, " Use the 'sel save' command to generate from SEL");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, "usage: event <sensorid> <state> [event_dir]");
lprintf(LOG_NOTICE, " sensorid : Sensor ID to use for event data");
lprintf(LOG_NOTICE, " sensorid : Sensor ID string to use for event data");
lprintf(LOG_NOTICE, " state : Sensor state, use 'list' to see possible states for sensor");
lprintf(LOG_NOTICE, " event_dir : assert, deassert [default=assert]");
lprintf(LOG_NOTICE, "");

View File

@ -49,9 +49,9 @@ printf_firewall_usage(void)
{
printf("Firmware Firewall Commands:\n");
printf("\tinfo [channel H] [lun L]\n");
printf("\tinfo [channel H] [lun L [netfn N [cmd C [subfn S]]]]\n");
printf("\tenable [channel H] [lun L [netfn N [cmd C [subfn S]]]]\n");
printf("\tdisable [channel H] [lun L [netfn N [cmd C [subfn S]]]] [force])\n");
printf("\tinfo [channel H] [lun L [netfn N [command C [subfn S]]]]\n");
printf("\tenable [channel H] [lun L [netfn N [command C [subfn S]]]]\n");
printf("\tdisable [channel H] [lun L [netfn N [command C [subfn S]]]] [force])\n");
printf("\treset [channel H] \n");
printf("\t\twhere H is a Channel, L is a LUN, N is a NetFn,\n");
printf("\t\tC is a Command and S is a Sub-Function\n");

View File

@ -1119,7 +1119,7 @@ static int ipmi_fru_picmg_ext_edit(uint8_t * fru_data,
}
printf(" Module Activation Rediness: %i sec.\n", fru_data[++offset]);
printf(" Module Activation Readiness: %i sec.\n", fru_data[++offset]);
printf(" Descriptor Count: %i\n", fru_data[++offset]);
printf("\n");
@ -2801,18 +2801,29 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
}
}
else if (!strncmp(argv[0], "edit", 4)) {
if ((argc >= 2) && (strncmp(argv[1], "help", 4) == 0)) {
lprintf(LOG_ERR, "edit commands:");
lprintf(LOG_ERR, " edit - interactively edit records");
lprintf(LOG_ERR,
" edit <fruid> field <section> <index> <string>" - edit FRU string);
lprintf(LOG_ERR,
" edit <fruid> oem iana <record> <format> <args>" - limited OEM support);
} else {
uint8_t fruId = 0;
if ((argc >= 2) && (strlen(argv[1]) > 0)) {
fruId = atoi(argv[1]);
if (verbose) {
printf("Fru Id : %d\n", fruId);
}
}else {
} else {
printf("Using default FRU id: %d\n", fruId);
}
if ((argc >= 3) && (strlen(argv[1]) > 0)) {
if (!strncmp(argv[2], "field", 4)){
if (!strncmp(argv[2], "field", 5)){
if (argc == 6) {
ipmi_fru_set_field_string(intf, fruId,\
*argv[3], *argv[4], (char *) argv[5]);
@ -2826,6 +2837,8 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
} else {
ipmi_fru_edit_multirec(intf,fruId, argc, argv);
}
}
}
else {
lprintf(LOG_ERR, "Invalid FRU command: %s", argv[0]);
@ -3005,7 +3018,7 @@ f_type, uint8_t f_index, char *f_string)
checksum = (~checksum) + 1;
fru_data[header_offset + fru_section_len - 1] = checksum;
/* Write te updated section to the FRU data */
/* Write the updated section to the FRU data */
if( write_fru_area(intf, &fru, fruId, header_offset,
header_offset, fru_section_len, fru_data) < 0 )
{

View File

@ -1256,8 +1256,8 @@ get_cmdline_ipaddr(char * arg, uint8_t * buf)
static void ipmi_lan_set_usage(void)
{
lprintf(LOG_NOTICE, "\nusage: lan set <channel> <command> [option]\n");
lprintf(LOG_NOTICE, "LAN set commands:");
lprintf(LOG_NOTICE, "\nusage: lan set <channel> <command> <parameter>\n");
lprintf(LOG_NOTICE, "LAN set command/parameter options:");
lprintf(LOG_NOTICE, " ipaddr <x.x.x.x> Set channel IP address");
lprintf(LOG_NOTICE, " netmask <x.x.x.x> Set channel IP netmask");
lprintf(LOG_NOTICE, " macaddr <x:x:x:x:x:x> Set channel MAC address");
@ -1722,21 +1722,22 @@ ipmi_lan_alert_print_all(struct ipmi_intf * intf, uint8_t channel)
static void
ipmi_lan_alert_print_usage(void)
{
lprintf(LOG_NOTICE, "\nusage: lan alert print [channel] [alert]\n");
lprintf(LOG_NOTICE, "\nusage: lan alert print [channel number] [alert destination]\n");
lprintf(LOG_NOTICE, "Default will print all alerts for the first found LAN channel");
}
static void
ipmi_lan_alert_set_usage(void)
{
lprintf(LOG_NOTICE, "\nusage: lan alert set <channel> <alert> <command> <option>\n");
lprintf(LOG_NOTICE, " ipaddr <x.x.x.x> Set alert IP address");
lprintf(LOG_NOTICE, " macaddr <x:x:x:x:x:x> Set alert MAC address");
lprintf(LOG_NOTICE, " gateway <default|backup> Set channel gateway to use for alerts");
lprintf(LOG_NOTICE, " ack <on|off> Set Alert Acknowledge on or off");
lprintf(LOG_NOTICE, " type <pet|oem1|oem2> Set destination type as PET or OEM");
lprintf(LOG_NOTICE, " time <seconds> Set ack timeout or unack retry interval");
lprintf(LOG_NOTICE, " retry <number> Set number of alert retries");
lprintf(LOG_NOTICE, "\nusage: lan alert set <channel number> <alert destination> <command> <parameter>\n");
lprintf(LOG_NOTICE, " Command/parameter options:\n");
lprintf(LOG_NOTICE, " ipaddr <x.x.x.x> Set alert IP address");
lprintf(LOG_NOTICE, " macaddr <x:x:x:x:x:x> Set alert MAC address");
lprintf(LOG_NOTICE, " gateway <default|backup> Set channel gateway to use for alerts");
lprintf(LOG_NOTICE, " ack <on|off> Set Alert Acknowledge on or off");
lprintf(LOG_NOTICE, " type <pet|oem1|oem2> Set destination type as PET or OEM");
lprintf(LOG_NOTICE, " time <seconds> Set ack timeout or unack retry interval");
lprintf(LOG_NOTICE, " retry <number> Set number of alert retries");
lprintf(LOG_NOTICE, "");
}
@ -1994,12 +1995,12 @@ ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_INFO, "Get LAN Stats command failed");
lprintf(LOG_ERR, "Get LAN Stats command failed");
return 0;
}
if (rsp->ccode > 0) {
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
lprintf(LOG_ERR, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return 0;
}
@ -2102,8 +2103,9 @@ print_lan_usage(void)
{
lprintf(LOG_NOTICE, "LAN Commands:");
lprintf(LOG_NOTICE, " print [<channel number>]");
lprintf(LOG_NOTICE, " set [<channel number>]");
lprintf(LOG_NOTICE, " alert [<channel number>]");
lprintf(LOG_NOTICE, " set <channel number> <command> <parameter>");
lprintf(LOG_NOTICE, " alert print <channel number> <alert destination>");
lprintf(LOG_NOTICE, " alert set <channel number> <alert destination> <command> <parameter>");
lprintf(LOG_NOTICE, " stats get [<channel number>]");
lprintf(LOG_NOTICE, " stats clear [<channel number>]");
}

View File

@ -759,7 +759,7 @@ ipmi_mc_main(struct ipmi_intf * intf, int argc, char ** argv)
else if (!strncmp(argv[0], "selftest", 8)) {
rc = ipmi_mc_get_selftest(intf);
}
else if (!strncmp(argv[0], "watchdog", 3)) {
else if (!strncmp(argv[0], "watchdog", 8)) {
if (argc < 2 || strncmp(argv[1], "help", 4) == 0) {
print_watchdog_usage();
}

View File

@ -233,8 +233,8 @@ ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsig
req.msg.data = (unsigned char*) &cmd;
req.msg.data_len = 3;
cmd.picmg_id = 0; /* PICMG identifier */
cmd.fru_id = (unsigned char) atoi(argv[0]); /* FRU ID */
cmd.picmg_id = 0; /* PICMG identifier */
cmd.fru_id = (unsigned char) atoi(argv[0]); /* FRU ID */
cmd.fru_state = state;
rsp = intf->sendrecv(intf, &req);
@ -958,10 +958,10 @@ ipmi_picmg_set_power_level(struct ipmi_intf * intf, int argc, char ** argv)
req.msg.data = msg_data;
req.msg.data_len = 4;
msg_data[0] = 0x00; /* PICMG identifier */
msg_data[1] = atoi(argv[0]); /* FRU-ID */
msg_data[2] = atoi(argv[1]); /* power level */
msg_data[3] = atoi(argv[2]); /* present to desired */
msg_data[0] = 0x00; /* PICMG identifier */
msg_data[1] = atoi(argv[0]); /* FRU-ID */
msg_data[2] = atoi(argv[1]); /* power level */
msg_data[3] = atoi(argv[2]); /* present to desired */
rsp = intf->sendrecv(intf, &req);
@ -989,13 +989,13 @@ ipmi_picmg_fru_control(struct ipmi_intf * intf, int argc, char ** argv)
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_PICMG;
req.msg.cmd = PICMG_FRU_CONTROL_CMD;
req.msg.cmd = PICMG_FRU_CONTROL_CMD;
req.msg.data = msg_data;
req.msg.data_len = 3;
msg_data[0] = 0x00; /* PICMG identifier */
msg_data[1] = atoi(argv[0]); /* FRU-ID */
msg_data[2] = atoi(argv[1]); /* control option */
msg_data[0] = 0x00; /* PICMG identifier */
msg_data[1] = atoi(argv[0]); /* FRU-ID */
msg_data[2] = atoi(argv[1]); /* control option */
printf("0: 0x%02x 1: 0x%02x\n\r", msg_data[1], msg_data[2]);
@ -1167,7 +1167,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
rc = ipmi_picmg_fru_control(intf, argc-1, &(argv[1]));
}
else {
printf("usage: frucontrol <FRU-ID><OPTION>\n");
printf("usage: frucontrol <FRU-ID> <OPTION>\n");
printf(" OPTION:\n");
printf(" 0x00 - Cold Reset\n");
printf(" 0x01 - Warm Reset\n");
@ -1211,113 +1211,111 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
rc = ipmi_picmg_fru_activation_policy_get(intf, argc-1, &(argv[2]));
} else {
printf("usage: get <fruid>\n");
}
} else if (!strncmp(argv[1], "set", 3)) {
if (argc > 4) {
rc = ipmi_picmg_fru_activation_policy_set(intf, argc-1, &(argv[2]));
} else {
printf("usage: set <fruid> <lockmask> <lock>\n");
}
} else if (!strncmp(argv[1], "set", 3)) {
if (argc > 4) {
rc = ipmi_picmg_fru_activation_policy_set(intf, argc-1, &(argv[2]));
} else {
printf("usage: set <fruid> <lockmask> <lock>\n");
printf(" lockmask: [1] affect the deactivation locked bit\n");
printf(" [0] affect the activation locked bit\n");
printf(" lock: [1] set/clear deactivation locked\n");
printf(" [0] set/clear locked \n");
}
}
else {
printf("specify fru\n");
return -1;
}
} else {
printf("wrong parameters\n");
return -1;
}
}
}
}
else {
printf("specify fru\n");
return -1;
}
} else {
printf("wrong parameters\n");
return -1;
}
}
/* portstate command */
else if (!strncmp(argv[0], "portstate", 9)) {
/* portstate command */
else if (!strncmp(argv[0], "portstate", 9)) {
lprintf(LOG_DEBUG,"PICMG: portstate API");
lprintf(LOG_DEBUG,"PICMG: portstate API");
if (argc > 1) {
if (!strncmp(argv[1], "get", 3)) {
if (argc > 1) {
if (!strncmp(argv[1], "get", 3)) {
int iface;
int channel ;
int iface;
int channel;
lprintf(LOG_DEBUG,"PICMG: get");
lprintf(LOG_DEBUG,"PICMG: get");
if(!strncmp(argv[1], "getall", 6)){
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++){
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++){
if(
!(( iface == FRU_PICMGEXT_DESIGN_IF_FABRIC )
&&
( channel > PICMG_EKEY_MAX_FABRIC_CHANNEL ) )
){
rc = ipmi_picmg_portstate_get(intf,iface,channel,
PICMG_EKEY_MODE_PRINT_ALL);
}
}
}
}
else if(!strncmp(argv[1], "getgranted", 10)){
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++){
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++){
rc = ipmi_picmg_portstate_get(intf,iface,channel,
PICMG_EKEY_MODE_PRINT_ENABLED);
}
}
}
else if(!strncmp(argv[1], "getdenied", 9)){
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++){
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++){
rc = ipmi_picmg_portstate_get(intf,iface,channel,
PICMG_EKEY_MODE_PRINT_DISABLED);
}
}
}
else if (argc > 3){
iface = atoi(argv[2]);
channel = atoi(argv[3]);
lprintf(LOG_DEBUG,"PICMG: requesting interface %d",iface);
lprintf(LOG_DEBUG,"PICMG: requesting channel %d",channel);
if(!strncmp(argv[1], "getall", 6)) {
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
if(!(( iface == FRU_PICMGEXT_DESIGN_IF_FABRIC ) &&
( channel > PICMG_EKEY_MAX_FABRIC_CHANNEL ) ))
{
rc = ipmi_picmg_portstate_get(intf,iface,channel,
PICMG_EKEY_MODE_PRINT_ALL);
}
}
}
}
else if(!strncmp(argv[1], "getgranted", 10)) {
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
rc = ipmi_picmg_portstate_get(intf,iface,channel,
PICMG_EKEY_MODE_PRINT_ENABLED);
}
}
}
else if(!strncmp(argv[1], "getdenied", 9)){
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
rc = ipmi_picmg_portstate_get(intf,iface,channel,
PICMG_EKEY_MODE_PRINT_DISABLED);
}
}
}
else if (argc > 3){
iface = atoi(argv[2]);
channel = atoi(argv[3]);
lprintf(LOG_DEBUG,"PICMG: requesting interface %d",iface);
lprintf(LOG_DEBUG,"PICMG: requesting channel %d",channel);
rc = ipmi_picmg_portstate_get(intf,iface,channel,
PICMG_EKEY_MODE_QUERY );
}
else {
printf("<intf> <chn>|getall|getgranted|getdenied\n");
}
}
else if (!strncmp(argv[1], "set", 3)) {
if (argc == 9) {
int interface = strtoul(argv[2], NULL, 0);
int channel = strtoul(argv[3], NULL, 0);
int port = strtoul(argv[4], NULL, 0);
int type = strtoul(argv[5], NULL, 0);
int typeext = strtoul(argv[6], NULL, 0);
int group = strtoul(argv[7], NULL, 0);
int enable = strtoul(argv[8], NULL, 0);
rc = ipmi_picmg_portstate_get(intf,iface,channel,
PICMG_EKEY_MODE_QUERY );
}
else {
printf("<intf> <chn>|getall|getgranted|getdenied\n");
}
}
else if (!strncmp(argv[1], "set", 3)) {
if (argc == 9) {
int interface = strtoul(argv[2], NULL, 0);
int channel = strtoul(argv[3], NULL, 0);
int port = strtoul(argv[4], NULL, 0);
int type = strtoul(argv[5], NULL, 0);
int typeext = strtoul(argv[6], NULL, 0);
int group = strtoul(argv[7], NULL, 0);
int enable = strtoul(argv[8], NULL, 0);
lprintf(LOG_DEBUG,"PICMG: interface %d",interface);
lprintf(LOG_DEBUG,"PICMG: channel %d",channel);
lprintf(LOG_DEBUG,"PICMG: port %d",port);
lprintf(LOG_DEBUG,"PICMG: type %d",type);
lprintf(LOG_DEBUG,"PICMG: typeext %d",typeext);
lprintf(LOG_DEBUG,"PICMG: group %d",group);
lprintf(LOG_DEBUG,"PICMG: enable %d",enable);
lprintf(LOG_DEBUG,"PICMG: interface %d",interface);
lprintf(LOG_DEBUG,"PICMG: channel %d",channel);
lprintf(LOG_DEBUG,"PICMG: port %d",port);
lprintf(LOG_DEBUG,"PICMG: type %d",type);
lprintf(LOG_DEBUG,"PICMG: typeext %d",typeext);
lprintf(LOG_DEBUG,"PICMG: group %d",group);
lprintf(LOG_DEBUG,"PICMG: enable %d",enable);
rc = ipmi_picmg_portstate_set(intf, interface, channel, port,
type, typeext ,group ,enable);
}
else {
printf("<intf> <chn> <port> <type> <ext> <group> <1|0>\n");
return -1;
}
}
}
else {
printf("<set>|<get>|<getall>|<getgranted>|<getdenied>\n");
rc = ipmi_picmg_portstate_set(intf, interface,
channel, port, type, typeext ,group ,enable);
}
else {
printf("<intf> <chn> <port> <type> <ext> <group> <1|0>\n");
return -1;
}
}
}
else {
printf("<set>|<getall>|<getgranted>|<getdenied>\n");
return -1;
}
}

View File

@ -154,7 +154,7 @@ ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv)
}
if( argc >= 4 ){
msize = (uint8_t)strtoul(argv[3], NULL, 0);
}
}
i2cbus = ((channel & 0xF) << 4) | ((i2cbus & 7) << 1) | 1;
@ -175,7 +175,7 @@ ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv)
static void rawi2c_usage(void)
{
lprintf(LOG_NOTICE, "usage: i2c [bus=public|# [chan=#]] <i2caddr> <read bytes> [write data]");
lprintf(LOG_NOTICE, "usage: i2c [bus=#| [chan=#] <i2caddr> <read bytes> [write data]");
lprintf(LOG_NOTICE, " bus=public is default");
lprintf(LOG_NOTICE, " chan=0 is default, bus= must be specified to use chan=");
}

View File

@ -4268,14 +4268,14 @@ ipmi_sdr_main(struct ipmi_intf *intf, int argc, char **argv)
rc = ipmi_sdr_print_entity(intf, argv[1]);
} else if (strncmp(argv[0], "info", 4) == 0) {
rc = ipmi_sdr_print_info(intf);
} else if (strncmp(argv[0], "get", 4) == 0) {
} else if (strncmp(argv[0], "get", 3) == 0) {
rc = ipmi_sdr_print_entry_byid(intf, argc - 1, &argv[1]);
} else if (strncmp(argv[0], "dump", 4) == 0) {
if (argc < 2)
lprintf(LOG_ERR, "usage: sdr dump <filename>");
else
rc = ipmi_sdr_dump_bin(intf, argv[1]);
} else if (strncmp(argv[0], "fill", 3) == 0) {
} else if (strncmp(argv[0], "fill", 4) == 0) {
if (argc <= 1) {
lprintf(LOG_ERR, "usage: sdr fill sensors");
lprintf(LOG_ERR, "usage: sdr fill file <filename>");
@ -4283,13 +4283,13 @@ ipmi_sdr_main(struct ipmi_intf *intf, int argc, char **argv)
} else if (strncmp(argv[1], "sensors", 7) == 0) {
rc = ipmi_sdr_add_from_sensors(intf, 21);
} else if (strncmp(argv[1], "file", 4) == 0) {
if (argc < 3) {
lprintf(LOG_ERR, "sdr fill: Missing filename");
rc = -1;
} else {
rc = ipmi_sdr_add_from_file(intf, argv[2]);
}
}
if (argc < 3) {
lprintf(LOG_ERR, "sdr fill: Missing filename");
rc = -1;
} else {
rc = ipmi_sdr_add_from_file(intf, argv[2]);
}
}
} else {
lprintf(LOG_ERR, "Invalid SDR command: %s", argv[0]);
rc = -1;

View File

@ -2158,7 +2158,7 @@ int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
if (strncmp(argv[1], "last", 4) == 0) {
sign = -1;
}
else if (strncmp(argv[1], "first", 6) != 0) {
else if (strncmp(argv[1], "first", 5) != 0) {
lprintf(LOG_ERR, "Unknown sel list option");
return -1;
}