changeset 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 a93e4b07fdf3
children 6c7c79d37eff
files ueda/sverp-bind/Makefile ueda/sverp-bind/main.c ueda/sverp-bind/struct.h
diffstat 3 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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}
 
--- 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;
--- 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;
+};