*/
#include <stdio.h>
+#include <glob.h>
#include "iwinfo.h"
int main(int argc, char **argv)
{
int i;
+ char *p;
const struct iwinfo_ops *iw;
+ glob_t globbuf;
- if (argc < 3)
+ if (argc > 1 && argc < 3)
{
fprintf(stderr,
"Usage:\n"
return 1;
}
+ if (argc == 1)
+ {
+ glob("/sys/class/net/*", 0, NULL, &globbuf);
+
+ for (i = 0; i < globbuf.gl_pathc; i++)
+ {
+ p = strrchr(globbuf.gl_pathv[i], '/');
+
+ if (!p)
+ continue;
+
+ iw = iwinfo_backend(++p);
+
+ if (!iw)
+ continue;
+
+ print_info(iw, p);
+ printf("\n");
+ }
+
+ globfree(&globbuf);
+ return 0;
+ }
+
iw = iwinfo_backend(argv[1]);
if (!iw)