Repository navigation
Expand file tree
/
Copy patherr.h
More file actions
120 lines (111 loc) · 4.05 KB
/
Copy patherr.h
File metadata and controls
120 lines (111 loc) · 4.05 KB
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
112
113
114
115
116
117
118
119
120
/*
* osh - an enhanced port of the Sixth Edition (V6) UNIX Thompson shell
*/
/*-
* Copyright (c) 2004-2011
* Jeffrey Allen Neitzel <jan (at) v6shell (dot) org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY JEFFREY ALLEN NEITZEL ``AS IS'', AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL JEFFREY ALLEN NEITZEL BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @(#)$Id$
*/
#ifndef ERR_H
#define ERR_H
/*
* required header files
*/
#include <stdarg.h>
/*
* diagnostics
*/
#define ERR_PAREN ") expected"
#define ERR_ALIASLOOP "Alias loop error"
#define ERR_GARGCOUNT "Arg count"
#define ERR_E2BIG "Arg list too long"
#define ERR_FORK "Cannot fork - try again"
#define ERR_PIPE "Cannot pipe - try again"
#define ERR_TRIM "Cannot trim"
#define ERR_WRITE "Cannot write"
#define ERR_GNOTFOUND "Command not found."
#define ERR_ALINVAL "Invalid argument list"
#define ERR_AVIINVAL "Invalid argv index"
#define ERR_NODIR "No directory"
#define ERR_NOHOMEDIR "No home directory"
#define ERR_NOMATCH "No match"
#define ERR_NOPWD "No previous directory"
#define ERR_NOSHELL "No shell!"
#define ERR_NOTTY "No terminal!"
#define ERR_NOMEM "Out of memory"
#define ERR_PATTOOLONG "Pattern too long"
#define ERR_SETID "Set-ID execution denied"
#define ERR_TMARGS "Too many args"
#define ERR_TMCHARS "Too many characters"
#define ERR_ARGCOUNT "arg count"
#define ERR_ARGUMENT "argument expected"
#define ERR_BADDIR "bad directory"
#define ERR_BADMASK "bad mask"
#define ERR_BADNAME "bad name"
#define ERR_BADSIGNAL "bad signal"
#define ERR_CREATE "cannot create"
#define ERR_EXEC "cannot execute"
#define ERR_OPEN "cannot open"
#define ERR_SEEK "cannot seek"
#define ERR_COMMAND "command expected"
#define ERR_DIGIT "digit expected"
#define ERR_GENERIC "error"
#define ERR_EXPR "expression expected"
#define ERR_LABNOTFOUND "label not found"
#define ERR_LABTOOLONG "label too long"
#define ERR_NOARGS "no args"
#define ERR_NOTDIGIT "not a digit"
#define ERR_NOTFOUND "not found"
#define ERR_OPERATOR "operator expected"
#define ERR_SYNTAX "syntax error"
#define ERR_OPUNKNOWN "unknown operator"
#define ERR_BRACE "} expected"
#define FD2_USAGE "usage: %s [-e] [-f file] [--] command [arg ...]\n"
#define FMT1S "%s\n"
#define FMT2S "%s: %s\n"
#define FMT3S "%s: %s: %s\n"
#define FMT4S "%s: %s: %s: %s\n"
/*
* exit status values
*/
#define FC_ERR 124 /* fatal child error (changed in pwait()) */
#define SH_ERR 2 /* shell-detected error (default value) */
#define SH_FALSE 1
#define SH_TRUE 0
#define ESTATUS ((getpid() == getmypid()) ? SH_ERR : FC_ERR)
#define EXIT(s) ((getpid() == getmypid()) ? exit((s)) : _exit((s)))
#undef DEBUG
/*@maynotreturn@*/
void err(int, /*@null@*/ const char *, /*@printflike@*/ ...);
void fd_print(int, /*@null@*/ const char *, /*@printflike@*/ ...);
/*@observer@*/
const char *getmyname(void);
pid_t getmypid(void);
void setmyerrexit(void (*)(int));
void setmyname(/*@null@*/ /*@observer@*/ const char *);
void setmypid(const pid_t);
/*@noreturn@*/
void ut_errexit(int);
#endif /* !ERR_H */