1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
// $Id: errors.hh,v 1.3 2002/12/19 18:40:45 flaterco Exp $
// errors: Global functions for bailing out -- non-X capable version.
/*
Copyright (C) 1998 David Flater.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
enum tideerr {YEAR_OUT_OF_RANGE,
TM2UTC_FAILED,
MKTIME_FAILED,
INVALID_CONSTITUENT,
YEAR_NOT_IN_TABLE,
DOUBLE_READ,
NULL_YEAR,
END_OF_FILE,
NO_HFILE_PATH,
IMPOSSIBLE_CONVERSION,
UNRECOGNIZED_UNITS,
BOGUS_COORDINATES,
CANT_OPEN_FILE,
CORRUPT_HARMONICS_FILE,
BADCOLORSPEC,
XPM_ERROR,
NOHOMEDIR,
BADHHMM,
XMLPARSE,
STATION_NOT_FOUND,
SUB_SUBORDINATE,
NOOFFSETSFOUND,
CANTOPENDISPLAY,
NOT_A_NUMBER,
PNG_WRITE_FAILURE,
CANT_GET_SOCKET,
ABSURD_OFFSETS,
NUMBER_RANGE_ERROR,
BAD_MODE,
BAD_FORMAT,
BAD_TIMESTAMP,
ILLEGAL_MARK,
BAD_OR_AMBIGUOUS_COMMAND_LINE};
// This function should be called once at the start of the program to
// divert messages to syslog.
void set_daemon_mode();
// Output error message and die.
void barf (enum tideerr err, Dstr &details, int fatal = 1);
void barf (enum tideerr err, int fatal = 1);
// Other messages to stderr / syslog.
void log (Dstr &message, int priority);
void log (const char *message, int priority);
// Convenience -- details are just appended to message
void log (const char *message, Dstr &details, int priority);
// Like perror, but messages are diverted through syslog if in daemon mode.
void xperror (const char *s);
|