3 * System definitions and capabilities.
4 * $Id: system.c,v 1.5 2004/11/14 02:45:51 cpressey Exp $
8 #include <sys/sysctl.h>
27 sysctl(mib, 2, NULL, &len, NULL, 0);
29 sysctl(mib, 2, p, &len, NULL, 0);
63 * Get transport from transport name.
65 * return(0) if transport is not supported.
66 * retirn(-1) if transport unknown.
69 get_transport(const char *transport_name)
71 if (strcmp(transport_name, "caps") == 0) {
73 return DFUI_TRANSPORT_CAPS;
75 } else if (strcmp(transport_name, "npipe") == 0) {
77 return DFUI_TRANSPORT_NPIPE;
79 } else if (strcmp(transport_name, "tcp") == 0) {
81 return DFUI_TRANSPORT_TCP;
88 * Get transport upon user request
90 * Print appropriate error message to stderr
91 * and exit if transport not supported or unknown.
94 user_get_transport(const char *transport_name)
98 transport = get_transport(transport_name);
100 if (transport == 0) {
101 errx(EX_UNAVAILABLE, "Transport is not supported: ``%s''.\n",
103 } else if (transport < 0) {
104 errx(EX_CONFIG, "Wrong transport name: ``%s''.\n",