File: error-handler.h

package info (click to toggle)
dhcpcd 0.70-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 276 kB
  • ctags: 270
  • sloc: ansic: 2,300; sh: 391; makefile: 93
file content (111 lines) | stat: -rw-r--r-- 3,823 bytes parent folder | download | duplicates (3)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* $Id: error-handler.h,v 0.2 1997/08/30 18:01:05 yoichi v0_70 $
 *
 * dhcpcd - DHCP client daemon -
 * Copyright (C) 1996 Yoichi Hariguchi <yoichi@fore.com>
 *
 * Dhcpcd is an RFC2131 and RFC1541 compliant DHCP client daemon.
 *
 * This 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.
 */

extern int errno;


/* logXXX outputs error message to stderr if DebugFlag is 1
 * logXXX sends error message to syslog  if DebugFlag is 0
 */
extern int DebugFlag;


/* function prototypes
 */

void	errSysExit(const char *fmt, ...);
/* requests: parameters same as 'printf'
 * effects:  outputs system and user specified error messages to stderr,
 *           and terminates the process with exit(1).
 * modifies: nothing
 * returns:  nothing
 * comment:  call this when a system call related error occured and want to
 *           terminate the process.
 */

void	errSysRet(const char *fmt, ...);
/* requests: parameters same as 'printf'
 * effects:  outputs system and user specified error messages to stderr.
 * modifies: nothing
 * returns:  nothing
 * comment:  call this when a system call related error occured.
 */

void	errQuit(const char *fmt, ...);
/* requests: parameters same as 'printf'
 * effects:  outputs user specified error messages to stderr, and terminates
 *           the process with exit(1).
 * modifies: nothing
 * returns:  nothing
 */

void	errMsg(const char *fmt, ...);
/* requests: parameters same as 'printf'
 * effects:  outputs user specified error messages to stderr.
 * modifies: nothing
 * returns:  nothing
 */

void	logOpen(const char *ident, int option, int facility);
/* requests: ident:  ptr to program name
 *           option:   one of LOG_{CONS, NDELAY, PERROR, PID}
 *           facility: LOG_XXX in syslog.h (XXX is LOCAL0, USER, etc.)
 * effects:  it calles 'openlog' if 'DebugFlag' is 1, othewise does nothing.
 * modifies: nothing
 * returns:  nothing
 */

void	logSysExit(const char *fmt, ...);
/* requests: parameters same as 'printf'
 * effects:  it sends system and user specified error messages to syslog
 *           if 'DebugFlag' is 1, otherwise outputs them to stderr. it also
 *           terminates the process with 'exit(2)'.
 * modifies: nothing
 * returns:  nothing
 * comment:  call this when a system call related error occured.
 */

void	logSysRet(const char *fmt, ...);
/* requests: parameters same as 'printf'
 * effects:  it sends system and user specified error messages to syslog
 *           if 'DebugFlag' is 1, otherwise outputs them to stderr.
 * modifies: nothing
 * returns:  nothing
 * comment:  call this when a system call related error occured.
 */

void	logQuit(const char *fmt, ...);
/* requests: parameters same as 'printf'
 * effects:  it sends user specified error messages to syslog 
 *           if 'DebugFlag' is 1, otherwise outputs them to stderr. it also
 *           terminates the process with 'exit(2)'.
 * modifies: nothing
 * returns:  nothing
 */

void	logRet(const char *fmt, ...);
/* requests: parameters same as 'printf'
 * effects:  it sends user specified error messages to syslog 
 *           if 'DebugFlag' is 1, otherwise outputs them to stderr.
 * modifies: nothing
 * returns:  nothing
 */