libgeda: Enable use from C++ programs.
[geda-gaf/whiteaudio.git] / gattrib / src / g_rc.c
blobf96d47f4a1a49031be86464870e6c0e49e8e8741
1 /* gEDA - GPL Electronic Design Automation
2 * gattrib -- gEDA component and net attribute manipulation using spreadsheet.
3 * Copyright (C) 2003-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 /*! \file
21 * \brief RC-file specific functions
23 * RC-file specific functions for Scheme. At the moment it only
24 * contains a function to test the version number of the program.
27 #include <config.h>
28 #include <missing.h>
29 #include <version.h>
31 #include <stdio.h>
32 #include <sys/stat.h>
33 #include <ctype.h>
34 #ifdef HAVE_STRING_H
35 #include <string.h>
36 #endif
37 #ifdef HAVE_STDLIB_H
38 #include <stdlib.h>
39 #endif
40 #ifdef HAVE_UNISTD_H
41 #include <unistd.h>
42 #endif
44 /*------------------------------------------------------------------
45 * Gattrib specific includes
46 *------------------------------------------------------------------*/
47 #include <libgeda/libgeda.h> /* geda library fcns */
48 #include "../include/struct.h" /* typdef and struct declarations */
49 #include "../include/prototype.h" /* function prototypes */
50 #include "../include/globals.h"
51 #include "../include/i_vars.h" /* This holds all the guile variable defs */
54 #ifdef HAVE_LIBDMALLOC
55 #include <dmalloc.h>
56 #endif
58 /*------------------------------------------------------------------*/
59 /*! \brief Test the version of gattrib and gEDA/gaf
61 * \param version Version being tested
62 * \returns false if incorrect version, true if OK
64 SCM g_rc_gattrib_version(SCM scm_version)
66 char *version;
67 SCM ret = SCM_BOOL_T;
69 SCM_ASSERT (scm_is_string (scm_version), scm_version,
70 SCM_ARG1, "gattrib-version");
72 version = scm_to_utf8_string (scm_version);
73 if (g_strcasecmp (version, PACKAGE_DATE_VERSION) != 0) {
74 fprintf(stderr,
75 "You are running gEDA/gaf version [%s%s.%s],\n",
76 PREPEND_VERSION_STRING, PACKAGE_DOTTED_VERSION,
77 PACKAGE_DATE_VERSION);
78 fprintf(stderr,
79 "but you have a version [%s] gattribrc file.\n",
80 version);
81 fprintf(stderr,
82 "Please be sure that you have the latest rc file.\n");
83 ret = SCM_BOOL_F;
86 free (version);
87 return ret;