Ticket #1336: madwifi-0.9.3-debug-usability-enhancement.2.diff
| File madwifi-0.9.3-debug-usability-enhancement.2.diff, 2.9 kB (added by mtaylor, 5 years ago) |
|---|
-
madwifi/tools/athdebug.c
old new 212 212 snprintf(oid, sizeof(oid), "dev.ath.%s.debug", ifname+3); 213 213 #endif 214 214 debuglen = sizeof(debug); 215 if (sysctlbyname(oid, &debug, &debuglen, NULL, 0) < 0) 216 err(1, "sysctl-get(%s)", oid); 215 if (sysctlbyname(oid, &debug, &debuglen, NULL, 0) < 0) { 216 if (argc <= 1) 217 usage(); /* no user input, device not found - show usage instead of error message */ 218 else 219 err(1, "sysctl-get(%s)", oid); /* user specified arguments indicating a command, show error message */ 220 } 217 221 ndebug = debug; 218 222 for (; argc > 1; argc--, argv++) { 219 223 cp = argv[1]; … … 262 267 sep = ","; 263 268 } 264 269 printf("%s\n", *sep != '<' ? ">" : ""); 270 printf("Details:\n"); 271 for (i = 0; i < N(flags); i++) 272 printf("%12s %s 0x%08x - %s\n", flags[i].name, debug & flags[i].bit ? "+" : " ", flags[i].bit, flags[i].desc); 273 exit(-1); 265 274 return 0; 266 275 } -
madwifi/tools/80211debug.c
old new 208 208 snprintf(oid, sizeof(oid), "dev.wlan.%s.debug", ifname+4); 209 209 #endif 210 210 debuglen = sizeof(debug); 211 if (sysctlbyname(oid, &debug, &debuglen, NULL, 0) < 0) 212 err(1, "sysctl-get(%s)", oid); 211 if (sysctlbyname(oid, &debug, &debuglen, NULL, 0) < 0) { 212 if (argc <= 1) 213 usage(); /* no user input, device not found - show usage instead of error message */ 214 else 215 err(1, "sysctl-get(%s)", oid); /* user specified arguments indicating a command, show error message */ 216 } 213 217 ndebug = debug; 214 218 for (; argc > 1; argc--, argv++) { 215 219 cp = argv[1]; … … 258 262 sep = ","; 259 263 } 260 264 printf("%s\n", *sep != '<' ? ">" : ""); 265 printf("Details:\n"); 266 for (i = 0; i < N(flags); i++) 267 printf("%12s %s 0x%08x - %s\n", flags[i].name, debug & flags[i].bit ? "+" : " ", flags[i].bit, flags[i].desc); 261 268 return 0; 262 269 } 263 270
