FreeCalypso > hg > ueda-linux
diff ueda/sverp-bind/main.c @ 31:61272ee5aadc
unet-bind: implemented -a option for specifying wanted attributes
| author | Space Falcon <falcon@ivan.Harhan.ORG> |
|---|---|
| date | Sat, 08 Aug 2015 21:44:10 +0000 |
| parents | c7ebd6179f5d |
| children |
line wrap: on
line diff
--- 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 <string.h> #include <strings.h> #include <unistd.h> +#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;
