Print this page
5798 fexecve() needed per POSIX 2008
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libxcurses/h/mks.h
+++ new/usr/src/lib/libxcurses/h/mks.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 + *
23 25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 26 * Use is subject to license terms.
25 27 */
26 28
27 -#pragma ident "%Z%%M% %I% %E% SMI"
28 -
29 29 /*
30 30 * MKS header file. Defines that make programming easier for us.
31 31 * Includes MKS-specific things and posix routines.
32 32 *
33 33 * Copyright 1985, 1993 by Mortice Kern Systems Inc. All rights reserved.
34 34 *
35 35 * $Header: /rd/h/rcs/mks.h 1.233 1995/09/28 19:45:19 mark Exp $
36 36 */
37 37
38 38 #ifndef __M_MKS_H__
39 39 #define __M_MKS_H__
40 40
41 41 /*
42 42 * This should be a feature test macro defined in the Makefile or
43 43 * cc command line.
44 44 */
45 45 #ifndef MKS
46 46 #define MKS 1
47 47 #endif
48 48
49 49 /*
50 50 * Write function declarations as follows:
51 51 * extern char *function ANSI((char *cp, int flags, NODE *np));
52 52 * Expansion of this happens only when __STDC__ is set.
53 53 */
54 54 #ifdef __STDC__
55 55 #define ANSI(x) x
56 56 #define _VOID void /* Used in VOID *malloc() */
57 57 #else
58 58 #define const
59 59 #define signed
60 60 #define volatile
61 61 #define ANSI(x) ()
62 62 #define _VOID char /* Used in _VOID *malloc() */
63 63 #endif
64 64
65 65 #ifndef STATIC
66 66 # define STATIC static /* Used for function definition */
67 67 #endif /*STATIC*/
68 68
69 69 #ifndef STATREF
70 70 # ifdef __STDC__
71 71 # define STATREF static
72 72 # else
73 73 # define STATREF /* Used in local function forward declaration */
74 74 # endif
75 75 #endif /*STATREF*/
76 76
77 77 #define LEXTERN extern /* Library external reference */
78 78 #define LDEFN /* Define Loadable library entry */
79 79
80 80 typedef void (*_sigfun_t)(int);
81 81
82 82 #include <mkslocal.h>
83 83 #include <stdio.h>
84 84 #include <unistd.h>
85 85 #include <limits.h>
86 86 #include <sys/stat.h> /* required for m_samefile() prototype. */
87 87 #include <m_wchar.h>
88 88 #include <m_i18n.h>
89 89 #include <m_invari.h>
90 90
91 91 #if M_TFGETC || M_STTY_CC
92 92 #include <termios.h>
93 93 #endif
94 94
95 95 #ifndef M_LIBDIR
96 96 # error "You must define M_LIBDIR in mkslocal.h"
97 97 #endif
98 98
99 99 #ifndef M_ETCDIR
100 100 # error "You must define M_ETCDIR in mkslocal.h"
101 101 #endif
102 102
103 103 #ifndef M_SPOOLDIR
104 104 # error "You must define M_SPOOLDIR in mkslocal.h"
105 105 #endif
106 106
107 107 #ifndef M_MANPATH
108 108 # error "You must define M_MANPATH in mkslocal.h"
109 109 #endif
110 110
111 111 #if defined(I18N) && !defined(M_NLSDIR)
112 112 # error "You must define M_NLSDIR in mkslocal.h"
113 113 #endif
114 114
115 115 #if (defined(M_I18N_MKS_FULL) || defined(M_I18N_MKS_XPG)) && !defined(I18N)
116 116 # error I18N must be defined
117 117 #endif
118 118
119 119 /* P_tmpdir - used by tmpnam.c and tempnam.c.
120 120 * Could be in <stdio.h>. But in case it is not ..
121 121 */
122 122 #ifndef P_tmpdir
123 123 # ifndef M_TMPDIR
124 124 # error M_TMPDIR must be defined in mkslocal.h
125 125 # endif
126 126 # define P_tmpdir M_TMPDIR
127 127 #endif /* P_tmpdir */
128 128
129 129 /* L_cuserid - used by cuserid.c
130 130 * Could be in <stdio.h>. But in case it is not ..
131 131 */
132 132 #ifndef L_cuserid
133 133 # ifndef M_L_CUSERID
134 134 # error M_L_CUSERID must be defined in mkslocal.h
135 135 # endif
136 136 # define L_cuserid M_L_CUSERID
137 137 #endif /* L_cuserid */
138 138
139 139 #ifdef M_AUDIT
140 140 LEXTERN char *m_audmode (int, int);
141 141 #if !defined(M_AUDITW1) || !defined(M_AUDITW2)
142 142 # error "With M_AUDIT set, you must define M_AUDITW1 and M_AUDITW2"
143 143 #endif
144 144 #endif /*M_AUDIT*/
145 145
146 146 #ifndef M_CS_PATH
147 147 # error "You must define M_CS_PATH in mkslocal.h"
148 148 #endif
149 149
150 150 #ifndef M_CS_SHELL
151 151 # error "You must define M_CS_SHELL in mkslocal.h"
152 152 #endif
153 153
154 154 #ifndef M_SH_USER_FDS
155 155 /*
156 156 * default number of user file descriptors to be used in the shell
157 157 * Must be >= 10, should be <= OPEN_MAX/2.
158 158 */
159 159 #define M_SH_USER_FDS 10
160 160 #endif /*M_SH_USER_FDS*/
161 161
162 162 #ifndef M_SH_MAX_FUNCTION_EVAL_DEPTH
163 163 #define M_SH_MAX_FUNCTION_EVAL_DEPTH 100
164 164 #endif
165 165
166 166 #ifndef M_MANPAGER
167 167 #define M_MANPAGER "more -A -s"
168 168 #endif
169 169
170 170 /* set up alert and verticalTab characters - This assumes an ANSI-C compiler */
171 171 #undef M_ALERT
172 172 #undef M_VTAB
173 173 #define M_ALERT '\a'
174 174 #define M_VTAB '\v'
175 175
176 176 #ifndef M_ESCAPE
177 177 # define M_ESCAPE '\033' /* default to ASCII code for <ESC> */
178 178 #endif /*M_ESCAPE*/
179 179
180 180 #ifndef SETVBUF
181 181 /* if SETVBUF not previously defined, then use default ANSI-C definition */
182 182 # define SETVBUF setvbuf
183 183 #endif
184 184
185 185 #ifdef M_NULL
186 186 /* if M_NULL defined in <mkslocal.h> then want to redefine NULL */
187 187 #undef NULL
188 188 #define NULL (M_NULL)
189 189 #endif /*M_NULL*/
190 190
191 191 /*
192 192 * Useful additions to sys/stat.h.
193 193 */
194 194 #ifndef S_IRALL
195 195 #define S_IRALL (S_IRUSR|S_IRGRP|S_IROTH)
196 196 #endif
197 197 #ifndef S_IWALL
198 198 #define S_IWALL (S_IWUSR|S_IWGRP|S_IWOTH)
199 199 #endif
200 200 #ifndef S_IXALL
201 201 #define S_IXALL (S_IXUSR|S_IXGRP|S_IXOTH)
202 202 #endif
203 203
204 204 #ifndef M_DEFMODE /* Default directory creation mode */
205 205 #define M_DEFMODE ((mode_t)S_IRALL|S_IWALL)/* Default file creation mode*/
206 206 #endif
207 207 #ifndef M_DIRMODE
208 208 #define M_DIRMODE ((mode_t)S_IRALL|S_IWALL|S_IXALL)
209 209 #endif
210 210
211 211 #ifndef M_FLDSEP
212 212 #define M_FLDSEP ':' /* UNIX field separator for passwd, PATH */
213 213 #endif
214 214
215 215 #ifndef M_TTYNAME
216 216 #define M_TTYNAME "/dev/tty"
217 217 #endif
218 218
219 219 #ifndef M_NULLNAME
220 220 #define M_NULLNAME "/dev/null"
221 221 #endif
222 222
223 223 #ifndef M_FSDELIM
224 224 #define M_FSDELIM(c) ((c)=='/')
225 225 #endif
226 226
227 227 #ifndef M_DRDELIM
228 228 #define M_DRDELIM(c) (0)
229 229 #endif
230 230
231 231 #ifndef M_DIRSTAT
232 232 #define M_DIRSTAT(name, dp, sb) stat((name), (sb))
233 233 #endif
234 234
235 235 #ifndef M_HIDDEN
236 236 #define M_HIDDEN(dirp, dp) ((dp)->d_name[0] == '.')
237 237 #endif
238 238
239 239 #ifndef M_FSMOUNT /* for use by setmnt routine */
240 240 #define M_FSMOUNT M_ETCDIR(mtab)
241 241 #endif
242 242
243 243 #ifndef M_FSALL /* for use by setmnt routine */
244 244 #define M_FSALL M_ETCDIR(fstab)
245 245 #endif
246 246
247 247 #ifndef M_NLSCHARMAP /* Default charmap file for localedef */
248 248 #define M_NLSCHARMAP M_NLSDIR(charmap/ISO_8859-1)
249 249 #endif
250 250
251 251 #ifndef M_POSIXPATH /* used when I18N undefined, default posix path */
252 252 #define M_POSIXPATH M_NLSDIR(locale/POSIX)
253 253 #endif
254 254
255 255 #ifndef M_ISEOV
256 256 #define M_ISEOV(error) 0
257 257 #endif
258 258
259 259 #ifndef M_IS_NATIVE_LOCALE
260 260 #define M_IS_NATIVE_LOCALE(s) (strcmp(s, "POSIX")==0 || strcmp(s, "C")==0)
261 261 #endif
262 262
263 263 #ifndef M_FSCLOSE
264 264 #define M_FSCLOSE(fp)
265 265 #endif
266 266
267 267 #ifndef ROOTUID /* default superuser uid = 0 */
268 268 #define ROOTUID 0
269 269 #endif
270 270
271 271 #ifndef ROOTGID /* default superuser gid = 0 */
272 272 #define ROOTGID 0
273 273 #endif
274 274
275 275 #ifndef M_GROUP_PASSWD
276 276 #define M_GROUP_PASSWD(grp) (grp->gr_passwd)
277 277 #endif
278 278
279 279
280 280 #ifndef M_NUMSIZE
281 281 /*
282 282 * define the expected max length of a printed number. (used in awk)
283 283 * This should be the longest expected size for any type of number
284 284 * ie. float, long etc.
285 285 * This number is used to calculate the approximate
286 286 * number of bytes needed to hold the number.
287 287 */
288 288 #define M_NUMSIZE 30
289 289 #endif /* M_NUMSIZE */
290 290
291 291 /*
292 292 * VARARG[12345]: declare variadic functions.
293 293 * Expands to either a standard C prototype or a K&R declaration.
294 294 * For example:
295 295 *
296 296 * #include <stdarg.h>
297 297 * int
298 298 * fprintf VARARG2(FILE*, fp, char*, fmt)
299 299 * {
300 300 * va_list ap;
301 301 *
302 302 * va_start(ap, fmt);
303 303 * cp = va_arg(ap, char*);
304 304 * va_end(ap);
305 305 * }
306 306 */
307 307 #ifndef VARARG1
308 308 #ifdef __STDC__
309 309 #define VARARG1(type, name) (type name, ...)
310 310 #define VARARG2(t1, n1, t2, n2) (t1 n1, t2 n2, ...)
311 311 #define VARARG3(t1, n1, t2, n2, t3, n3) (t1 n1, t2 n2, t3 n3, ...)
312 312 #define VARARG4(t1, n1, t2, n2, t3, n3, t4, n4) \
313 313 (t1 n1, t2 n2, t3 n3, t4 n4, ...)
314 314 #define VARARG5(t1, n1, t2, n2, t3, n3, t4, n4, t5, n5) \
315 315 (t1 n1, t2 n2, t3 n3, t4 n4, t5 n5, ...)
316 316 #else
317 317 #define VARARG1(type, name) (name, va_alist) type name; int va_alist
318 318 #define VARARG2(t1, n1, t2, n2) (n1, n2, va_alist) t1 n1; t2 n2; int va_alist
319 319 #define VARARG3(t1, n1, t2, n2, t3, n3) (n1, n2, n3, va_alist) \
320 320 t1 n1; t2 n2; t3 n3; int va_alist
321 321 #define VARARG4(t1, n1, t2, n2, t3, n3, t4, n4) (n1, n2, n3, n4, va_alist) \
322 322 t1 n1; t2 n2; t3 n3; t4 n4; int va_alist
323 323 #define VARARG5(t1, n1, t2, n2, t3, n3, t4, n4, t5, n5) \
324 324 (n1, n2, n3, n4, n5, va_alist) \
325 325 t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; int va_alist
326 326 #endif
327 327 #endif
328 328
↓ open down ↓ |
290 lines elided |
↑ open up ↑ |
329 329
330 330 /*
331 331 * MKS-specific library entry points.
332 332 */
333 333 extern char *_cmdname;
334 334 LEXTERN char *basename (char *);
335 335 LEXTERN void crc16 (ushort *, ushort);
336 336 LEXTERN void crcccitt (ushort *, ushort);
337 337 LEXTERN int eprintf (const char *, ...);
338 338 LEXTERN void eputs (const char *);
339 -LEXTERN pid_t fexecve (const char *, char *const *, char *const *);
340 -LEXTERN pid_t fexecvp (const char *, char *const *);
341 -LEXTERN pid_t fexecvep (const char *, char *const *, char *const *);
342 339 LEXTERN int execvep (const char *, char *const *, char *const *);
343 340 LEXTERN int isabsname (const char *);
344 341 LEXTERN const char *m_cescape (wint_t);
345 342 LEXTERN int m_escapec (char **);
346 343 LEXTERN const char *m_toprint (wint_t);
347 344 #if M_STTY_CC
348 345 LEXTERN int m_stty_cc (cc_t* cp, char *str);
349 346 #endif
350 347 LEXTERN char *m_cmdname (char *);
351 348 LEXTERN char *m_strmode (mode_t);
352 349 LEXTERN char *m_readmode (const char *);
353 350 LEXTERN char *m_readnum (long *, char *, char **, int);
354 351 LEXTERN char *m_readunum (unsigned long *, char *, char **, int);
355 352 LEXTERN mode_t m_getmode (mode_t);
356 353 LEXTERN int m_wallow (int, const char *);
357 354 LEXTERN char *m_pathcat (const char *, const char *);
358 355 LEXTERN void m_sigcleanup (void (*__handler)(int __signo) );
359 356 LEXTERN void m_defaction (int __signo);
360 357 LEXTERN char *m_strdup (const char *s);
361 358 LEXTERN int m_stricmp (const char *, const char *);
362 359 LEXTERN char *m_self (int, char *, char *);
363 360 LEXTERN int m_grouplist (char *user, gid_t *gidlist[]);
364 361 LEXTERN int m_setgroups (int gidsetsize, gid_t grouplist[]);
365 362 LEXTERN uint m_binsrch (uint n, int (*cmp)(uint i));
366 363 LEXTERN char *m_dirname (const char*);
367 364 LEXTERN char *m_confstr (int);
368 365
369 366 LEXTERN void m_crcposix (ulong *, const uchar *, size_t);
370 367 LEXTERN int m_setprio (int, unsigned int, int);
371 368 LEXTERN int m_getprio (int, unsigned int);
372 369 LEXTERN int m_incrnice (int, unsigned int, int);
373 370 LEXTERN char *m_devname (dev_t);
374 371 LEXTERN char *m_mountdir (const char *);
375 372 LEXTERN int m_absname(char *, char *, char *, size_t);
376 373 LEXTERN int m_samefile(char *, struct stat *, char *, struct stat *);
377 374
378 375 /* __m_system() : alternate interface into system() */
379 376 LEXTERN int __m_system (const char *, const char *, const char *);
380 377
381 378
382 379 /* conversion routines - between single byte and UNICODE (wide) strings.
383 380 * These return a pointer to malloc'd memory.
384 381 * It is the caller's responsiblity to free() it, if necessary
385 382 * These are for use primarily on NT
386 383 */
387 384 extern char *m_unicodetosb(const wchar_t*);
388 385 extern wchar_t *m_sbtounicode(const char*);
389 386
390 387
391 388 /*
392 389 * things that could go into an "m_stdio.h"
393 390 */
394 391
395 392 /* m_unlink() : alternate unlink() for use with vendor-provided
396 393 * libraries that do not have a satisfactory unlink() */
397 394 #ifndef M_UNLINK
398 395 #define m_unlink(s) unlink(s)
399 396 #endif
400 397
401 398 /* __m_popen() : alternate interface into popen() */
402 399 LEXTERN FILE *__m_popen (const char *, const char *,
403 400 const char *, const char *);
404 401 LEXTERN FILE *__m_popenvp (const char *mode, const char *shell,
405 402 char const * const *args);
406 403
407 404 #if M_TFGETC
408 405 LEXTERN int m_tfgetc (FILE *fp, struct termios *tp);
409 406 #else
410 407 #define m_tfgetc(fp,tp) fgetc(fp)
411 408 #endif
412 409
413 410 /* m_fsopen() - special routine for curses */
414 411 LEXTERN FILE *m_fsopen (char *, size_t, const char *, FILE *);
415 412
416 413 #ifndef M_FFLUSH_NOT_POSIX_1
417 414 # define m_fflush fflush
418 415 #else
419 416 LEXTERN int m_fflush (FILE *);
420 417 #endif
421 418
422 419 /* m_fgets return values */
423 420 enum {
424 421 M_FGETS_OK, /* Normal return */
425 422 M_FGETS_EOF, /*
426 423 * Regular EOF (same as NULL from fgets).
427 424 * Buffer is *untouched*.
428 425 */
429 426 M_FGETS_SHORT, /*
430 427 * Short input (buf[strlen(buf)-1] != '\n')
431 428 * This is a trailing line, without a newline at the
432 429 * end of the file. The buffer is valid, ending in
433 430 * a \0, with no newline. The case of terminal input
434 431 * ending with an EOF in the middle of the line will
435 432 * restart -- typing two EOF's will result in this
436 433 * case.
437 434 */
438 435 M_FGETS_LONG, /*
439 436 * Line too long: newline not found within len bytes
440 437 * (buf[len-1] != '\n').
441 438 * At this point, while((c=getc(fp)) != '\n') ...
442 439 * is a valid method to get the rest of the line.
443 440 */
444 441 M_FGETS_BINARY, /*
445 442 * Input contained an invalid character (e.g. \0)
446 443 * Buffer contents *undefined*.
447 444 */
448 445 M_FGETS_ERROR /*
449 446 * A system call returned an error, errno is set.
450 447 * Buffer contents *undefined*.
451 448 */
452 449 };
453 450 LEXTERN int m_fgets (char *, size_t, FILE *);
454 451
455 452 /*
456 453 * end of things that could go into an "m_stdio.h"
457 454 */
458 455
459 456 LEXTERN int m_winsize (int *, int *);
460 457 LEXTERN char *m_cuserid ();
461 458
462 459 /* m_ctype: generic character classification */
463 460 typedef int m_ctype_t; /* ctype property */
464 461 LEXTERN m_ctype_t m_ctype (const char *property);
465 462 LEXTERN int m_isctype (int c, m_ctype_t ctype);
466 463 LEXTERN char *m_readdate (char *, time_t *, int);
467 464
468 465 #ifndef M_READDATE_SYSV
469 466 #define M_READDATE_SYSV 0
470 467 #endif
471 468 #ifndef M_READDATE_BSD
472 469 #define M_READDATE_BSD 1
473 470 #endif
474 471
475 472 #ifdef M_MALLOC
476 473 LEXTERN _VOID *m_malloc (size_t size);
477 474 #else
478 475 # define m_malloc(size) malloc(size)
479 476 #endif /*M_MALLOC*/
480 477
481 478 #ifdef M_REALLOC
482 479 LEXTERN _VOID *m_realloc (void* ptr, size_t size);
483 480 #else
484 481 # define m_realloc realloc
485 482 #endif /*M_MALLOC*/
486 483
487 484 #ifdef NAME_MAX
488 485 #define m_namemax(path) NAME_MAX
489 486 #else
490 487 LEXTERN int m_namemax (char *path);
491 488 #endif /*NAME_MAX*/
492 489
493 490 #ifdef PATH_MAX
494 491 #define m_pathmax(path) PATH_MAX
495 492 #else
496 493 LEXTERN int m_pathmax (char *path);
497 494 #endif /* PATH_MAX */
498 495
499 496 #ifdef M_DEVBIN
500 497 LEXTERN int m_devbin (int fd); /* begin raw I/O transfer */
501 498 LEXTERN void m_devstd (int fd, int mode); /* end raw I/O transfer */
502 499 #else
503 500 # define m_devbin(fd) 0
504 501 # define m_devstd(fd, mode)
505 502 #endif /*M_DEVBIN*/
506 503
507 504 #ifndef m_setbinary
508 505 #define m_setbinary(fp)
509 506 #endif /*m_setbinary*/
510 507
511 508 #ifndef M_PRIO_PROCESS
512 509 #define M_PRIO_PROCESS 0
513 510 #endif
514 511 #ifndef M_PRIO_PGRP
515 512 #define M_PRIO_PGRP 1
516 513 #endif
517 514 #ifndef M_PRIO_USER
518 515 #define M_PRIO_USER 2
519 516 #endif
520 517
521 518 /* m_wallow type values */
522 519 #ifndef MWA_NO
523 520 #define MWA_NO 0 /* Deny talk, write */
524 521 #endif
525 522 #ifndef MWA_YES
526 523 #define MWA_YES 1 /* Allow talk, write */
527 524 #endif
528 525 #ifndef MWA_TEST
529 526 #define MWA_TEST 2 /* Test for YES/NO */
530 527 #endif
531 528
532 529 /* Interface for compression (m_cm_*) and decompression (m_dc_*) */
533 530 LEXTERN int m_cm_open (int (*wrtfn) (const uchar *,int), int);
534 531 LEXTERN int m_cm_write (const uchar *, int);
535 532 LEXTERN int m_cm_close (int);
536 533 LEXTERN char *m_cm_error (void);
537 534 LEXTERN int m_dc_open (ssize_t (*rdfn)(uchar *, int));
538 535 LEXTERN ssize_t m_dc_read (uchar *, size_t);
539 536 LEXTERN int m_dc_close (int);
540 537 LEXTERN char *m_dc_error (void);
541 538
542 539 LEXTERN int m_mkpardir (char *);
543 540
544 541 /*
545 542 * Some UNIX routines that aren't in SVID
546 543 */
547 544 LEXTERN void cfree (void *, size_t, size_t);
548 545 LEXTERN void swaw (const short *, short *, int);
549 546
550 547 /* Some dos routines we sometimes want from posix utilities */
551 548 LEXTERN void _uttoof (time_t, ushort *, ushort *);
552 549 LEXTERN time_t _oftout (ushort, ushort);
553 550
554 551
555 552 #ifndef M_SETENV
556 553 #define m_setenv() environ
557 554 #endif
558 555
559 556 #ifdef M_NON_STATIC_GETENV
560 557 #define __m_getenv getenv
561 558 #else
562 559 LEXTERN char *__m_getenv(char const *); /* Library safe getenv() */
563 560 #endif
564 561
565 562 #ifndef M_CRON_MAILER
566 563 /*
567 564 * Default case: assume only POSIX.2 mailx is available.
568 565 * Must be careful when cron sends output to mailx.
569 566 * We must ensure that lines with leading '~' are escaped
570 567 * so mailx doesn't interpret these lines
571 568 * This string MUST include a trailing space character.
572 569 */
573 570 #define M_CRON_MAILER "sed -e s/^~/~~/ | mailx "
574 571 #endif
575 572
576 573 /*
577 574 * m_cp() - copy a file in an O/S specific way. See m_cp.3
578 575 * for details
579 576 */
580 577
581 578 /* Return codes */
582 579 #define M_CP_ERR -1
583 580 #define M_CP_NOOP -2
584 581
585 582 /* processing flags */
586 583 #define M_CP_PRESERVE 1
587 584
588 585 /*
589 586 * MKS MEMORY MANIPULATIONS:
590 587 * Specific to MKS and non-portable.
591 588 */
592 589 LEXTERN _VOID *membtst (const char *s, size_t m, int c);
593 590
594 591 #ifdef M_LDATA
595 592 #define memLchr memchr
596 593 #define memSLccpy memccpy
597 594 #define memLbtst membtst
598 595 #define memLset memset
599 596 #define memLLcpy memcpy
600 597 #define memLLrlcpy memrlcpy
601 598 #define memLLcmp memcmp
602 599 #else
603 600 /* for machines with small data models (e.g PC's - DOS, OS2) */
604 601 LEXTERN void far*memLchr (const void far*s, int c, size_t n);
605 602 LEXTERN void *memSLccpy (_VOID *s1, const _VOID far*s2, int, size_t n);
606 603 LEXTERN void far*memLbtst (const char far*s, size_t m, int n);
607 604 LEXTERN void far*memLset (void far*s, int c, size_t n);
608 605 LEXTERN void far*memLsetl (void far*p, int value, long count);
609 606 LEXTERN void far*memLLcpy (void far*s1, const void far*s2, size_t n);
610 607 LEXTERN void far*memLLrlcpy (void far*s1, const void far*s2, size_t);
611 608 LEXTERN int memLLcmp (const void far *s1,const void far *s2,size_t n);
612 609 #endif /* M_LDATA */
613 610
614 611
615 612 /* mks error handling routines */
616 613 #include <stdarg.h>
617 614 LEXTERN void m_error (const char * fmt, ...);
618 615 LEXTERN void m_errorexit (const char *fmt, va_list args);
619 616 LEXTERN void m_errorret (const char *fmt, va_list args);
620 617 LEXTERN void m_errorjmp (const char *fmt, va_list args);
621 618 LEXTERN void m_errornull (const char *fmt, va_list args);
622 619 LEXTERN void (*m_errorfn) (const char *fmt, va_list args);
623 620 #define M_ERROR(fn) void (*m_errorfn) (const char *fmt, va_list args) = fn
624 621
625 622 /*
626 623 * The filesystem type and attribute routine
627 624 */
628 625 #ifndef M_FSTYPE
629 626 #define m_fstype(path) M_FSTYPE_POSIX
630 627 #endif
631 628
632 629 /* File system types */
633 630 #define M_FSTYPE_MASK 0x1
634 631 #define M_FSTYPE_POSIX 0
635 632 #define M_FSTYPE_FAT 1
636 633
637 634 /* File system attributes */
638 635 #define M_FSATTR_NO_LEADING_DOT 0x08
639 636 #define M_FSATTR_ONE_DOT 0x10
640 637 #define M_FSATTR_SHORT_FILENAME 0x20
641 638 #define M_FSATTR_SHORT_EXT 0x40
642 639 #define M_FSATTR_LOWER_CASE 0x80
643 640
644 641 /* This one should be ifdef'ed on something else */
645 642 #ifndef M_FNMATCH_DUALCASE
646 643 #define m_get_original_filename_case(path) /* nil */
647 644 #endif
648 645
649 646 /*
650 647 * m_tempname() generates a filename for a temp file using "code"
651 648 * in the name.
652 649 */
653 650 #ifndef M_TEMPNAME
654 651 #define m_tempname(code) tempnam(__m_getenv("TMPDIR"), (code))
655 652 #else
656 653 char *m_tempname(char const *code);
657 654 #endif
658 655
659 656 /*
660 657 * __m_getopt() alternate "stateless" entry into getopt().
661 658 */
662 659
663 660 struct getopt_state {
664 661 char *optarg; /* Argument */
665 662 int optind; /* Index into argv */
666 663 int opterr; /* Print error message */
667 664 int optopt; /* Invalid option */
668 665 int index; /* argv[optind] index */
669 666 #ifdef M_I18N_MB
670 667 mbstate_t st; /* State of argv[optind][index] */
671 668 #endif
672 669 };
673 670
674 671 int __m_getopt(int argc, char * const *argv, char const *optstring,
675 672 struct getopt_state *state);
676 673
677 674
678 675 #ifdef M_MKSEXTRA_H
679 676 /* Any overrides etcetera for a particular system can go in here */
680 677 #include <mksextra.h>
681 678 #endif /* M_MKSEXTRA_H */
682 679
683 680 #endif /* __M_MKS_H__ */
↓ open down ↓ |
332 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX