swconfig: add SWITCH_TYPE_LINK and support sending link info to user space
[openwrt/openwrt.git] / package / network / config / swconfig / src / cli.c
index 2eb73bea38dbfc20226a74e8cd27f10f8188da2d..d472086781365b1d441cea18a4bc2c9932557cc9 100644 (file)
@@ -178,7 +178,6 @@ swconfig_load_uci(struct switch_dev *dev, const char *name)
 {
        struct uci_context *ctx;
        struct uci_package *p = NULL;
-       struct uci_element *e;
        int ret = -1;
 
        ctx = uci_alloc_context();
@@ -206,7 +205,6 @@ int main(int argc, char **argv)
        struct switch_dev *dev;
        struct switch_attr *a;
        struct switch_val val;
-       int err;
        int i;
 
        int cmd = CMD_NONE;
@@ -272,7 +270,7 @@ int main(int argc, char **argv)
 
        dev = swlib_connect(cdev);
        if (!dev) {
-               fprintf(stderr, "Failed to connect to the switch\n");
+               fprintf(stderr, "Failed to connect to the switch. Use the \"list\" command to see which switches are available.\n");
                return 1;
        }
 
@@ -289,6 +287,7 @@ int main(int argc, char **argv)
                if(!a)
                {
                        fprintf(stderr, "Unknown attribute \"%s\"\n", ckey);
+                       retval = -1;
                        goto out;
                }
        }
@@ -351,5 +350,5 @@ int main(int argc, char **argv)
 
 out:
        swlib_free_all(dev);
-       return 0;
+       return retval;
 }