# HG changeset patch # User Space Falcon # Date 1439070250 0 # Node ID 61272ee5aadc4c928ab300654063569f2bada188 # Parent a93e4b07fdf31c3c55a0e97bfcca24ce03c1a3f8 unet-bind: implemented -a option for specifying wanted attributes diff -r a93e4b07fdf3 -r 61272ee5aadc ueda/sverp-bind/Makefile --- a/ueda/sverp-bind/Makefile Sat Aug 08 21:23:19 2015 +0000 +++ b/ueda/sverp-bind/Makefile Sat Aug 08 21:44:10 2015 +0000 @@ -10,6 +10,8 @@ ${PROG}: ${OBJS} ${LIBS} ${CC} -o $@ ${OBJS} ${LIBS} +${OBJS}: struct.h + install: install -c -o bin -g bin -m 755 ${PROG} ${BINDIR} diff -r a93e4b07fdf3 -r 61272ee5aadc ueda/sverp-bind/main.c --- a/ueda/sverp-bind/main.c Sat Aug 08 21:23:19 2015 +0000 +++ b/ueda/sverp-bind/main.c Sat Aug 08 21:44:10 2015 +0000 @@ -3,6 +3,7 @@ #include #include #include +#include "struct.h" extern char *MCLfile; @@ -10,6 +11,28 @@ char *starpoints_file; int check_completeness, unbound_instances; +struct wantattr *want_attr_list; +static struct wantattr **wantattr_tailp = &want_attr_list; + +static void +add_wanted_attr(attr) + char *attr; +{ + struct wantattr *wa; + + wa = (struct wantattr *) malloc(sizeof(struct wantattr) + + strlen(attr) + 1); + if (!wa) { + perror("malloc"); + exit(1); + } + wa->name = (char *)(wa + 1); + strcpy(wa->name, attr); + wa->next = 0; + *wantattr_tailp = wa; + wantattr_tailp = &wa->next; +} + static void usage() { @@ -25,8 +48,11 @@ extern char *optarg; register int c; - while ((c = getopt(argc, argv, "cI:M:s:")) != EOF) { + while ((c = getopt(argc, argv, "a:cI:M:s:")) != EOF) { switch (c) { + case 'a': + add_wanted_attr(optarg); + continue; case 'c': check_completeness++; continue; diff -r a93e4b07fdf3 -r 61272ee5aadc ueda/sverp-bind/struct.h --- a/ueda/sverp-bind/struct.h Sat Aug 08 21:23:19 2015 +0000 +++ b/ueda/sverp-bind/struct.h Sat Aug 08 21:44:10 2015 +0000 @@ -25,3 +25,8 @@ char *nc_comment; int input_lineno; }; + +struct wantattr { + char *name; + struct wantattr *next; +};