summaryrefslogtreecommitdiff
path: root/kicad
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-10 20:57:13 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-10 20:57:13 (GMT)
commitc71736dd1f5c897840c2083777cdc326f97581c7 (patch)
treee0a62e7624725f665c398af8586cdb76406eba34 /kicad
parent3d026576a5e600b81abae38b7bd2c660281509fd (diff)
downloadeeshow-c71736dd1f5c897840c2083777cdc326f97581c7.zip
eeshow-c71736dd1f5c897840c2083777cdc326f97581c7.tar.gz
eeshow-c71736dd1f5c897840c2083777cdc326f97581c7.tar.bz2
kicad/lib-parse.c (add_alias): there can be more than one alias per ALIAS
Reported by Roman Pavelka.
Diffstat (limited to 'kicad')
-rw-r--r--kicad/lib-parse.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/kicad/lib-parse.c b/kicad/lib-parse.c
index a850228..dc17cef 100644
--- a/kicad/lib-parse.c
+++ b/kicad/lib-parse.c
@@ -1,5 +1,5 @@
/*
- * kicad/lib.c - Parse Eeschema .lib file
+ * kicad/lib-parse.c - Parse Eeschema .lib file
*
* Written 2016 by Werner Almesberger
* Copyright 2016 by Werner Almesberger
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <ctype.h>
#include <assert.h>
#include "misc/util.h"
@@ -171,6 +172,22 @@ static void add_alias(struct comp *comp, const char *alias)
}
+static bool add_aliases(struct comp *comp, const char *line)
+{
+ const char *p;
+ int n;
+ char *s;
+
+ if (strncmp(line, "ALIAS", 5))
+ return 0;
+ if (!isspace(line[5]))
+ return 0;
+ for (p = line + 5; sscanf(p, " %ms%n", &s, &n) == 1; p += n)
+ add_alias(comp, s);
+ return 1;
+}
+
+
/* ----- Library parser ---------------------------------------------------- */
@@ -235,10 +252,8 @@ static bool lib_parse_line(const struct file *file,
lib->curr_comp->visible |= 1 << n;
return 1;
}
- if (sscanf(line, "ALIAS %ms", &s) == 1) {
- add_alias(lib->curr_comp, s);
+ if (add_aliases(lib->curr_comp, line))
return 1;
- }
/* @@@ explicitly ignore FPLIST */
return 1;
case lib_draw: