2007-06-11 13:01:04 +01:00
|
|
|
|
/*
|
|
|
|
|
* Scyther : An automatic verifier for security protocols.
|
2012-04-24 12:56:51 +01:00
|
|
|
|
* Copyright (C) 2007-2012 Cas Cremers
|
2007-06-11 13:01:04 +01:00
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2005-12-29 11:03:18 +00:00
|
|
|
|
/** @file color.c \brief Color output for terminals.
|
|
|
|
|
*
|
|
|
|
|
* Depends on the switches (to disable them with a --plain switch)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "switches.h"
|
|
|
|
|
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Substitution string for --plain output
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *empty = "";
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Reset colors
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *COLOR_Reset = "[0m";
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Red
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *COLOR_Red = "[31m";
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Green
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *COLOR_Green = "[32m";
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Bold
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *COLOR_Bold = "[1m";
|
|
|
|
|
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Init colors
|
2005-12-29 11:03:18 +00:00
|
|
|
|
void
|
|
|
|
|
colorInit (void)
|
|
|
|
|
{
|
|
|
|
|
if (switches.plain)
|
|
|
|
|
{
|
|
|
|
|
COLOR_Reset = empty;
|
|
|
|
|
COLOR_Red = empty;
|
|
|
|
|
COLOR_Green = empty;
|
|
|
|
|
COLOR_Bold = empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Exit colors
|
2005-12-29 11:03:18 +00:00
|
|
|
|
void
|
|
|
|
|
colorDone (void)
|
|
|
|
|
{
|
|
|
|
|
}
|