diff -u --new-file --recursive node-0.3.0/command.c node-0.3.0-pe1jpd/command.c --- node-0.3.0/command.c Sun Jun 6 22:24:34 1999 +++ node-0.3.0-pe1jpd/command.c Thu May 17 23:39:00 2001 @@ -451,6 +451,17 @@ return 0; } +int jpd_find_node(char *s, char *p) +{ + while(*s && *p) { + if (*p=='*') + return TRUE; + if (*s++!=toupper(*p++)) + return FALSE; + } + return FALSE; +} + int do_nodes(int argc, char **argv) { struct proc_nr_nodes *p, *list; @@ -480,11 +491,62 @@ node_perror("do_nodes: read_proc_nr_neigh", errno); return 0; } - /* "nodes *" */ - if (*argv[1] == '*') { + /* "nodes " */ + if (*argv[1]=='*') + goto skip; + + p = find_node(argv[1], list); + if (p != NULL && p->n == 0) { + node_msg("%s is a local node", print_node(p->alias, p->call)); + } else if (p != NULL) { + node_msg("Routes to: %s", print_node(p->alias, p->call)); + nprintf("Which Quality Obsolescence Port Neighbour\n"); + if (p->n > 0 && (np = find_neigh(p->addr1, nlist)) != NULL) { + nprintf("%c %-7d %-12d %-6s %s\n", + p->w == 1 ? '>' : ' ', + p->qual1, p->obs1, + ax25_config_get_name(np->dev), + np->call); + } + if (p->n > 1 && (np = find_neigh(p->addr2, nlist)) != NULL) { + nprintf("%c %-7d %-12d %-6s %s\n", + p->w == 2 ? '>' : ' ', + p->qual2, p->obs2, + ax25_config_get_name(np->dev), + np->call); + } + if (p->n > 1 && (np = find_neigh(p->addr3, nlist)) != NULL) { + nprintf("%c %-7d %-12d %-6s %s\n", + p->w == 3 ? '>' : ' ', + p->qual3, p->obs3, + ax25_config_get_name(np->dev), + np->call); + } + free_proc_nr_nodes(list); + free_proc_nr_neigh(nlist); + return 0; + } +skip: /* "nodes " */ + if (argc == 2) { + node_msg("Nodes:"); + for (p = list; p != NULL; p = p->next) { + if (!jpd_find_node(p->call, argv[1])) + continue; + nprintf("%-16.16s %c", + print_node(p->alias, p->call), + (++i % 4) ? ' ' : '\n'); + } + if ((i % 4) != 0) nprintf("\n"); + free_proc_nr_nodes(list); + return 0; + } + /* "nodes *" */ + if (argc == 3 && *argv[2] == '*') { node_msg("Nodes:"); nprintf("Node Quality Obsolescence Port Neighbour\n"); for (p = list; p != NULL; p = p->next) { + if (!jpd_find_node(p->call, argv[1])) + continue; nprintf("%-16.16s ", print_node(p->alias, p->call)); /* * p->n == 0 indicates a local node with no routes. @@ -510,38 +572,6 @@ ax25_config_get_name(np->dev), np->call); } - } - free_proc_nr_nodes(list); - free_proc_nr_neigh(nlist); - return 0; - } - /* "nodes " */ - p = find_node(argv[1], list); - if (p != NULL && p->n == 0) { - node_msg("%s is a local node", print_node(p->alias, p->call)); - } else if (p != NULL) { - node_msg("Routes to: %s", print_node(p->alias, p->call)); - nprintf("Which Quality Obsolescence Port Neighbour\n"); - if (p->n > 0 && (np = find_neigh(p->addr1, nlist)) != NULL) { - nprintf("%c %-7d %-12d %-6s %s\n", - p->w == 1 ? '>' : ' ', - p->qual1, p->obs1, - ax25_config_get_name(np->dev), - np->call); - } - if (p->n > 1 && (np = find_neigh(p->addr2, nlist)) != NULL) { - nprintf("%c %-7d %-12d %-6s %s\n", - p->w == 2 ? '>' : ' ', - p->qual2, p->obs2, - ax25_config_get_name(np->dev), - np->call); - } - if (p->n > 1 && (np = find_neigh(p->addr3, nlist)) != NULL) { - nprintf("%c %-7d %-12d %-6s %s\n", - p->w == 3 ? '>' : ' ', - p->qual3, p->obs3, - ax25_config_get_name(np->dev), - np->call); } } else { node_msg("No such node");