missing NULL terminator in set_config_x
[geda-gaf.git] / gnetlist-legacy / src / vams_misc.c
blob33b9b63fef6f9f2ea400539ecdb1b1f71b71a11d
1 /* gEDA - GPL Electronic Design Automation
2 * gnetlist - gEDA Netlist
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2020 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02111-1301 USA.
22 #include <config.h>
24 #include <stdio.h>
25 #ifdef HAVE_STRING_H
26 #include <string.h>
27 #endif
28 #include <math.h>
30 #include <libgeda/libgeda.h>
32 #include "../include/globals.h"
33 #include "../include/prototype.h"
35 SCM
36 vams_get_attribs_list (OBJECT *object)
38 SCM list = SCM_EOL;
39 OBJECT *o_current;
40 GList *a_iter;
41 OBJECT *a_current;
42 int val;
43 char* found_name = NULL;
45 o_current = object;
47 /* search outside the symbol (attached attributes only) */
48 a_iter = o_current->attribs;
49 while(a_iter != NULL) {
50 a_current = a_iter->data;
51 if (a_current->text && a_current->text->string) {
52 val = o_attrib_get_name_value (a_current, &found_name, NULL);
54 if (val) {
55 list = scm_cons (scm_from_utf8_string (found_name), list);
58 g_free (found_name);
60 a_iter = g_list_next (a_iter);
63 return list;
66 SCM
67 vams_get_package_attributes(SCM scm_uref)
69 NETLIST *nl_current;
70 char *uref;
72 SCM_ASSERT(scm_is_string (scm_uref), scm_uref, SCM_ARG1,
73 "gnetlist:vams-get-package-attributes");
75 uref = scm_to_utf8_string (scm_uref);
77 /* here is where you make it multi page aware */
78 nl_current = netlist_head;
80 /* search for the first instance */
81 /* through the entire list */
82 while(nl_current != NULL) {
84 if (nl_current->component_uref &&
85 strcmp(nl_current->component_uref, uref) == 0) {
86 free (uref);
87 return vams_get_attribs_list (nl_current->object_ptr);
89 nl_current = nl_current->next;
92 free (uref);
93 return SCM_EOL;