Initial import of gattrib 20040806
[geda-gaf/whiteaudio.git] / gattrib / src / g_rc.c
blobe4b7c2170e3758a86e286c763983ef77f1217883
1 /* gEDA - GPL Electronic Design Automation
2 * gattrib -- gEDA component and net attribute manipulation using spreadsheet.
3 * Copyright (C) 2003 Stuart D. Brorson.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
20 #include <config.h>
22 #include <stdio.h>
23 #include <sys/stat.h>
24 #include <ctype.h>
25 #ifdef HAVE_STRING_H
26 #include <string.h>
27 #endif
28 #ifdef HAVE_DIRENT_H
29 #include <dirent.h>
30 #endif
31 #ifdef HAVE_STDLIB_H
32 #include <stdlib.h>
33 #endif
34 #ifdef HAVE_UNISTD_H
35 #include <unistd.h>
36 #endif
38 /*------------------------------------------------------------------
39 * Gattrib specific includes
40 *------------------------------------------------------------------*/
41 #include <libgeda/libgeda.h> /* geda library fcns */
42 #include "../include/struct.h" /* typdef and struct declarations */
43 #include "../include/prototype.h" /* function prototypes */
44 #include "../include/globals.h"
45 #include "../include/i_vars.h" /* This holds all the guile variable defs */
47 #define RETURN_G_RC_MODE(rc, var, size) \
48 return g_rc_mode_general(mode, \
49 (rc), \
50 &(var), \
51 mode_table, \
52 size)
54 /* a random int, used only as a place holder */
55 int default_dummy;
58 /*------------------------------------------------------------------
60 *------------------------------------------------------------------*/
61 SCM g_rc_gattrib_version(SCM version)
63 char *string = gh_scm2newstr(version, NULL);
65 if (string == NULL) {
66 fprintf(stderr,
67 "%s requires a string as a parameter\n", "gattrib-version");
68 return SCM_BOOL_F;
71 if (strcmp(string, VERSION) != 0) {
72 fprintf(stderr,
73 "You are running gEDA version [%s],\n", VERSION);
74 fprintf(stderr,
75 "but you have a version [%s] gattribrc file:\n[%s]\n",
76 string, rc_filename);
77 fprintf(stderr,
78 "While gattrib is in ALPHA, "
79 "please be sure that you have the latest rc file.\n");
80 free(string);
81 return SCM_BOOL_F;
84 free(string);
85 return SCM_BOOL_T;