meshlink_node_t *node = meshlink_get_node(mesh, arg);
if(!node) {
- fprintf(stderr, "Unknown node '%s'\n", arg);
+ fprintf(stderr, "Error looking up '%s': %s\n", arg, meshlink_strerror(meshlink_errno));
return;
}
if(!arg) {
nodes = meshlink_get_all_nodes(mesh, nodes, &nnodes);
if(!nnodes) {
- fprintf(stderr, "No nodes known!\n");
+ fprintf(stderr, "Could not get list of nodes: %s\n", meshlink_strerror(meshlink_errno));
} else {
- printf("Known nodes:");
+ printf("%zu known nodes:", nnodes);
for(int i = 0; i < nnodes; i++)
printf(" %s", nodes[i]->name);
printf("\n");
} else {
meshlink_node_t *node = meshlink_get_node(mesh, arg);
if(!node) {
- fprintf(stderr, "Unknown node '%s'\n", arg);
+ fprintf(stderr, "Error looking up '%s': %s\n", arg, meshlink_strerror(meshlink_errno));
} else {
printf("Node %s found\n", arg);
}
destination = meshlink_get_node(mesh, buf);
if(!destination) {
- fprintf(stderr, "Unknown node '%s'\n", buf);
+ fprintf(stderr, "Error looking up '%s': %s\n", buf, meshlink_strerror(meshlink_errno));
return;
}
}
meshlink_handle_t *mesh = meshlink_open(confbase, nick);
if(!mesh) {
- fprintf(stderr, "Could not open MeshLink!\n");
+ fprintf(stderr, "Could not open MeshLink: %s\n", meshlink_strerror(meshlink_errno));
return 1;
}
meshlink::node *node = mesh->get_node(arg);
if(!node) {
- fprintf(stderr, "Unknown node '%s'\n", arg);
+ fprintf(stderr, "Error looking up '%s': %s\n", arg, meshlink::strerror());
return;
}
} else if(!strcasecmp(buf, "who")) {
if(!arg) {
nodes = mesh->get_all_nodes(nodes, &nnodes);
- if(!nnodes) {
- fprintf(stderr, "No nodes known!\n");
+ if(!nodes) {
+ fprintf(stderr, "Could not get list of nodes: %s\n", meshlink::strerror());
} else {
- printf("Known nodes:");
+ printf("%d known nodes:", nnodes);
for(size_t i = 0; i < nnodes; i++)
printf(" %s", nodes[i]->name);
printf("\n");
} else {
meshlink::node *node = mesh->get_node(arg);
if(!node) {
- fprintf(stderr, "Unknown node '%s'\n", arg);
+ fprintf(stderr, "Error looking up '%s': %s\n", arg, meshlink::strerror());
} else {
printf("Node %s found\n", arg);
}
destination = mesh->get_node(buf);
if(!destination) {
- fprintf(stderr, "Unknown node '%s'\n", buf);
+ fprintf(stderr, "Error looking up '%s': %s\n", buf, meshlink::strerror());
return;
}
}
meshlink::mesh *mesh = meshlink::open(confbase, nick);
if(!mesh) {
- fprintf(stderr, "Could not open MeshLink!\n");
+ fprintf(stderr, "Could not open MeshLink: %s\n", meshlink::strerror());
return 1;
}