2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 /** @file version.c */
31 static const gchar
*_version
[] =
43 static gchar version_scripts
[32];
45 static gchar
*read_scripts_version()
49 if (g_file_get_contents(VERSIONFILE
, &c
, NULL
, NULL
) == TRUE
)
53 s
= g_strescape(g_strstrip(c
), NULL
);
54 g_snprintf(version_scripts
, sizeof(version_scripts
), "%s", s
);
63 version_scripts
[0] = '\0';
65 return ((gchar
*) version_scripts
);
68 /** @return NULL-terminated version string
69 @note Do not attempt to free the returned string
72 const char *quvi_version(QuviVersion version
)
76 case QUVI_VERSION_SCRIPTS
:
77 return (read_scripts_version());
78 case QUVI_VERSION_BUILD_TARGET
:
79 return ((gchar
*) _version
[QUVI_VERSION_BUILD_TARGET
]);
80 case QUVI_VERSION_BUILD_TIME
:
81 return ((gchar
*) _version
[QUVI_VERSION_BUILD_TIME
]);
85 return (_version
[QUVI_VERSION
]);
88 /* vim: set ts=2 sw=2 tw=72 expandtab: */