Source
xxxxxxxxxx
UseColors = ConfigGetBool(cfg, NULL, _T("CUI_USE_COLORS"), REQUIRED, _T("yes"), NULL);
/* ---------------------------------------------------------------------
* File: main.c
* (main program of show-doc.cui)
*
* Copyright (C) 2007
* Daniel Vogel, <daniel_vogel@t-online.de>
*
* Last Update: $Id: main.c 33481 2013-04-15 17:48:41Z dv $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* ---------------------------------------------------------------------
*/
static int NumErrors;
static int NumWarnings;
static int UseColors = TRUE;
static int UseMouse = FALSE;
static PROGRAM_CONFIG Config;
/* what string */
const char what[] = "@(#) show-doc.cui version " VERSIONSTR " " BUILDSTR;
/* ---------------------------------------------------------------------
* quit
* standard exit procedure
* ---------------------------------------------------------------------
*/
static void quit(void)
{
WindowEnd();
if (Config.Title) free(Config.Title);
if (Config.Filename) free(Config.Filename);
if (Config.Indexfile) free(Config.Indexfile);
if (Config.Encoding) free(Config.Encoding);
}
/* ---------------------------------------------------------------------
* GetBasename
* Get the basename of 'name'.
* ---------------------------------------------------------------------
*/
static const char*
GetBasename(const char* name)
{
const char* chr = strrchr(name,'/');
if (!chr)
{
chr = name;
}
else
{
chr++;
}
return chr;
}
/* ---------------------------------------------------------------------
* FileExists
* Test if file 'filename' exists and can be opened in read mode
* ---------------------------------------------------------------------
*/
static int
FileExists(const char* filename)
{
FILE* in = fopen(filename,"rt");
if (in)
{
fclose(in);
return TRUE;
}