chiark / gitweb /
finalise changelog
[bash.git] / debian / bash.preinst.h
1 #ifndef BASH_PREINST_H
2 #define BASH_PREINST_H
3
4 /*
5  * This file is in the public domain.
6  * You may freely use, modify, distribute, and relicense it.
7  */
8
9 #define _XOPEN_SOURCE 700
10 #include <stdio.h>
11 #include <stdarg.h>
12 #include <sys/types.h>
13
14 #if !defined(__GNUC__) && !defined(__attribute__)
15 # define __attribute__(x)
16 #endif
17 #define NORETURN __attribute__((__noreturn__))
18 #define PRINTFLIKE __attribute__((format(printf, 1, 2)))
19
20 enum wait_or_die_flags {
21         ERROR_OK = 1,
22         SIGPIPE_OK = 2
23 };
24
25 extern NORETURN PRINTFLIKE void die_errno(const char *fmt, ...);
26 extern NORETURN PRINTFLIKE void die(const char *fmt, ...);
27
28 extern int exists(const char *path);
29 extern void set_cloexec(int fd);
30 extern void xpipe(int pipefd[2]);
31
32 extern void wait_or_die(pid_t child, const char *desc, int flags);
33 extern pid_t spawn(const char * const cmd[], int outfd, int errfd);
34 extern void run(const char * const cmd[]);      /* spawn and wait */
35 extern FILE *spawn_pipe(pid_t *pid, const char * const cmd[], int errfd);
36
37 #endif