mirror of
https://github.com/sheumann/hush.git
synced 2024-12-26 10:32:02 +00:00
libbb.h: tidy it up a bit. no code changes (verified)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
11c12c4720
commit
9d57a8073a
@ -30,8 +30,8 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#if defined __FreeBSD__
|
#if defined __FreeBSD__
|
||||||
#include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@ -45,7 +45,11 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX 256
|
# define PATH_MAX 256
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BUFSIZ
|
||||||
|
# define BUFSIZ 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MNTENT_H
|
#ifdef HAVE_MNTENT_H
|
||||||
@ -64,13 +68,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLE_LOCALE_SUPPORT
|
#if ENABLE_LOCALE_SUPPORT
|
||||||
#include <locale.h>
|
# include <locale.h>
|
||||||
#else
|
#else
|
||||||
#define setlocale(x,y) ((void)0)
|
# define setlocale(x,y) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DMALLOC
|
#ifdef DMALLOC
|
||||||
#include <dmalloc.h>
|
# include <dmalloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
@ -1478,9 +1482,6 @@ extern const int const_int_0;
|
|||||||
extern const int const_int_1;
|
extern const int const_int_1;
|
||||||
|
|
||||||
|
|
||||||
#ifndef BUFSIZ
|
|
||||||
#define BUFSIZ 4096
|
|
||||||
#endif
|
|
||||||
/* Providing hard guarantee on minimum size (think of BUFSIZ == 128) */
|
/* Providing hard guarantee on minimum size (think of BUFSIZ == 128) */
|
||||||
enum { COMMON_BUFSIZE = (BUFSIZ >= 256*sizeof(void*) ? BUFSIZ+1 : 256*sizeof(void*)) };
|
enum { COMMON_BUFSIZE = (BUFSIZ >= 256*sizeof(void*) ? BUFSIZ+1 : 256*sizeof(void*)) };
|
||||||
extern char bb_common_bufsiz1[COMMON_BUFSIZE];
|
extern char bb_common_bufsiz1[COMMON_BUFSIZE];
|
||||||
@ -1561,10 +1562,8 @@ extern const char bb_default_login_shell[];
|
|||||||
#define DEV_CONSOLE "/dev/console"
|
#define DEV_CONSOLE "/dev/console"
|
||||||
|
|
||||||
|
|
||||||
#ifndef RB_POWER_OFF
|
#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
|
||||||
/* Stop system and switch power off if possible. */
|
|
||||||
#define RB_POWER_OFF 0x4321fedc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We redefine ctype macros. Unicode-correct handling of char types
|
/* We redefine ctype macros. Unicode-correct handling of char types
|
||||||
* can't be done with such byte-oriented operations anyway,
|
* can't be done with such byte-oriented operations anyway,
|
||||||
@ -1603,7 +1602,7 @@ extern const char bb_default_login_shell[];
|
|||||||
#define isspace(a) ({ unsigned char bb__isspace = (a) - 9; bb__isspace == (' ' - 9) || bb__isspace <= (13 - 9); })
|
#define isspace(a) ({ unsigned char bb__isspace = (a) - 9; bb__isspace == (' ' - 9) || bb__isspace <= (13 - 9); })
|
||||||
|
|
||||||
// Bigger code:
|
// Bigger code:
|
||||||
//#define isalnum(a) ({ unsigned char bb__isalnum = (a) - '0'; bb__isalnum <= 9 || ((bb__isalnum - ('A' - '0')) & 0xdf) <= 25; }) */
|
//#define isalnum(a) ({ unsigned char bb__isalnum = (a) - '0'; bb__isalnum <= 9 || ((bb__isalnum - ('A' - '0')) & 0xdf) <= 25; })
|
||||||
#define isalnum(a) bb_ascii_isalnum(a)
|
#define isalnum(a) bb_ascii_isalnum(a)
|
||||||
static ALWAYS_INLINE int bb_ascii_isalnum(unsigned char a)
|
static ALWAYS_INLINE int bb_ascii_isalnum(unsigned char a)
|
||||||
{
|
{
|
||||||
@ -1645,9 +1644,6 @@ static ALWAYS_INLINE unsigned char bb_ascii_tolower(unsigned char a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
|
|
||||||
|
|
||||||
|
|
||||||
POP_SAVED_FUNCTION_VISIBILITY
|
POP_SAVED_FUNCTION_VISIBILITY
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,9 +40,14 @@ static void write_wtmp(void)
|
|||||||
#define RB_HALT_SYSTEM RB_HALT
|
#define RB_HALT_SYSTEM RB_HALT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef RB_POWER_OFF
|
#ifndef RB_POWERDOWN
|
||||||
#define RB_POWER_OFF RB_POWERDOWN
|
/* Stop system and switch power off if possible. */
|
||||||
|
# define RB_POWERDOWN 0x4321fedc
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef RB_POWER_OFF
|
||||||
|
# define RB_POWER_OFF RB_POWERDOWN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int halt_main(int argc UNUSED_PARAM, char **argv)
|
int halt_main(int argc UNUSED_PARAM, char **argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user