Commit | Line | Data |
---|---|---|
41c799d4 C |
1 | /* syshdr.unx -*- C -*- |
2 | Unix system header for the uuconf library. | |
3 | ||
4 | Copyright (C) 1992 Ian Lance Taylor | |
5 | ||
6 | This file is part of the Taylor UUCP uuconf library. | |
7 | ||
8 | This library is free software; you can redistribute it and/or | |
9 | modify it under the terms of the GNU Library General Public License | |
10 | as published by the Free Software Foundation; either version 2 of | |
11 | the License, or (at your option) any later version. | |
12 | ||
13 | This library is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | Library General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Library General Public | |
19 | License along with this library; if not, write to the Free Software | |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | ||
22 | The author of the program may be contacted at ian@airs.com or | |
23 | c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. | |
24 | */ | |
25 | ||
26 | /* The root directory (used when setting local-send and local-receive | |
27 | values). */ | |
28 | #define ZROOTDIR "/" | |
29 | ||
30 | /* The current directory (used by uuconv as a prefix for the newly | |
31 | created file names). */ | |
32 | #define ZCURDIR "." | |
33 | ||
34 | /* The names of the Taylor UUCP configuration files. These are | |
35 | appended to NEWCONFIGLIB which is defined in Makefile. */ | |
36 | #define CONFIGFILE "/config" | |
37 | #define SYSFILE "/sys" | |
38 | #define PORTFILE "/port" | |
39 | #define DIALFILE "/dial" | |
40 | #define CALLFILE "/call" | |
41 | #define PASSWDFILE "/passwd" | |
42 | #define DIALCODEFILE "/dialcode" | |
43 | ||
44 | /* The names of the various V2 configuration files. These are | |
45 | appended to OLDCONFIGLIB which is defined in Makefile. */ | |
46 | #define V2_SYSTEMS "/L.sys" | |
47 | #define V2_DEVICES "/L-devices" | |
48 | #define V2_USERFILE "/USERFILE" | |
49 | #define V2_CMDS "/L.cmds" | |
50 | #define V2_DIALCODES "/L-dialcodes" | |
51 | ||
52 | /* The names of the HDB configuration files. These are appended to | |
53 | OLDCONFIGLIB which is defined in Makefile. */ | |
54 | #define HDB_SYSFILES "/Sysfiles" | |
55 | #define HDB_SYSTEMS "/Systems" | |
56 | #define HDB_PERMISSIONS "/Permissions" | |
57 | #define HDB_DEVICES "/Devices" | |
58 | #define HDB_DIALERS "/Dialers" | |
59 | #define HDB_DIALCODES "/Dialcodes" | |
60 | #define HDB_MAXUUXQTS "/Maxuuxqts" | |
61 | #define HDB_REMOTE_UNKNOWN "/remote.unknown" | |
62 | ||
63 | /* A string which is inserted between the value of OLDCONFIGLIB | |
64 | (defined in the Makefile) and any names specified in the HDB | |
65 | Sysfiles file. */ | |
66 | #define HDB_SEPARATOR "/" | |
67 | ||
68 | /* A macro to check whether fopen failed because the file did not | |
69 | exist. */ | |
70 | #define FNO_SUCH_FILE() (errno == ENOENT) | |
71 | ||
72 | #if ! HAVE_STRERROR | |
73 | ||
74 | /* We need a definition for strerror; normally the function in the | |
75 | unix directory is used, but we want to be independent of that | |
76 | library. This macro evaluates its argument multiple times. */ | |
77 | extern int sys_nerr; | |
78 | extern char *sys_errlist[]; | |
79 | ||
80 | #define strerror(ierr) \ | |
81 | ((ierr) >= 0 && (ierr) < sys_nerr ? sys_errlist[ierr] : "unknown error") | |
82 | ||
83 | #endif /* ! HAVE_STRERROR */ | |
84 | ||
85 | /* We want to be able to mark the Taylor UUCP system files as close on | |
86 | exec. */ | |
87 | #if HAVE_FCNTL_H | |
88 | #include <fcntl.h> | |
89 | #else | |
90 | #if HAVE_SYS_FILE_H | |
91 | #include <sys/file.h> | |
92 | #endif | |
93 | #endif | |
94 | ||
95 | #ifndef FD_CLOEXEC | |
96 | #define FD_CLOEXEC 1 | |
97 | #endif | |
98 | ||
99 | #define CLOSE_ON_EXEC(e) \ | |
100 | do \ | |
101 | { \ | |
102 | int cle_i = fileno (e); \ | |
103 | \ | |
104 | fcntl (cle_i, F_SETFD, fcntl (cle_i, F_GETFD, 0) | FD_CLOEXEC); \ | |
105 | } \ | |
106 | while (0) |