2008-01-26 18:00:47 +01:00
|
|
|
/*
|
2008-02-27 09:04:17 +01:00
|
|
|
* version.c - version message utility functions
|
2008-01-25 11:49:18 +01:00
|
|
|
*
|
|
|
|
* Copyright © 2008 Julien Danjou <julien@danjou.info>
|
|
|
|
* Copyright © 2008 Hans Ulrich Niedermann <hun@n-dimensional.de>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2014-03-30 20:07:48 +02:00
|
|
|
#include "config.h"
|
|
|
|
#include "common/version.h"
|
|
|
|
#include "awesome-version-internal.h"
|
|
|
|
|
2008-01-25 11:49:18 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2012-04-23 16:46:53 +02:00
|
|
|
#include <lualib.h>
|
|
|
|
#include <lauxlib.h>
|
2016-10-29 11:57:02 +02:00
|
|
|
#include <xcb/randr.h> /* for XCB_RANDR_GET_MONITORS */
|
2012-04-23 16:46:53 +02:00
|
|
|
|
2008-01-25 11:49:18 +01:00
|
|
|
/** \brief Print version message and quit program.
|
2008-02-27 09:00:42 +01:00
|
|
|
* \param executable program name
|
2008-01-25 11:49:18 +01:00
|
|
|
*/
|
|
|
|
void
|
2009-04-08 18:53:53 +02:00
|
|
|
eprint_version(void)
|
2008-01-25 11:49:18 +01:00
|
|
|
{
|
2012-06-08 02:19:07 +02:00
|
|
|
lua_State *L = luaL_newstate();
|
2016-07-09 19:05:44 +02:00
|
|
|
luaL_openlibs(L);
|
2012-04-23 16:46:53 +02:00
|
|
|
lua_getglobal(L, "_VERSION");
|
2016-07-09 19:05:44 +02:00
|
|
|
lua_getglobal(L, "jit");
|
|
|
|
|
|
|
|
if (lua_istable(L, 2))
|
|
|
|
lua_getfield(L, 2, "version");
|
|
|
|
else
|
|
|
|
lua_pop(L, 1);
|
2012-04-23 16:46:53 +02:00
|
|
|
|
2016-10-29 13:13:34 +02:00
|
|
|
/* Either push version number or error message onto stack */
|
|
|
|
(void) luaL_dostring(L, "return require('lgi.version')");
|
|
|
|
|
2008-06-24 20:25:42 +02:00
|
|
|
#ifdef WITH_DBUS
|
2015-11-19 17:15:48 +01:00
|
|
|
const char *has_dbus = "✔";
|
2008-06-24 20:25:42 +02:00
|
|
|
#else
|
2015-11-19 17:15:48 +01:00
|
|
|
const char *has_dbus = "✘";
|
2008-06-24 20:25:42 +02:00
|
|
|
#endif
|
2016-10-29 11:57:02 +02:00
|
|
|
#ifdef XCB_RANDR_GET_MONITORS
|
|
|
|
const char *has_RandR15 = "✔";
|
|
|
|
#else
|
|
|
|
const char *has_RandR15 = "✘";
|
|
|
|
#endif
|
|
|
|
#ifdef HAS_EXECINFO
|
|
|
|
const char *has_execinfo = "✔";
|
|
|
|
#else
|
|
|
|
const char *has_execinfo = "✘";
|
|
|
|
#endif
|
2015-11-19 17:15:48 +01:00
|
|
|
|
|
|
|
printf("awesome %s (%s)\n"
|
|
|
|
" • Compiled against %s (running with %s)\n"
|
2016-10-29 11:57:02 +02:00
|
|
|
" • D-Bus support: %s\n"
|
|
|
|
" • execinfo support: %s\n"
|
2016-10-29 13:13:34 +02:00
|
|
|
" • RandR 1.5 support: %s\n"
|
|
|
|
" • LGI version: %s\n",
|
2015-11-19 17:15:48 +01:00
|
|
|
AWESOME_VERSION, AWESOME_RELEASE,
|
2016-10-29 13:13:34 +02:00
|
|
|
LUA_RELEASE, lua_tostring(L, -2),
|
|
|
|
has_dbus, has_execinfo, has_RandR15,
|
|
|
|
lua_tostring(L, -1));
|
2015-11-19 17:15:48 +01:00
|
|
|
lua_close(L);
|
|
|
|
|
2008-01-25 11:49:18 +01:00
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2014-04-13 17:48:03 +02:00
|
|
|
/** Get version string.
|
|
|
|
* \return A string describing the current version.
|
|
|
|
*/
|
|
|
|
const char *
|
|
|
|
awesome_version_string(void)
|
|
|
|
{
|
|
|
|
return AWESOME_VERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Get release string.
|
|
|
|
* \return A string describing the code name of the relase.
|
|
|
|
*/
|
|
|
|
const char *
|
|
|
|
awesome_release_string(void)
|
|
|
|
{
|
|
|
|
return AWESOME_RELEASE;
|
|
|
|
}
|
|
|
|
|
2011-09-11 16:50:01 +02:00
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|