int ipmi_kontronoem_main(struct ipmi_intf *intf, int argc, char **argv) { int rc = 0; if (argc == 0) { lprintf(LOG_ERR, "Not enough parameters given."); ipmi_kontron_help(); return (-1); } if (strncmp(argv[0], "help", 4) == 0) { ipmi_kontron_help(); rc = 0; } else if (!strncmp(argv[0], "setsn", 5)) { if (argc < 1) { printf("fru setsn\n"); return (-1); } if (ipmi_kontron_set_serial_number(intf) > 0) { printf("FRU serial number setted successfully\n"); } else { printf("FRU serial number set failed\n"); rc = (-1); } } else if (!strncmp(argv[0], "setmfgdate", 10)) { if (argc < 1) { printf("fru setmfgdate\n"); return (-1); } if (ipmi_kontron_set_mfg_date(intf) > 0) { printf("FRU manufacturing date setted successfully\n"); } else { printf("FRU manufacturing date set failed\n"); rc = (-1); } } else if (!strncmp(argv[0], "nextboot", 8)) { if (argc < 2) { lprintf(LOG_ERR, "Not enough parameters given."); ipmi_kontron_nextboot_help(); return (-1); } rc = ipmi_kontron_nextboot_set(intf, (argc - 1), (argv + 1)); if (rc == 0) { printf("Nextboot set successfully\n"); } else { printf("Nextboot set failed\n"); rc = (-1); } } else { lprintf(LOG_ERR, "Invalid Kontron command: %s", argv[0]); ipmi_kontron_help(); rc = (-1); } return rc; }
int ipmi_kontronoem_main(struct ipmi_intf * intf, int argc, char ** argv) { int rc = 0; if (argc == 0) ipmi_kontron_help(); else if (strncmp(argv[0], "help", 4) == 0) ipmi_kontron_help(); else if (!strncmp(argv[0], "setsn", 5)) { if(argc >= 1) { if(ipmi_kontron_set_serial_number(intf) > 0) { printf("FRU serial number setted successfully\n"); } else { printf("FRU serial number set failed\n"); } } else { printf("fru setsn\n"); } } else if (!strncmp(argv[0], "setmfgdate", 5)) { if(argc >= 1) { if(ipmi_kontron_set_mfg_date(intf) > 0) { printf("FRU manufacturing date setted successfully\n"); } else { printf("FRU manufacturing date set failed\n"); } } else { printf("fru setmfgdate\n"); } } else if (!strncmp(argv[0], "nextboot", sizeof("nextboot")-1)) { if (argc > 1) { if ((rc = ipmi_kontron_nextboot_set(intf, argc-1, argv+1)) == 0) { printf("Nextboot set successfully\n"); } else { printf("Nextboot set failed\n"); } } else { ipmi_kontron_nextboot_help(); } } else { printf("Invalid Kontron command: %s", argv[0]); ipmi_kontron_help(); rc = -1; } return rc; }