diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-01-22 22:55:11 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-01-22 22:55:11 +0000 |
commit | 86f5c9906beac527f3d7966f24811b571a589e08 (patch) | |
tree | 1c9eba853c728b5d734506e1c66c269d96fe46ea /include/libbb.h | |
parent | 2edf52643d3eb3d13f26d31f9678cf122f2063bc (diff) | |
download | busybox-w32-86f5c9906beac527f3d7966f24811b571a589e08.tar.gz busybox-w32-86f5c9906beac527f3d7966f24811b571a589e08.tar.bz2 busybox-w32-86f5c9906beac527f3d7966f24811b571a589e08.zip |
- add platform.h.
- use shorter boilerplate while at it.
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/include/libbb.h b/include/libbb.h index 2e697a350..8ec1a24c0 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -2,27 +2,14 @@ | |||
2 | /* | 2 | /* |
3 | * Busybox main internal header file | 3 | * Busybox main internal header file |
4 | * | 4 | * |
5 | * | 5 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | 6 | * |
20 | * Based in part on code from sash, Copyright (c) 1999 by David I. Bell | 7 | * Based in part on code from sash, Copyright (c) 1999 by David I. Bell |
21 | * Permission has been granted to redistribute this code under the GPL. | 8 | * Permission has been granted to redistribute this code under the GPL. |
22 | * | 9 | * |
23 | */ | 10 | */ |
24 | #ifndef __LIBCONFIG_H__ | 11 | #ifndef __LIBBUSYBOX_H__ |
25 | #define __LIBCONFIG_H__ 1 | 12 | #define __LIBBUSYBOX_H__ 1 |
26 | 13 | ||
27 | #include <stdio.h> | 14 | #include <stdio.h> |
28 | #include <stdlib.h> | 15 | #include <stdlib.h> |
@@ -36,6 +23,7 @@ | |||
36 | 23 | ||
37 | #include <features.h> | 24 | #include <features.h> |
38 | 25 | ||
26 | #include "platform.h" | ||
39 | #include "bb_config.h" | 27 | #include "bb_config.h" |
40 | #ifdef CONFIG_SELINUX | 28 | #ifdef CONFIG_SELINUX |
41 | #include <selinux/selinux.h> | 29 | #include <selinux/selinux.h> |
@@ -50,21 +38,6 @@ | |||
50 | # include "sha1.h" | 38 | # include "sha1.h" |
51 | #endif | 39 | #endif |
52 | 40 | ||
53 | /* Convenience macros to test the version of gcc. */ | ||
54 | #if defined __GNUC__ && defined __GNUC_MINOR__ | ||
55 | # define __GNUC_PREREQ(maj, min) \ | ||
56 | ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) | ||
57 | #else | ||
58 | # define __GNUC_PREREQ(maj, min) 0 | ||
59 | #endif | ||
60 | |||
61 | /* __restrict is known in EGCS 1.2 and above. */ | ||
62 | #if !__GNUC_PREREQ (2,92) | ||
63 | # define __restrict /* Ignore */ | ||
64 | #endif | ||
65 | |||
66 | #define attribute_noreturn __attribute__ ((__noreturn__)) | ||
67 | |||
68 | /* Some useful definitions */ | 41 | /* Some useful definitions */ |
69 | #define FALSE ((int) 0) | 42 | #define FALSE ((int) 0) |
70 | #define TRUE ((int) 1) | 43 | #define TRUE ((int) 1) |
@@ -86,7 +59,7 @@ | |||
86 | #define MAX(a,b) (((a)>(b))?(a):(b)) | 59 | #define MAX(a,b) (((a)>(b))?(a):(b)) |
87 | #endif | 60 | #endif |
88 | 61 | ||
89 | extern void bb_show_usage(void) __attribute__ ((noreturn, externally_visible)); | 62 | extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE; |
90 | extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 63 | extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
91 | extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 64 | extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
92 | extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 65 | extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
@@ -95,7 +68,7 @@ extern void bb_vherror_msg(const char *s, va_list p); | |||
95 | extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 68 | extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
96 | extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 69 | extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
97 | 70 | ||
98 | extern void bb_perror_nomsg_and_die(void) __attribute__ ((noreturn)); | 71 | extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN; |
99 | extern void bb_perror_nomsg(void); | 72 | extern void bb_perror_nomsg(void); |
100 | 73 | ||
101 | /* These two are used internally -- you shouldn't need to use them */ | 74 | /* These two are used internally -- you shouldn't need to use them */ |
@@ -147,7 +120,7 @@ extern FILE *bb_wfopen_input(const char *filename); | |||
147 | extern FILE *bb_xfopen(const char *path, const char *mode); | 120 | extern FILE *bb_xfopen(const char *path, const char *mode); |
148 | 121 | ||
149 | extern int bb_fclose_nonstdin(FILE *f); | 122 | extern int bb_fclose_nonstdin(FILE *f); |
150 | extern void bb_fflush_stdout_and_exit(int retval) __attribute__ ((noreturn)); | 123 | extern void bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN; |
151 | 124 | ||
152 | #define BB_GETOPT_ERROR 0x80000000UL | 125 | #define BB_GETOPT_ERROR 0x80000000UL |
153 | extern const char *bb_opt_complementally; | 126 | extern const char *bb_opt_complementally; |
@@ -498,4 +471,4 @@ extern int hash_fd(int fd, const size_t size, const uint8_t hash_algo, uint8_t * | |||
498 | #include <dmalloc.h> | 471 | #include <dmalloc.h> |
499 | #endif | 472 | #endif |
500 | 473 | ||
501 | #endif /* __LIBCONFIG_H__ */ | 474 | #endif /* __LIBBUSYBOX_H__ */ |