aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-01-22 22:55:11 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-01-22 22:55:11 +0000
commit86f5c9906beac527f3d7966f24811b571a589e08 (patch)
tree1c9eba853c728b5d734506e1c66c269d96fe46ea
parent2edf52643d3eb3d13f26d31f9678cf122f2063bc (diff)
downloadbusybox-86f5c9906beac527f3d7966f24811b571a589e08.tar.gz
- add platform.h.
- use shorter boilerplate while at it.
-rw-r--r--Makefile13
-rw-r--r--applets/busybox.c2
-rw-r--r--archival/libunarchive/header_skip.c2
-rw-r--r--archival/unzip.c23
-rw-r--r--coreutils/stty.c13
-rw-r--r--e2fsprogs/tune2fs.c2
-rw-r--r--e2fsprogs/uuid/uuid.h2
-rw-r--r--editors/awk.c19
-rw-r--r--include/busybox.h23
-rw-r--r--include/libbb.h43
-rw-r--r--include/platform.h82
-rw-r--r--loginutils/adduser.c17
-rw-r--r--loginutils/getty.c2
-rw-r--r--networking/inetd.c22
-rw-r--r--networking/libiproute/ip_common.h5
-rw-r--r--networking/libiproute/iproute.c2
-rw-r--r--networking/libiproute/utils.h9
-rw-r--r--networking/nameif.c4
-rw-r--r--networking/traceroute.c2
-rw-r--r--networking/udhcp/arpping.h2
-rw-r--r--networking/udhcp/dhcpc.c18
-rw-r--r--networking/udhcp/dumpleases.c6
-rw-r--r--networking/zcip.c19
-rw-r--r--shell/ash.c34
-rw-r--r--shell/hush.c16
-rw-r--r--shell/lash.c17
-rw-r--r--sysklogd/klogd.c19
-rw-r--r--sysklogd/syslogd.c17
-rw-r--r--util-linux/fdisk.c9
-rw-r--r--util-linux/fsck_minix.c2
30 files changed, 182 insertions, 264 deletions
diff --git a/Makefile b/Makefile
index b71803d74..267f6b7b6 100644
--- a/Makefile
+++ b/Makefile
@@ -381,7 +381,7 @@ docs/busybox.net/BusyBox.html: docs/busybox.pod
scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
-DEP_INCLUDES := include/config.h include/bb_config.h
+DEP_INCLUDES := include/config.h include/bb_config.h include/_usage.h
ifeq ($(strip $(CONFIG_BBCONFIG)),y)
DEP_INCLUDES += include/bbconfigopts.h
@@ -411,13 +411,22 @@ include/bb_config.h: include/config.h
< $< >> $@
@echo "#endif" >> $@
+# Create macros for usage.h, e.g.:
+#if ENABLE_HAVE_DOT_CONFIG
+#define USAGE_HAVE_DOT_CONFIG(a) a
+#else
+#define USAGE_HAVE_DOT_CONFIG(a)
+#endif
+include/_usage.h: .config
+ awk '/CONFIG|BB_APPLET/{gsub("#[[:space:]]*|=y|.*CONFIG_|.*BB_APPLET_","");if(!/=/){print("#if ENABLE_"$$1"\n#define USAGE_"$$1"(a) a\n#else\n#define USAGE_"$$1"(a)\n#endif");}}' $(<) > $(@)
+
clean:
- $(MAKE) -C scripts/config $@
- $(RM_F) docs/busybox.dvi docs/busybox.ps \
docs/busybox.pod docs/busybox.net/busybox.html \
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
- docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
+ docs/busybox.net/BusyBox.html busybox.links include/_usage.h \
$(DO_INSTALL_LIBS) $(LIBBUSYBOX_SONAME) \
.config.old busybox
- rm -rf _install testsuite/links
diff --git a/applets/busybox.c b/applets/busybox.c
index 3d7a0fd0b..db78b7ccd 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -11,7 +11,7 @@
#define setlocale(x,y)
#endif
-const char *bb_applet_name __attribute__((externally_visible));
+const char *bb_applet_name ATTRIBUTE_EXTERNALLY_VISIBLE;
#ifdef CONFIG_FEATURE_INSTALLER
/*
diff --git a/archival/libunarchive/header_skip.c b/archival/libunarchive/header_skip.c
index 0b153980e..963d113a4 100644
--- a/archival/libunarchive/header_skip.c
+++ b/archival/libunarchive/header_skip.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include "unarchive.h"
-extern void header_skip(const file_header_t *file_header __attribute__((unused)))
+extern void header_skip(const file_header_t *file_header ATTRIBUTE_UNUSED)
{
}
diff --git a/archival/unzip.c b/archival/unzip.c
index 50d148692..caac716cc 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -7,20 +7,7 @@
* Loosely based on original busybox unzip applet by Laurence Anderson.
* All options and features should work in this version.
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/* For reference see
@@ -79,12 +66,12 @@ typedef union {
unsigned short method; /* 4-5 */
unsigned short modtime; /* 6-7 */
unsigned short moddate; /* 8-9 */
- unsigned int crc32 __attribute__ ((packed)); /* 10-13 */
- unsigned int cmpsize __attribute__ ((packed)); /* 14-17 */
- unsigned int ucmpsize __attribute__ ((packed)); /* 18-21 */
+ unsigned int crc32 ATTRIBUTE_PACKED; /* 10-13 */
+ unsigned int cmpsize ATTRIBUTE_PACKED; /* 14-17 */
+ unsigned int ucmpsize ATTRIBUTE_PACKED; /* 18-21 */
unsigned short filename_len; /* 22-23 */
unsigned short extra_len; /* 24-25 */
- } formated __attribute__ ((packed));
+ } formated ATTRIBUTE_PACKED;
} zip_header_t;
static void unzip_skip(int fd, off_t skip)
diff --git a/coreutils/stty.c b/coreutils/stty.c
index d62068668..cbd2c22e9 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -2,15 +2,8 @@
/* stty -- change and print terminal line settings
Copyright (C) 1990-1999 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
+ Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+*/
/* Usage: stty [-ag] [-F device] [setting...]
Options:
@@ -428,7 +421,7 @@ static void set_window_size(int rows, int cols, int fd);
static const char *device_name;
-static __attribute__ ((noreturn)) void perror_on_device(const char *fmt)
+static ATTRIBUTE_NORETURN void perror_on_device(const char *fmt)
{
bb_perror_msg_and_die(fmt, device_name);
}
diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c
index e36c47734..f23688bc3 100644
--- a/e2fsprogs/tune2fs.c
+++ b/e2fsprogs/tune2fs.c
@@ -566,7 +566,7 @@ MOUNTS_COUNT_ERROR:
}
#ifdef CONFIG_FINDFS
-static attribute_noreturn void do_findfs(int argc, char **argv)
+static ATTRIBUTE_NORETURN void do_findfs(int argc, char **argv)
{
if ((argc != 2) ||
(strncmp(argv[1], "LABEL=", 6) && strncmp(argv[1], "UUID=", 5)))
diff --git a/e2fsprogs/uuid/uuid.h b/e2fsprogs/uuid/uuid.h
index ec6ba52d7..a05f1c690 100644
--- a/e2fsprogs/uuid/uuid.h
+++ b/e2fsprogs/uuid/uuid.h
@@ -54,7 +54,7 @@ typedef unsigned char uuid_t[16];
/* Allow UUID constants to be defined */
#ifdef __GNUC__
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
- static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
+ static const uuid_t name ATTRIBUTE_UNUSED = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
#else
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
diff --git a/editors/awk.c b/editors/awk.c
index 4bd872924..80ff8c77b 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -4,20 +4,7 @@
*
* Copyright (C) 2002 by Dmitry Zakharov <dmit@crp.bank.gov.ua>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <stdio.h>
@@ -445,7 +432,7 @@ static void chain_group(void);
static var *evaluate(node *, var *);
static rstream *next_input_file(void);
static int fmt_num(char *, int, const char *, double, int);
-static int awk_exit(int) attribute_noreturn;
+static int awk_exit(int) ATTRIBUTE_NORETURN;
/* ---- error handling ---- */
@@ -462,7 +449,7 @@ static const char EMSG_UNDEF_FUNC[] = "Call to undefined function";
static const char EMSG_NO_MATH[] = "Math support is not compiled in";
#endif
-static void syntax_error(const char * const message) attribute_noreturn;
+static void syntax_error(const char * const message) ATTRIBUTE_NORETURN;
static void syntax_error(const char * const message)
{
bb_error_msg_and_die("%s:%i: %s", programname, lineno, message);
diff --git a/include/busybox.h b/include/busybox.h
index f16be706d..9fb95036e 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -2,24 +2,7 @@
/*
* Busybox main internal header file
*
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
- * Permission has been granted to redistribute this code under the GPL.
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#ifndef _BB_INTERNAL_H_
#define _BB_INTERNAL_H_ 1
@@ -66,8 +49,8 @@ enum SUIDRoot {
struct BB_applet {
const char *name;
int (*main) (int argc, char **argv);
- enum Location location:4;
- enum SUIDRoot need_suid:4;
+ __extension__ enum Location location:4;
+ __extension__ enum SUIDRoot need_suid:4;
};
/* From busybox.c */
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 @@
/*
* Busybox main internal header file
*
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
*/
-#ifndef __LIBCONFIG_H__
-#define __LIBCONFIG_H__ 1
+#ifndef __LIBBUSYBOX_H__
+#define __LIBBUSYBOX_H__ 1
#include <stdio.h>
#include <stdlib.h>
@@ -36,6 +23,7 @@
#include <features.h>
+#include "platform.h"
#include "bb_config.h"
#ifdef CONFIG_SELINUX
#include <selinux/selinux.h>
@@ -50,21 +38,6 @@
# include "sha1.h"
#endif
-/* Convenience macros to test the version of gcc. */
-#if defined __GNUC__ && defined __GNUC_MINOR__
-# define __GNUC_PREREQ(maj, min) \
- ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-#else
-# define __GNUC_PREREQ(maj, min) 0
-#endif
-
-/* __restrict is known in EGCS 1.2 and above. */
-#if !__GNUC_PREREQ (2,92)
-# define __restrict /* Ignore */
-#endif
-
-#define attribute_noreturn __attribute__ ((__noreturn__))
-
/* Some useful definitions */
#define FALSE ((int) 0)
#define TRUE ((int) 1)
@@ -86,7 +59,7 @@
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
-extern void bb_show_usage(void) __attribute__ ((noreturn, externally_visible));
+extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
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);
extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
-extern void bb_perror_nomsg_and_die(void) __attribute__ ((noreturn));
+extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
extern void bb_perror_nomsg(void);
/* These two are used internally -- you shouldn't need to use them */
@@ -147,7 +120,7 @@ extern FILE *bb_wfopen_input(const char *filename);
extern FILE *bb_xfopen(const char *path, const char *mode);
extern int bb_fclose_nonstdin(FILE *f);
-extern void bb_fflush_stdout_and_exit(int retval) __attribute__ ((noreturn));
+extern void bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN;
#define BB_GETOPT_ERROR 0x80000000UL
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 *
#include <dmalloc.h>
#endif
-#endif /* __LIBCONFIG_H__ */
+#endif /* __LIBBUSYBOX_H__ */
diff --git a/include/platform.h b/include/platform.h
new file mode 100644
index 000000000..763292d7a
--- /dev/null
+++ b/include/platform.h
@@ -0,0 +1,82 @@
+/*
+ Copyright 2006, Bernhard Fischer
+
+ Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+*/
+#ifndef __PLATFORM_H
+#define __PLATFORM_H 1
+
+/* Convenience macros to test the version of gcc. */
+#undef __GNUC_PREREQ
+#if defined __GNUC__ && defined __GNUC_MINOR__
+# define __GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+# define __GNUC_PREREQ(maj, min) 0
+#endif
+
+/* __restrict is known in EGCS 1.2 and above. */
+#if !__GNUC_PREREQ (2,92)
+# ifndef __restrict
+# define __restrict /* Ignore */
+# endif
+#endif
+
+/* Define macros for some gcc attributes. This permits us to use the
+ macros freely, and know that they will come into play for the
+ version of gcc in which they are supported. */
+
+#if !__GNUC_PREREQ (2,7)
+# ifndef __attribute__
+# define __attribute__(x)
+# endif
+#endif
+
+#if 0
+/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
+#ifndef ATTRIBUTE_MALLOC
+# if __GNUC_PREREQ (2,96)
+# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+# define ATTRIBUTE_MALLOC
+# endif /* GNUC >= 2.96 */
+#endif /* ATTRIBUTE_MALLOC */
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif /* ATTRIBUTE_UNUSED */
+
+#ifndef ATTRIBUTE_NORETURN
+#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif /* ATTRIBUTE_NORETURN */
+
+#ifndef ATTRIBUTE_PACKED
+#define ATTRIBUTE_PACKED __attribute__ ((__packed__))
+#endif /* ATTRIBUTE_NORETURN */
+
+/* -fwhole-program makes all symbols local. The attribute externally_visible
+ forces a symbol global. */
+#ifndef ATTRIBUTE_EXTERNALLY_VISIBLE
+# if __GNUC_PREREQ (4,1)
+# define ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((__externally_visible__))
+# else
+# define ATTRIBUTE_EXTERNALLY_VISIBLE
+# endif /* GNUC >= 4.1 */
+#endif /* ATTRIBUTE_EXTERNALLY_VISIBLE */
+
+/* We use __extension__ in some places to suppress -pedantic warnings
+ about GCC extensions. This feature didn't work properly before
+ gcc 2.8. */
+#if !__GNUC_PREREQ (2,8)
+# ifndef __extension__
+# define __extension__
+# endif
+#endif
+
+
+/* include USAGE_APPLET_x helper macros for usage.h. */
+/*
+#include "_usage.h"
+*/
+#endif /* platform.h */
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index 5ff0cd962..a25632e44 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -5,20 +5,7 @@
* Copyright (C) 1999 by Lineo, inc. and John Beppu
* Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#ifndef _GNU_SOURCE
@@ -122,7 +109,7 @@ static void addgroup_wrapper(const char *login, gid_t gid)
free(cmd);
}
-static void passwd_wrapper(const char *login) __attribute__ ((noreturn));
+static void passwd_wrapper(const char *login) ATTRIBUTE_NORETURN;
static void passwd_wrapper(const char *login)
{
diff --git a/loginutils/getty.c b/loginutils/getty.c
index 1cfbd6734..1399118a5 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -225,7 +225,7 @@ static void termio_final(struct options *op, struct termio *tp,
struct chardata *cp);
static int caps_lock(const char *s);
static int bcode(const char *s);
-static void error(const char *fmt, ...) __attribute__ ((noreturn));
+static void error(const char *fmt, ...) ATTRIBUTE_NORETURN;
#ifdef SYSV_STYLE
#ifdef CONFIG_FEATURE_UTMP
diff --git a/networking/inetd.c b/networking/inetd.c
index 5388bf789..7a6ffae0c 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -928,7 +928,7 @@ static int matchconf (servtab_t *old, servtab_t *new)
return (1);
}
-static void config (int sig __attribute__((unused)))
+static void config (int sig ATTRIBUTE_UNUSED)
{
servtab_t *sep, *cp, **sepp;
sigset_t omask;
@@ -1149,7 +1149,7 @@ static void config (int sig __attribute__((unused)))
}
-static void reapchild (int sig __attribute__((unused)))
+static void reapchild (int sig ATTRIBUTE_UNUSED)
{
pid_t pid;
int save_errno = errno, status;
@@ -1176,7 +1176,7 @@ static void reapchild (int sig __attribute__((unused)))
errno = save_errno;
}
-static void retry (int sig __attribute__((unused)))
+static void retry (int sig ATTRIBUTE_UNUSED)
{
servtab_t *sep;
@@ -1200,7 +1200,7 @@ static void retry (int sig __attribute__((unused)))
}
}
-static void goaway (int sig __attribute__((unused)))
+static void goaway (int sig ATTRIBUTE_UNUSED)
{
servtab_t *sep;
@@ -1582,7 +1582,7 @@ echo_stream (int s, servtab_t *sep)
/* Echo service -- echo data back */
/* ARGSUSED */
static void
-echo_dg (int s, servtab_t *sep __attribute__((unused)))
+echo_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
char buffer[BUFSIZE];
int i;
@@ -1616,7 +1616,7 @@ discard_stream (int s, servtab_t *sep)
/* Discard service -- ignore data */
/* ARGSUSED */
static void
-discard_dg (int s, servtab_t *sep __attribute__((unused)))
+discard_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
char buffer[BUFSIZE];
@@ -1678,7 +1678,7 @@ chargen_stream (int s, servtab_t *sep)
/* Character generator */
/* ARGSUSED */
static void
-chargen_dg (int s, servtab_t *sep __attribute__((unused)))
+chargen_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
/* struct sockaddr_storage ss; */
struct sockaddr sa;
@@ -1735,7 +1735,7 @@ static u_int machtime (void)
/* ARGSUSED */
static void
-machtime_stream (int s, servtab_t *sep __attribute__((unused)))
+machtime_stream (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
u_int result;
@@ -1745,7 +1745,7 @@ machtime_stream (int s, servtab_t *sep __attribute__((unused)))
/* ARGSUSED */
static void
-machtime_dg (int s, servtab_t *sep __attribute__((unused)))
+machtime_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
u_int result;
/* struct sockaddr_storage ss; */
@@ -1770,7 +1770,7 @@ machtime_dg (int s, servtab_t *sep __attribute__((unused)))
#ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_DAYTIME
/* Return human-readable time of day */
/* ARGSUSED */
-static void daytime_stream (int s, servtab_t *sep __attribute__((unused)))
+static void daytime_stream (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
char buffer[256];
time_t t;
@@ -1784,7 +1784,7 @@ static void daytime_stream (int s, servtab_t *sep __attribute__((unused)))
/* Return human-readable time of day */
/* ARGSUSED */
void
-daytime_dg (int s, servtab_t *sep __attribute__((unused)))
+daytime_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
char buffer[256];
time_t t;
diff --git a/networking/libiproute/ip_common.h b/networking/libiproute/ip_common.h
index 25e9c6c81..71be8269e 100644
--- a/networking/libiproute/ip_common.h
+++ b/networking/libiproute/ip_common.h
@@ -1,3 +1,5 @@
+#ifndef _IP_COMMON_H
+#define _IP_COMMON_H 1
extern int preferred_family;
extern char * _SL_;
@@ -5,7 +7,7 @@ extern void ip_parse_common_args(int *argcp, char ***argvp);
extern int print_neigh(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
extern int ipaddr_list_or_flush(int argc, char **argv, int flush);
extern int iproute_monitor(int argc, char **argv);
-extern void iplink_usage(void) __attribute__((noreturn));
+extern void iplink_usage(void) ATTRIBUTE_NORETURN;
extern void ipneigh_reset_filter(void);
extern int do_ipaddr(int argc, char **argv);
extern int do_iproute(int argc, char **argv);
@@ -16,3 +18,4 @@ extern int do_iplink(int argc, char **argv);
extern int do_ipmonitor(int argc, char **argv);
extern int do_multiaddr(int argc, char **argv);
extern int do_multiroute(int argc, char **argv);
+#endif /* ip_common.h */
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index a15fc81dc..b622afd47 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -63,7 +63,7 @@ static int flush_update(void)
return 0;
}
-static int print_route(struct sockaddr_nl *who __attribute__((unused)),
+static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index e79e177b9..3d223edf6 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -7,6 +7,7 @@
#include "libnetlink.h"
#include "ll_map.h"
#include "rtm_map.h"
+#include "libbb.h"
extern int preferred_family;
extern int show_stats;
@@ -26,7 +27,7 @@ extern char * _SL_;
#define SPRINT_BSIZE 64
#define SPRINT_BUF(x) char x[SPRINT_BSIZE]
-extern void incomplete_command(void) __attribute__((noreturn));
+extern void incomplete_command(void) ATTRIBUTE_NORETURN;
#define NEXT_ARG() do { argv++; if (--argc <= 0) incomplete_command(); } while(0)
@@ -76,9 +77,9 @@ extern int get_s8(__s8 *val, char *arg, int base);
extern const char *format_host(int af, int len, void *addr, char *buf, int buflen);
extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen);
-void invarg(char *, char *) __attribute__((noreturn));
-void duparg(char *, char *) __attribute__((noreturn));
-void duparg2(char *, char *) __attribute__((noreturn));
+void invarg(char *, char *) ATTRIBUTE_NORETURN;
+void duparg(char *, char *) ATTRIBUTE_NORETURN;
+void duparg2(char *, char *) ATTRIBUTE_NORETURN;
int matches(char *arg, char *pattern);
extern int inet_addr_match(inet_prefix *a, inet_prefix *b, int bits);
diff --git a/networking/nameif.c b/networking/nameif.c
index a2c8b4915..f28e5ebe3 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -5,7 +5,7 @@
* Busybox port 2002 by Nick Fedchik <nick@fedchik.org.ua>
* Glenn McGrath <bug1@iinet.net.au>
*
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <sys/syslog.h>
@@ -48,7 +48,7 @@ typedef struct mactable_s {
static unsigned long flags;
-static void serror(const char *s, ...) __attribute__ ((noreturn));
+static void serror(const char *s, ...) ATTRIBUTE_NORETURN;
static void serror(const char *s, ...)
{
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 690e21f82..b6252ad3e 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -281,7 +281,7 @@ struct hostinfo {
struct outdata {
u_char seq; /* sequence number of this packet */
u_char ttl; /* ttl packet left with */
- struct timeval tv __attribute__((packed)); /* time packet left */
+ struct timeval tv ATTRIBUTE_PACKED; /* time packet left */
};
struct IFADDRLIST {
diff --git a/networking/udhcp/arpping.h b/networking/udhcp/arpping.h
index 6f27d9f75..30959ca99 100644
--- a/networking/udhcp/arpping.h
+++ b/networking/udhcp/arpping.h
@@ -27,7 +27,7 @@ struct arpMsg {
uint8_t tHaddr[6]; /* target's hardware address */
uint8_t tInaddr[4]; /* target's IP address */
uint8_t pad[18]; /* pad for min. Ethernet payload (60 bytes) */
-} __attribute__ ((packed));
+} ATTRIBUTE_PACKED;
/* function prototypes */
int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface);
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index d5c69db42..c4277e3f1 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -4,19 +4,7 @@
*
* Russ Dill <Russ.Dill@asu.edu> July 2001
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <sys/time.h>
@@ -74,7 +62,7 @@ struct client_config_t client_config = {
};
#ifndef IN_BUSYBOX
-static void __attribute__ ((noreturn)) show_usage(void)
+static void ATTRIBUTE_NORETURN show_usage(void)
{
printf(
"Usage: udhcpc [OPTIONS]\n\n"
@@ -101,7 +89,7 @@ static void __attribute__ ((noreturn)) show_usage(void)
}
#else
#define show_usage bb_show_usage
-extern void show_usage(void) __attribute__ ((noreturn));
+extern void show_usage(void) ATTRIBUTE_NORETURN;
#endif
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index a9036dfbd..ca5c6059e 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -1,3 +1,7 @@
+/* vi: set sw=4 ts=4: */
+/*
+ Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ */
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
@@ -21,7 +25,7 @@
#ifndef IN_BUSYBOX
-static void __attribute__ ((noreturn)) show_usage(void)
+static void ATTRIBUTE_NORETURN show_usage(void)
{
printf(
"Usage: dumpleases -f <file> -[r|a]\n\n"
diff --git a/networking/zcip.c b/networking/zcip.c
index ad1131f3b..294ffd066 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -5,20 +5,7 @@
* Copyright (C) 2003 by Arthur van Hoff (avh@strangeberry.com)
* Copyright (C) 2004 by David Brownell
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/*
@@ -73,7 +60,7 @@ struct arp_packet {
struct in_addr source_ip;
struct ether_addr target_addr;
struct in_addr target_ip;
-} __attribute__ ((__packed__));
+} ATTRIBUTE_PACKED;
/* 169.254.0.0 */
static const uint32_t LINKLOCAL_ADDR = 0xa9fe0000;
@@ -214,7 +201,7 @@ bad:
/**
* Print usage information.
*/
-static void __attribute__((noreturn))
+static void ATTRIBUTE_NORETURN
zcip_usage(const char *msg)
{
fprintf(stderr, "%s: %s\n", prog, msg);
diff --git a/shell/ash.c b/shell/ash.c
index db537c44d..ef1fe0af7 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12,19 +12,7 @@
* This code is derived from software contributed to Berkeley by
* Kenneth Almquist.
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*
* Original BSD copyright notice is retained at the end of this file.
*/
@@ -233,11 +221,11 @@ static volatile sig_atomic_t pendingsigs;
/* EXSIG is turned off by evalbltin(). */
-static void exraise(int) __attribute__((__noreturn__));
-static void onint(void) __attribute__((__noreturn__));
+static void exraise(int) ATTRIBUTE_NORETURN;
+static void onint(void) ATTRIBUTE_NORETURN;
-static void sh_error(const char *, ...) __attribute__((__noreturn__));
-static void exerror(int, const char *, ...) __attribute__((__noreturn__));
+static void sh_error(const char *, ...) ATTRIBUTE_NORETURN;
+static void exerror(int, const char *, ...) ATTRIBUTE_NORETURN;
static void sh_warnx(const char *, ...);
@@ -1400,7 +1388,7 @@ struct cmdentry {
static const char *pathopt; /* set by padvance */
static void shellexec(char **, const char *, int)
- __attribute__((__noreturn__));
+ ATTRIBUTE_NORETURN;
static char *padvance(const char **, const char *);
static void find_command(char *, struct cmdentry *, int, const char *);
static struct builtincmd *find_builtin(const char *);
@@ -2026,7 +2014,7 @@ static void ignoresig(int);
static void onsig(int);
static int dotrap(void);
static void setinteractive(int);
-static void exitshell(void) __attribute__((__noreturn__));
+static void exitshell(void) ATTRIBUTE_NORETURN;
static int decode_signal(const char *, int);
/*
@@ -2504,7 +2492,7 @@ setpwd(const char *val, int setold)
static void exverror(int, const char *, va_list)
- __attribute__((__noreturn__));
+ ATTRIBUTE_NORETURN;
/*
* Called to raise an exception. Since C doesn't include exceptions, we
@@ -4518,7 +4506,7 @@ static size_t esclen(const char *, const char *);
static char *scanleft(char *, char *, char *, char *, int, int);
static char *scanright(char *, char *, char *, char *, int, int);
static void varunset(const char *, const char *, const char *, int)
- __attribute__((__noreturn__));
+ ATTRIBUTE_NORETURN;
#define pmatch(a, b) !fnmatch((a), (b), 0)
@@ -9325,8 +9313,8 @@ static int readtoken(void);
static int xxreadtoken(void);
static int readtoken1(int firstc, int syntax, char *eofmark, int striptabs);
static int noexpand(char *);
-static void synexpect(int) __attribute__((__noreturn__));
-static void synerror(const char *) __attribute__((__noreturn__));
+static void synexpect(int) ATTRIBUTE_NORETURN;
+static void synerror(const char *) ATTRIBUTE_NORETURN;
static void setprompt(int);
diff --git a/shell/hush.c b/shell/hush.c
index e83d49a86..70533a2b0 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -75,19 +75,7 @@
* maybe change map[] to use 2-bit entries
* (eventually) remove all the printf's
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <ctype.h> /* isalpha, isdigit */
#include <unistd.h> /* getpid */
@@ -369,7 +357,7 @@ static int free_pipe(struct pipe *pi, int indent);
/* really run the final data structures: */
static int setup_redirects(struct child_prog *prog, int squirrel[]);
static int run_list_real(struct pipe *pi);
-static void pseudo_exec(struct child_prog *child) __attribute__ ((noreturn));
+static void pseudo_exec(struct child_prog *child) ATTRIBUTE_NORETURN;
static int run_pipe_real(struct pipe *pi);
/* extended glob support: */
static int globhack(const char *src, int flags, glob_t *pglob);
diff --git a/shell/lash.c b/shell/lash.c
index f4cadde14..a23f5f4d4 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -8,20 +8,7 @@
* under the following liberal license: "We have placed this source code in the
* public domain. Use it in any project, free or commercial."
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/* This shell's parsing engine is officially at a dead-end. Future
@@ -148,7 +135,7 @@ static void remove_job(struct jobset *j_list, struct job *job);
static int get_command(FILE * source, char *command);
static int parse_command(char **command_ptr, struct job *job, int *inbg);
static int run_command(struct job *newjob, int inbg, int outpipe[2]);
-static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
+static int pseudo_exec(struct child_prog *cmd) ATTRIBUTE_NORETURN;
static int busy_loop(FILE * input);
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index e4c8a630e..b8d69c445 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -4,7 +4,7 @@
*
* Copyright (C) 2001 by Gennady Feldman <gfeldman@gena01.com>.
* Changes: Made this a standalone busybox module which uses standalone
- * syslog() client interface.
+ * syslog() client interface.
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
@@ -14,20 +14,7 @@
*
* Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <stdio.h>
@@ -51,7 +38,7 @@ static void klogd_signal(int sig)
exit(EXIT_SUCCESS);
}
-static void doKlogd(const int console_log_level) __attribute__ ((noreturn));
+static void doKlogd(const int console_log_level) ATTRIBUTE_NORETURN;
static void doKlogd(const int console_log_level)
{
int priority = LOG_INFO;
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 3d94069e2..e6b7ee7ed 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -10,20 +10,7 @@
*
* Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <stdio.h>
@@ -527,7 +514,7 @@ static int serveConnection(char *tmpbuf, int n_read)
return n_read;
}
-static void doSyslogd(void) __attribute__ ((noreturn));
+static void doSyslogd(void) ATTRIBUTE_NORETURN;
static void doSyslogd(void)
{
struct sockaddr_un sunx;
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index eec82a6be..6edf9c31e 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -2,10 +2,7 @@
*
* Copyright (C) 1992 A. V. Le Blanc (LeBlanc@mcc.ac.uk)
*
- * This program is free software. You can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation: either version 1 or
- * (at your option) any later version.
+ * Licensed under the GPL v1 or later, see the file LICENSE in this tarball.
*
* Vladimir Oleynik <dzo@simtreas.ru> 2001,2002 Busybox port
*/
@@ -200,7 +197,7 @@ struct partition {
unsigned char end_cyl; /* end cylinder */
unsigned char start4[4]; /* starting sector counting from 0 */
unsigned char size4[4]; /* nr of sectors in partition */
-} __attribute__((__packed__));
+} ATTRIBUTE_PACKED;
enum failure {
ioctl_error, unable_to_open, unable_to_read, unable_to_seek,
@@ -224,7 +221,7 @@ static void list_types(const struct systypes *sys);
static uint read_int(uint low, uint dflt, uint high, uint base, char *mesg);
#endif
static const char *partition_type(unsigned char type);
-static void fdisk_fatal(enum failure why) __attribute__ ((noreturn));
+static void fdisk_fatal(enum failure why) ATTRIBUTE_NORETURN;
static void get_geometry(void);
static int get_boot(enum action what);
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index f6d7deaab..1814537c5 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -269,7 +269,7 @@ static inline int bit(char * a,unsigned int i)
#define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1),changed=1)
#define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1),changed=1)
-static void leave(int) __attribute__ ((noreturn));
+static void leave(int) ATTRIBUTE_NORETURN;
static void leave(int status)
{
if (termios_set)