Author: tjansen Date: Thu Nov 26 14:09:39 2009 New Revision: 1793 Log: Fixed error handling in pisa{c,s}dconf. Modified: trunk/libpisa/pisaconf.c trunk/pisacd/pisaconftool.c trunk/pisasd/pisaconftool.c Modified: trunk/libpisa/pisaconf.c ============================================================================== --- trunk/libpisa/pisaconf.c Thu Nov 26 14:00:07 2009 (r1792) +++ trunk/libpisa/pisaconf.c Thu Nov 26 14:09:39 2009 (r1793) @@ -194,7 +194,7 @@ return 0; } -char pisa_conf_usage_common[] = +const char *pisa_conf_usage_common = "Common options:\n" "\tdebuglevel\t: Set the debug level to 'all', 'medium', 'none'.\n" "\tdebugmask\t: 'set', 'add' or 'del' bits in the debugmask.\n" Modified: trunk/pisacd/pisaconftool.c ============================================================================== --- trunk/pisacd/pisaconftool.c Thu Nov 26 14:00:07 2009 (r1792) +++ trunk/pisacd/pisaconftool.c Thu Nov 26 14:09:39 2009 (r1793) @@ -25,16 +25,12 @@ int main(int argc, char *argv[]) { + int result; + pisa_conf_dst_port = PISA_CONF_PORT_CD; - switch (pisa_cdconf_parse(argc - 1, &argv[1]) == 1) { - case 1: - PISA_ERROR("Usage:\n\n%s%s", pisa_conf_usage_common, - usage_text); - return 1; - case 2: - return 2; - } + if ((result = pisa_cdconf_parse(argc - 1, &argv[1])) == 1) + PISA_ERROR("Usage:\n\n%s%s", pisa_conf_usage_common, usage_text); - return 0; + return result; } Modified: trunk/pisasd/pisaconftool.c ============================================================================== --- trunk/pisasd/pisaconftool.c Thu Nov 26 14:00:07 2009 (r1792) +++ trunk/pisasd/pisaconftool.c Thu Nov 26 14:09:39 2009 (r1793) @@ -25,16 +25,12 @@ int main(int argc, char *argv[]) { + int result; + pisa_conf_dst_port = PISA_CONF_PORT_SD; - switch (pisa_sdconf_parse(argc - 1, &argv[1]) == 1) { - case 1: - PISA_ERROR("Usage:\n\n%s%s", pisa_conf_usage_common, - usage_text); - return 1; - case 2: - return 2; - } + if ((result = pisa_sdconf_parse(argc - 1, &argv[1])) == 1) + PISA_ERROR("Usage:\n\n%s%s", pisa_conf_usage_common, usage_text); - return 0; + return result; }