mirror of
https://github.com/sheumann/hush.git
synced 2025-01-10 16:29:44 +00:00
Miscellaneous changes for ORCA/C and GNO compatibility, mainly removing C99isms.
At this point, ORCA/C can process the main header files, and some smaller source files compile without errors.
This commit is contained in:
parent
b7676499be
commit
8f6869ae25
2
build
2
build
@ -1,6 +1,6 @@
|
||||
cc -std=c99 -funsigned-char \
|
||||
-Wall -Wno-format-security -Wno-comment -o hush \
|
||||
-Iinclude -include include/autoconf.h \
|
||||
-Iinclude \
|
||||
-Dhush_main=main -DNDEBUG -D"BB_VER=KBUILD_STR(1.22.1)" -D"KBUILD_STR(s)=#s" \
|
||||
shell/hush.c \
|
||||
shell/match.c \
|
||||
|
@ -73,7 +73,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv)
|
||||
#if !ENABLE_FEATURE_FANCY_ECHO
|
||||
enum {
|
||||
eflag = '\\',
|
||||
nflag = 1, /* 1 -- print '\n' */
|
||||
nflag = 1 /* 1 -- print '\n' */
|
||||
};
|
||||
|
||||
argv++;
|
||||
|
@ -14,10 +14,10 @@ typedef enum bb_install_loc_t {
|
||||
BB_DIR_SBIN,
|
||||
#if ENABLE_INSTALL_NO_USR
|
||||
BB_DIR_USR_BIN = BB_DIR_BIN,
|
||||
BB_DIR_USR_SBIN = BB_DIR_SBIN,
|
||||
BB_DIR_USR_SBIN = BB_DIR_SBIN
|
||||
#else
|
||||
BB_DIR_USR_BIN,
|
||||
BB_DIR_USR_SBIN,
|
||||
BB_DIR_USR_SBIN
|
||||
#endif
|
||||
} bb_install_loc_t;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
248
include/libbb.h
248
include/libbb.h
@ -16,7 +16,6 @@
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <netdb.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
@ -26,7 +25,6 @@
|
||||
# define sigemptyset(s) __sigemptyset(s)
|
||||
# define sigisemptyset(s) __sigisemptyset(s)
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
@ -34,12 +32,14 @@
|
||||
#include <string.h>
|
||||
/* There are two incompatible basename's, let's not use them! */
|
||||
/* See the dirname/basename man page for details */
|
||||
#include <libgen.h> /* dirname,basename */
|
||||
#undef basename
|
||||
#define basename dont_use_basename
|
||||
#include <poll.h>
|
||||
#ifndef __GNO__
|
||||
# include <poll.h>
|
||||
#else
|
||||
//TODO Deal with lack of poll in GNO
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
@ -65,12 +65,6 @@
|
||||
# define endpwent() ((void)0)
|
||||
# define endgrent() ((void)0)
|
||||
#endif
|
||||
#ifdef HAVE_MNTENT_H
|
||||
# include <mntent.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
/* Don't do this here:
|
||||
* #include <sys/sysinfo.h>
|
||||
* Some linux/ includes pull in conflicting definition
|
||||
@ -298,11 +292,6 @@ extern int *const bb_errno;
|
||||
#define errno (*bb_errno)
|
||||
#endif
|
||||
|
||||
#if !(ULONG_MAX > 0xffffffff)
|
||||
/* Only 32-bit CPUs need this, 64-bit ones use inlined version */
|
||||
uint64_t bb_bswap_64(uint64_t x) FAST_FUNC;
|
||||
#endif
|
||||
|
||||
unsigned long monotonic_sec(void) FAST_FUNC;
|
||||
|
||||
extern void chomp(char *s) FAST_FUNC;
|
||||
@ -330,9 +319,7 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */
|
||||
FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 9, /* -c */
|
||||
FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10,
|
||||
#endif
|
||||
FILEUTILS_IGNORE_CHMOD_ERR = 1 << 11,
|
||||
/* -v */
|
||||
FILEUTILS_VERBOSE = (1 << 12) * ENABLE_FEATURE_VERBOSE,
|
||||
FILEUTILS_IGNORE_CHMOD_ERR = 1 << 11
|
||||
};
|
||||
#define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c")
|
||||
extern int remove_file(const char *path, int flags) FAST_FUNC;
|
||||
@ -349,7 +336,7 @@ enum {
|
||||
ACTION_DEPTHFIRST = (1 << 3),
|
||||
/*ACTION_REVERSE = (1 << 4), - unused */
|
||||
ACTION_QUIET = (1 << 5),
|
||||
ACTION_DANGLING_OK = (1 << 6),
|
||||
ACTION_DANGLING_OK = (1 << 6)
|
||||
};
|
||||
typedef uint8_t recurse_flags_t;
|
||||
extern int recursive_action(const char *fileName, unsigned flags,
|
||||
@ -436,7 +423,7 @@ enum {
|
||||
+ (1LL << SIGXFSZ) // File size limit exceeded
|
||||
+ (1LL << SIGUSR1) // Yes kids, these are also fatal!
|
||||
+ (1LL << SIGUSR2)
|
||||
+ 0),
|
||||
+ 0)
|
||||
};
|
||||
void bb_signals(int sigs, void (*f)(int)) FAST_FUNC;
|
||||
/* Unlike signal() and bb_signals, sets handler with sigaction()
|
||||
@ -497,33 +484,6 @@ struct fd_pair { int rd; int wr; };
|
||||
#define piped_pair(pair) pipe(&((pair).rd))
|
||||
#define xpiped_pair(pair) xpipe(&((pair).rd))
|
||||
|
||||
/* Useful for having small structure members/global variables */
|
||||
typedef int8_t socktype_t;
|
||||
typedef int8_t family_t;
|
||||
struct BUG_too_small {
|
||||
char BUG_socktype_t_too_small[(0
|
||||
| SOCK_STREAM
|
||||
| SOCK_DGRAM
|
||||
| SOCK_RDM
|
||||
| SOCK_SEQPACKET
|
||||
| SOCK_RAW
|
||||
) <= 127 ? 1 : -1];
|
||||
char BUG_family_t_too_small[(0
|
||||
| AF_UNSPEC
|
||||
| AF_INET
|
||||
| AF_INET6
|
||||
| AF_UNIX
|
||||
#ifdef AF_PACKET
|
||||
| AF_PACKET
|
||||
#endif
|
||||
#ifdef AF_NETLINK
|
||||
| AF_NETLINK
|
||||
#endif
|
||||
/* | AF_DECnet */
|
||||
/* | AF_IPX */
|
||||
) <= 127 ? 1 : -1];
|
||||
};
|
||||
|
||||
|
||||
void parse_datestr(const char *date_str, struct tm *ptm) FAST_FUNC;
|
||||
time_t validate_tm_time(const char *date_str, struct tm *ptm) FAST_FUNC;
|
||||
@ -557,18 +517,7 @@ typedef struct len_and_sockaddr {
|
||||
#endif
|
||||
} u;
|
||||
} len_and_sockaddr;
|
||||
enum {
|
||||
LSA_LEN_SIZE = offsetof(len_and_sockaddr, u),
|
||||
LSA_SIZEOF_SA = sizeof(
|
||||
union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in sin;
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
struct sockaddr_in6 sin6;
|
||||
#endif
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
/* Create stream socket, and allocate suitable lsa.
|
||||
* (lsa of correct size and lsa->sa.sa_family (AF_INET/AF_INET6))
|
||||
* af == AF_UNSPEC will result in trying to create IPv6 socket,
|
||||
@ -688,7 +637,7 @@ void fputc_printable(int ch, FILE *file) FAST_FUNC;
|
||||
* Buffer must hold at least four characters. */
|
||||
enum {
|
||||
VISIBLE_ENDLINE = 1 << 0,
|
||||
VISIBLE_SHOW_TABS = 1 << 1,
|
||||
VISIBLE_SHOW_TABS = 1 << 1
|
||||
};
|
||||
void visible(unsigned ch, char *buf, int flags) FAST_FUNC;
|
||||
|
||||
@ -746,17 +695,6 @@ unsigned bb_clk_tck(void) FAST_FUNC;
|
||||
|| ENABLE_FEATURE_SEAMLESS_GZ \
|
||||
|| ENABLE_FEATURE_SEAMLESS_Z)
|
||||
|
||||
#if SEAMLESS_COMPRESSION
|
||||
/* Autodetects gzip/bzip2 formats. fd may be in the middle of the file! */
|
||||
extern int setup_unzip_on_fd(int fd, int fail_if_not_compressed) FAST_FUNC;
|
||||
/* Autodetects .gz etc */
|
||||
extern int open_zipped(const char *fname, int fail_if_not_compressed) FAST_FUNC;
|
||||
#else
|
||||
# define setup_unzip_on_fd(...) (0)
|
||||
# define open_zipped(fname, fail_if_not_compressed) open((fname), O_RDONLY);
|
||||
#endif
|
||||
extern void *xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC;
|
||||
|
||||
extern ssize_t safe_write(int fd, const void *buf, size_t count) FAST_FUNC;
|
||||
// NB: will return short write on error, not -1,
|
||||
// if some data was written before error occurred
|
||||
@ -817,7 +755,11 @@ void qsort_string_vector(char **sv, unsigned count) FAST_FUNC;
|
||||
* On other errors complains [perror("poll")] and returns.
|
||||
* Warning! May take (much) longer than timeout_ms to return!
|
||||
* If this is a problem, use bare poll and open-code EINTR/ENOMEM handling */
|
||||
#ifndef __GNO__
|
||||
int safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout_ms) FAST_FUNC;
|
||||
#else
|
||||
//TODO Deal with lack of poll in GNO
|
||||
#endif
|
||||
|
||||
char *safe_gethostname(void) FAST_FUNC;
|
||||
|
||||
@ -933,7 +875,6 @@ int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC;
|
||||
} while (0)
|
||||
#else
|
||||
#define BB_EXECVP(prog,cmd) execvp(prog,cmd)
|
||||
#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__)
|
||||
#endif
|
||||
int BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC;
|
||||
|
||||
@ -998,7 +939,7 @@ enum {
|
||||
DAEMON_DEVNULL_STDIO = 2,
|
||||
DAEMON_CLOSE_EXTRA_FDS = 4,
|
||||
DAEMON_ONLY_SANITIZE = 8, /* internal use */
|
||||
DAEMON_DOUBLE_FORK = 16, /* double fork to avoid controlling tty */
|
||||
DAEMON_DOUBLE_FORK = 16 /* double fork to avoid controlling tty */
|
||||
};
|
||||
#if BB_MMU
|
||||
enum { re_execed = 0 };
|
||||
@ -1010,7 +951,6 @@ enum {
|
||||
/* Note: re_exec() and fork_or_rexec() do argv[0][0] |= 0x80 on NOMMU!
|
||||
* _Parent_ needs to undo it if it doesn't want to have argv[0] mangled.
|
||||
*/
|
||||
void re_exec(char **argv) NORETURN FAST_FUNC;
|
||||
pid_t fork_or_rexec(char **argv) FAST_FUNC;
|
||||
int BUG_fork_is_unavailable_on_nommu(void) FAST_FUNC;
|
||||
int BUG_daemon_is_unavailable_on_nommu(void) FAST_FUNC;
|
||||
@ -1077,9 +1017,7 @@ enum { wrote_pidfile = 0 };
|
||||
|
||||
enum {
|
||||
LOGMODE_NONE = 0,
|
||||
LOGMODE_STDIO = (1 << 0),
|
||||
LOGMODE_SYSLOG = (1 << 1) * ENABLE_FEATURE_SYSLOG,
|
||||
LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO,
|
||||
LOGMODE_STDIO = (1 << 0)
|
||||
};
|
||||
extern const char *msg_eol;
|
||||
extern smallint syslog_level;
|
||||
@ -1115,14 +1053,14 @@ extern void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUN
|
||||
/* Applets which are useful from another applets */
|
||||
int bb_cat(char** argv);
|
||||
/* If shell needs them, they exist even if not enabled as applets */
|
||||
int echo_main(int argc, char** argv) IF_ECHO(MAIN_EXTERNALLY_VISIBLE);
|
||||
int printf_main(int argc, char **argv) IF_PRINTF(MAIN_EXTERNALLY_VISIBLE);
|
||||
int test_main(int argc, char **argv) IF_TEST(MAIN_EXTERNALLY_VISIBLE);
|
||||
int kill_main(int argc, char **argv) IF_KILL(MAIN_EXTERNALLY_VISIBLE);
|
||||
int echo_main(int argc, char** argv);
|
||||
int printf_main(int argc, char **argv);
|
||||
int test_main(int argc, char **argv);
|
||||
int kill_main(int argc, char **argv);
|
||||
/* Similar, but used by chgrp, not shell */
|
||||
int chown_main(int argc, char **argv) IF_CHOWN(MAIN_EXTERNALLY_VISIBLE);
|
||||
int chown_main(int argc, char **argv);
|
||||
/* Used by ftpd */
|
||||
int ls_main(int argc, char **argv) IF_LS(MAIN_EXTERNALLY_VISIBLE);
|
||||
int ls_main(int argc, char **argv);
|
||||
/* Don't need IF_xxx() guard for these */
|
||||
int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
@ -1208,23 +1146,6 @@ int bb_parse_mode(const char* s, mode_t* theMode) FAST_FUNC;
|
||||
/*
|
||||
* Config file parser
|
||||
*/
|
||||
enum {
|
||||
PARSE_COLLAPSE = 0x00010000, // treat consecutive delimiters as one
|
||||
PARSE_TRIM = 0x00020000, // trim leading and trailing delimiters
|
||||
// TODO: COLLAPSE and TRIM seem to always go in pair
|
||||
PARSE_GREEDY = 0x00040000, // last token takes entire remainder of the line
|
||||
PARSE_MIN_DIE = 0x00100000, // die if < min tokens found
|
||||
// keep a copy of current line
|
||||
PARSE_KEEP_COPY = 0x00200000 * ENABLE_FEATURE_CROND_D,
|
||||
PARSE_EOL_COMMENTS = 0x00400000, // comments are recognized even if they aren't the first char
|
||||
// NORMAL is:
|
||||
// * remove leading and trailing delimiters and collapse
|
||||
// multiple delimiters into one
|
||||
// * warn and continue if less than mintokens delimiters found
|
||||
// * grab everything into last token
|
||||
// * comments are recognized even if they aren't the first char
|
||||
PARSE_NORMAL = PARSE_COLLAPSE | PARSE_TRIM | PARSE_GREEDY | PARSE_EOL_COMMENTS,
|
||||
};
|
||||
typedef struct parser_t {
|
||||
FILE *fp;
|
||||
char *data;
|
||||
@ -1449,7 +1370,7 @@ enum {
|
||||
* -1: poll(-1) (i.e. block);
|
||||
* >=0: poll for TIMEOUT milliseconds, return -1/EAGAIN on timeout
|
||||
*/
|
||||
int64_t read_key(int fd, char *buffer, int timeout) FAST_FUNC;
|
||||
int32_t read_key(int fd, char *buffer, int timeout) FAST_FUNC;
|
||||
void read_key_ungets(char *buffer, const char *str, unsigned len) FAST_FUNC;
|
||||
|
||||
|
||||
@ -1487,7 +1408,7 @@ enum {
|
||||
USERNAME_COMPLETION = 4 * ENABLE_FEATURE_USERNAME_COMPLETION,
|
||||
VI_MODE = 8 * ENABLE_FEATURE_EDITING_VI,
|
||||
WITH_PATH_LOOKUP = 0x10,
|
||||
FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION,
|
||||
FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION
|
||||
};
|
||||
line_input_t *new_line_input_t(int flags) FAST_FUNC;
|
||||
/* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */
|
||||
@ -1542,82 +1463,7 @@ struct smaprec {
|
||||
int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total,
|
||||
void (*cb)(struct smaprec *, void *), void *data);
|
||||
|
||||
typedef struct procps_status_t {
|
||||
DIR *dir;
|
||||
IF_FEATURE_SHOW_THREADS(DIR *task_dir;)
|
||||
uint8_t shift_pages_to_bytes;
|
||||
uint8_t shift_pages_to_kb;
|
||||
/* Fields are set to 0/NULL if failed to determine (or not requested) */
|
||||
uint16_t argv_len;
|
||||
char *argv0;
|
||||
char *exe;
|
||||
IF_SELINUX(char *context;)
|
||||
IF_FEATURE_SHOW_THREADS(unsigned main_thread_pid;)
|
||||
/* Everything below must contain no ptrs to malloc'ed data:
|
||||
* it is memset(0) for each process in procps_scan() */
|
||||
unsigned long vsz, rss; /* we round it to kbytes */
|
||||
unsigned long stime, utime;
|
||||
unsigned long start_time;
|
||||
unsigned pid;
|
||||
unsigned ppid;
|
||||
unsigned pgid;
|
||||
unsigned sid;
|
||||
unsigned uid;
|
||||
unsigned gid;
|
||||
#if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS
|
||||
unsigned ruid;
|
||||
unsigned rgid;
|
||||
int niceness;
|
||||
#endif
|
||||
unsigned tty_major,tty_minor;
|
||||
#if ENABLE_FEATURE_TOPMEM
|
||||
struct smaprec smaps;
|
||||
#endif
|
||||
char state[4];
|
||||
/* basename of executable in exec(2), read from /proc/N/stat
|
||||
* (if executable is symlink or script, it is NOT replaced
|
||||
* by link target or interpreter name) */
|
||||
char comm[COMM_LEN];
|
||||
/* user/group? - use passwd/group parsing functions */
|
||||
#if ENABLE_FEATURE_TOP_SMP_PROCESS
|
||||
int last_seen_on_cpu;
|
||||
#endif
|
||||
} procps_status_t;
|
||||
/* flag bits for procps_scan(xx, flags) calls */
|
||||
enum {
|
||||
PSSCAN_PID = 1 << 0,
|
||||
PSSCAN_PPID = 1 << 1,
|
||||
PSSCAN_PGID = 1 << 2,
|
||||
PSSCAN_SID = 1 << 3,
|
||||
PSSCAN_UIDGID = 1 << 4,
|
||||
PSSCAN_COMM = 1 << 5,
|
||||
/* PSSCAN_CMD = 1 << 6, - use read_cmdline instead */
|
||||
PSSCAN_ARGV0 = 1 << 7,
|
||||
PSSCAN_EXE = 1 << 8,
|
||||
PSSCAN_STATE = 1 << 9,
|
||||
PSSCAN_VSZ = 1 << 10,
|
||||
PSSCAN_RSS = 1 << 11,
|
||||
PSSCAN_STIME = 1 << 12,
|
||||
PSSCAN_UTIME = 1 << 13,
|
||||
PSSCAN_TTY = 1 << 14,
|
||||
PSSCAN_SMAPS = (1 << 15) * ENABLE_FEATURE_TOPMEM,
|
||||
/* NB: used by find_pid_by_name(). Any applet using it
|
||||
* needs to be mentioned here. */
|
||||
PSSCAN_ARGVN = (1 << 16) * (ENABLE_KILLALL
|
||||
|| ENABLE_PGREP || ENABLE_PKILL
|
||||
|| ENABLE_PIDOF
|
||||
|| ENABLE_SESTATUS
|
||||
),
|
||||
PSSCAN_CONTEXT = (1 << 17) * ENABLE_SELINUX,
|
||||
PSSCAN_START_TIME = 1 << 18,
|
||||
PSSCAN_CPU = (1 << 19) * ENABLE_FEATURE_TOP_SMP_PROCESS,
|
||||
PSSCAN_NICE = (1 << 20) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS,
|
||||
PSSCAN_RUIDGID = (1 << 21) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS,
|
||||
PSSCAN_TASKS = (1 << 22) * ENABLE_FEATURE_SHOW_THREADS,
|
||||
};
|
||||
//procps_status_t* alloc_procps_scan(void) FAST_FUNC;
|
||||
void free_procps_scan(procps_status_t* sp) FAST_FUNC;
|
||||
procps_status_t* procps_scan(procps_status_t* sp, int flags) FAST_FUNC;
|
||||
|
||||
/* Format cmdline (up to col chars) into char buf[size] */
|
||||
/* Puts [comm] if cmdline is empty (-> process is a kernel thread) */
|
||||
void read_cmdline(char *buf, int size, unsigned pid, const char *comm) FAST_FUNC;
|
||||
@ -1636,50 +1482,6 @@ unsigned get_cpu_count(void) FAST_FUNC;
|
||||
char *percent_decode_in_place(char *str, int strict) FAST_FUNC;
|
||||
|
||||
|
||||
extern const char bb_uuenc_tbl_base64[] ALIGN1;
|
||||
extern const char bb_uuenc_tbl_std[] ALIGN1;
|
||||
void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC;
|
||||
enum {
|
||||
BASE64_FLAG_UU_STOP = 0x100,
|
||||
/* Sign-extends to a value which never matches fgetc result: */
|
||||
BASE64_FLAG_NO_STOP_CHAR = 0x80,
|
||||
};
|
||||
const char *decode_base64(char **pp_dst, const char *src) FAST_FUNC;
|
||||
void read_base64(FILE *src_stream, FILE *dst_stream, int flags) FAST_FUNC;
|
||||
|
||||
typedef struct md5_ctx_t {
|
||||
uint8_t wbuffer[64]; /* always correctly aligned for uint64_t */
|
||||
void (*process_block)(struct md5_ctx_t*) FAST_FUNC;
|
||||
uint64_t total64; /* must be directly before hash[] */
|
||||
uint32_t hash[8]; /* 4 elements for md5, 5 for sha1, 8 for sha256 */
|
||||
} md5_ctx_t;
|
||||
typedef struct md5_ctx_t sha1_ctx_t;
|
||||
typedef struct md5_ctx_t sha256_ctx_t;
|
||||
typedef struct sha512_ctx_t {
|
||||
uint64_t total64[2]; /* must be directly before hash[] */
|
||||
uint64_t hash[8];
|
||||
uint8_t wbuffer[128]; /* always correctly aligned for uint64_t */
|
||||
} sha512_ctx_t;
|
||||
typedef struct sha3_ctx_t {
|
||||
uint64_t state[25];
|
||||
unsigned bytes_queued;
|
||||
} sha3_ctx_t;
|
||||
void md5_begin(md5_ctx_t *ctx) FAST_FUNC;
|
||||
void md5_hash(md5_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
|
||||
void md5_end(md5_ctx_t *ctx, void *resbuf) FAST_FUNC;
|
||||
void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC;
|
||||
#define sha1_hash md5_hash
|
||||
void sha1_end(sha1_ctx_t *ctx, void *resbuf) FAST_FUNC;
|
||||
void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC;
|
||||
#define sha256_hash md5_hash
|
||||
#define sha256_end sha1_end
|
||||
void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC;
|
||||
void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
|
||||
void sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC;
|
||||
void sha3_begin(sha3_ctx_t *ctx) FAST_FUNC;
|
||||
void sha3_hash(sha3_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
|
||||
void sha3_end(sha3_ctx_t *ctx, void *resbuf) FAST_FUNC;
|
||||
|
||||
extern uint32_t *global_crc32_table;
|
||||
uint32_t *crc32_filltable(uint32_t *tbl256, int endian) FAST_FUNC;
|
||||
uint32_t crc32_block_endian1(uint32_t val, const void *buf, unsigned len, uint32_t *crc_table) FAST_FUNC;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#ifndef BB_PLATFORM_H
|
||||
#define BB_PLATFORM_H 1
|
||||
|
||||
#include "autoconf.h"
|
||||
|
||||
/* Convenience macros to test the version of gcc. */
|
||||
#undef __GNUC_PREREQ
|
||||
@ -70,7 +71,11 @@
|
||||
# define UNUSED_PARAM_RESULT
|
||||
# endif
|
||||
#else
|
||||
# define ALWAYS_INLINE inline
|
||||
# ifdef __ORCAC__
|
||||
# define ALWAYS_INLINE
|
||||
# else
|
||||
# define ALWAYS_INLINE inline
|
||||
# endif
|
||||
# define NOINLINE
|
||||
# define DEPRECATED
|
||||
# define UNUSED_PARAM_RESULT
|
||||
@ -136,108 +141,20 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* ---- Endian Detection ------------------------------------ */
|
||||
|
||||
#include <limits.h>
|
||||
#if defined(__digital__) && defined(__unix__)
|
||||
# include <sex.h>
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
|
||||
|| defined(__APPLE__)
|
||||
# include <sys/resource.h> /* rlimit */
|
||||
# include <machine/endian.h>
|
||||
# define bswap_64 __bswap64
|
||||
# define bswap_32 __bswap32
|
||||
# define bswap_16 __bswap16
|
||||
#ifndef __ORCAC__
|
||||
# include <inttypes.h>
|
||||
#else
|
||||
# include <byteswap.h>
|
||||
# include <endian.h>
|
||||
#endif
|
||||
|
||||
#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define BB_BIG_ENDIAN 1
|
||||
# define BB_LITTLE_ENDIAN 0
|
||||
#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define BB_BIG_ENDIAN 0
|
||||
# define BB_LITTLE_ENDIAN 1
|
||||
#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN
|
||||
# define BB_BIG_ENDIAN 1
|
||||
# define BB_LITTLE_ENDIAN 0
|
||||
#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define BB_BIG_ENDIAN 0
|
||||
# define BB_LITTLE_ENDIAN 1
|
||||
#elif defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
|
||||
# define BB_BIG_ENDIAN 1
|
||||
# define BB_LITTLE_ENDIAN 0
|
||||
#elif defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN
|
||||
# define BB_BIG_ENDIAN 0
|
||||
# define BB_LITTLE_ENDIAN 1
|
||||
#elif defined(__386__)
|
||||
# define BB_BIG_ENDIAN 0
|
||||
# define BB_LITTLE_ENDIAN 1
|
||||
#else
|
||||
# error "Can't determine endianness"
|
||||
#endif
|
||||
|
||||
#if ULONG_MAX > 0xffffffff
|
||||
# define bb_bswap_64(x) bswap_64(x)
|
||||
#endif
|
||||
|
||||
/* SWAP_LEnn means "convert CPU<->little_endian by swapping bytes" */
|
||||
#if BB_BIG_ENDIAN
|
||||
# define SWAP_BE16(x) (x)
|
||||
# define SWAP_BE32(x) (x)
|
||||
# define SWAP_BE64(x) (x)
|
||||
# define SWAP_LE16(x) bswap_16(x)
|
||||
# define SWAP_LE32(x) bswap_32(x)
|
||||
# define SWAP_LE64(x) bb_bswap_64(x)
|
||||
# define IF_BIG_ENDIAN(...) __VA_ARGS__
|
||||
# define IF_LITTLE_ENDIAN(...)
|
||||
#else
|
||||
# define SWAP_BE16(x) bswap_16(x)
|
||||
# define SWAP_BE32(x) bswap_32(x)
|
||||
# define SWAP_BE64(x) bb_bswap_64(x)
|
||||
# define SWAP_LE16(x) (x)
|
||||
# define SWAP_LE32(x) (x)
|
||||
# define SWAP_LE64(x) (x)
|
||||
# define IF_BIG_ENDIAN(...)
|
||||
# define IF_LITTLE_ENDIAN(...) __VA_ARGS__
|
||||
#endif
|
||||
|
||||
|
||||
/* ---- Unaligned access ------------------------------------ */
|
||||
|
||||
#include <stdint.h>
|
||||
typedef int bb__aliased_int FIX_ALIASING;
|
||||
typedef long bb__aliased_long FIX_ALIASING;
|
||||
typedef uint16_t bb__aliased_uint16_t FIX_ALIASING;
|
||||
typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
|
||||
typedef uint64_t bb__aliased_uint64_t FIX_ALIASING;
|
||||
|
||||
/* NB: unaligned parameter should be a pointer, aligned one -
|
||||
* a lvalue. This makes it more likely to not swap them by mistake
|
||||
*/
|
||||
#if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
|
||||
# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
|
||||
# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp))
|
||||
# define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p))
|
||||
# define move_from_unaligned32(v, u32p) ((v) = *(bb__aliased_uint32_t*)(u32p))
|
||||
# define move_to_unaligned16(u16p, v) (*(bb__aliased_uint16_t*)(u16p) = (v))
|
||||
# define move_to_unaligned32(u32p, v) (*(bb__aliased_uint32_t*)(u32p) = (v))
|
||||
/* #elif ... - add your favorite arch today! */
|
||||
#else
|
||||
/* performs reasonably well (gcc usually inlines memcpy here) */
|
||||
# define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))
|
||||
# define move_from_unaligned_long(v, longp) (memcpy(&(v), (longp), sizeof(long)))
|
||||
# define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))
|
||||
# define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))
|
||||
# define move_to_unaligned16(u16p, v) do { \
|
||||
uint16_t __t = (v); \
|
||||
memcpy((u16p), &__t, 2); \
|
||||
} while (0)
|
||||
# define move_to_unaligned32(u32p, v) do { \
|
||||
uint32_t __t = (v); \
|
||||
memcpy((u32p), &__t, 4); \
|
||||
} while (0)
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef long int32_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef long intmax_t;
|
||||
typedef unsigned long uintmax_t;
|
||||
# define PRIxMAX "lx"
|
||||
# define PRIdMAX "ld"
|
||||
typedef unsigned long uintptr_t;
|
||||
#endif
|
||||
|
||||
|
||||
@ -254,7 +171,7 @@ typedef unsigned smalluint;
|
||||
#endif
|
||||
|
||||
/* ISO C Standard: 7.16 Boolean type and values <stdbool.h> */
|
||||
#if (defined __digital__ && defined __unix__)
|
||||
#if (defined __digital__ && defined __unix__) || defined(__ORCAC__)
|
||||
/* old system without (proper) C99 support */
|
||||
# define bool smalluint
|
||||
#else
|
||||
@ -319,12 +236,12 @@ typedef unsigned smalluint;
|
||||
UCLIBC_VERSION > KERNEL_VERSION(0, 9, 28) && \
|
||||
!defined __ARCH_USE_MMU__)
|
||||
# define BB_MMU 0
|
||||
# define USE_FOR_NOMMU(...) __VA_ARGS__
|
||||
# define USE_FOR_MMU(...)
|
||||
# define USE_FOR_NOMMU(x) x
|
||||
# define USE_FOR_MMU(x)
|
||||
#else
|
||||
# define BB_MMU 1
|
||||
# define USE_FOR_NOMMU(...)
|
||||
# define USE_FOR_MMU(...) __VA_ARGS__
|
||||
# define USE_FOR_NOMMU(x)
|
||||
# define USE_FOR_MMU(x) x
|
||||
#endif
|
||||
|
||||
#if defined(__digital__) && defined(__unix__)
|
||||
|
@ -15,7 +15,7 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
|
||||
enum {
|
||||
UNICODE_UNKNOWN = 0,
|
||||
UNICODE_OFF = 1,
|
||||
UNICODE_ON = 2,
|
||||
UNICODE_ON = 2
|
||||
};
|
||||
|
||||
#define unicode_bidi_isrtl(wc) 0
|
||||
@ -56,7 +56,7 @@ size_t FAST_FUNC unicode_strlen(const char *string);
|
||||
/* Width on terminal */
|
||||
size_t FAST_FUNC unicode_strwidth(const char *string);
|
||||
enum {
|
||||
UNI_FLAG_PAD = (1 << 0),
|
||||
UNI_FLAG_PAD = (1 << 0)
|
||||
};
|
||||
//UNUSED: unsigned FAST_FUNC unicode_padding_to_width(unsigned width, const char *src);
|
||||
//UNUSED: char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats, const char *src, unsigned width, int flags);
|
||||
|
@ -28,9 +28,6 @@ type xato##T##_range(const char *str, type l, type u) FAST_FUNC; \
|
||||
type xato##T##_sfx(const char *str, const struct suffix_mult *sfx) FAST_FUNC; \
|
||||
type xato##T(const char *str) FAST_FUNC; \
|
||||
|
||||
/* Unsigned long long functions always exist */
|
||||
DECLARE_STR_CONV(long long, ll, ull)
|
||||
|
||||
|
||||
/* Provides inline definitions of functions */
|
||||
/* (useful for mapping them to the type of the same width) */
|
||||
@ -82,18 +79,10 @@ static ALWAYS_INLINE \
|
||||
narrow xato##N(const char *str) \
|
||||
{ return xato##W(str); } \
|
||||
|
||||
/* If long == long long, then just map them one-to-one */
|
||||
#if ULONG_MAX == ULLONG_MAX
|
||||
DEFINE_EQUIV_STR_CONV(long, l, ll, ul, ull)
|
||||
#else
|
||||
/* Else provide extern defs */
|
||||
DECLARE_STR_CONV(long, l, ul)
|
||||
#endif
|
||||
|
||||
/* Same for int -> [long] long */
|
||||
#if UINT_MAX == ULLONG_MAX
|
||||
DEFINE_EQUIV_STR_CONV(int, i, ll, u, ull)
|
||||
#elif UINT_MAX == ULONG_MAX
|
||||
#if UINT_MAX == ULONG_MAX
|
||||
DEFINE_EQUIV_STR_CONV(int, i, l, u, ul)
|
||||
#else
|
||||
DECLARE_STR_CONV(int, i, u)
|
||||
@ -101,16 +90,6 @@ DECLARE_STR_CONV(int, i, u)
|
||||
|
||||
/* Specialized */
|
||||
|
||||
uint32_t BUG_xatou32_unimplemented(void);
|
||||
static ALWAYS_INLINE uint32_t xatou32(const char *numstr)
|
||||
{
|
||||
if (UINT_MAX == 0xffffffff)
|
||||
return xatou(numstr);
|
||||
if (ULONG_MAX == 0xffffffff)
|
||||
return xatoul(numstr);
|
||||
return BUG_xatou32_unimplemented();
|
||||
}
|
||||
|
||||
/* Non-aborting kind of convertors: bb_strto[u][l]l */
|
||||
|
||||
/* On exit: errno = 0 only if there was non-empty, '\0' terminated value
|
||||
@ -124,29 +103,11 @@ static ALWAYS_INLINE uint32_t xatou32(const char *numstr)
|
||||
* return value is all-ones in this case.
|
||||
*/
|
||||
|
||||
unsigned long long bb_strtoull(const char *arg, char **endp, int base) FAST_FUNC;
|
||||
long long bb_strtoll(const char *arg, char **endp, int base) FAST_FUNC;
|
||||
|
||||
#if ULONG_MAX == ULLONG_MAX
|
||||
static ALWAYS_INLINE
|
||||
unsigned long bb_strtoul(const char *arg, char **endp, int base)
|
||||
{ return bb_strtoull(arg, endp, base); }
|
||||
static ALWAYS_INLINE
|
||||
long bb_strtol(const char *arg, char **endp, int base)
|
||||
{ return bb_strtoll(arg, endp, base); }
|
||||
#else
|
||||
unsigned long bb_strtoul(const char *arg, char **endp, int base) FAST_FUNC;
|
||||
long bb_strtol(const char *arg, char **endp, int base) FAST_FUNC;
|
||||
#endif
|
||||
|
||||
#if UINT_MAX == ULLONG_MAX
|
||||
static ALWAYS_INLINE
|
||||
unsigned bb_strtou(const char *arg, char **endp, int base)
|
||||
{ return bb_strtoull(arg, endp, base); }
|
||||
static ALWAYS_INLINE
|
||||
int bb_strtoi(const char *arg, char **endp, int base)
|
||||
{ return bb_strtoll(arg, endp, base); }
|
||||
#elif UINT_MAX == ULONG_MAX
|
||||
#if UINT_MAX == ULONG_MAX
|
||||
static ALWAYS_INLINE
|
||||
unsigned bb_strtou(const char *arg, char **endp, int base)
|
||||
{ return bb_strtoul(arg, endp, base); }
|
||||
|
@ -51,46 +51,6 @@ static unsigned long long handle_errors(unsigned long long v, char **endp)
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
unsigned long long FAST_FUNC bb_strtoull(const char *arg, char **endp, int base)
|
||||
{
|
||||
unsigned long long v;
|
||||
char *endptr;
|
||||
|
||||
if (!endp) endp = &endptr;
|
||||
*endp = (char*) arg;
|
||||
|
||||
/* strtoul(" -4200000000") returns 94967296, errno 0 (!) */
|
||||
/* I don't think that this is right. Preventing this... */
|
||||
if (!isalnum(arg[0])) return ret_ERANGE();
|
||||
|
||||
/* not 100% correct for lib func, but convenient for the caller */
|
||||
errno = 0;
|
||||
v = strtoull(arg, endp, base);
|
||||
return handle_errors(v, endp);
|
||||
}
|
||||
|
||||
long long FAST_FUNC bb_strtoll(const char *arg, char **endp, int base)
|
||||
{
|
||||
unsigned long long v;
|
||||
char *endptr;
|
||||
char first;
|
||||
|
||||
if (!endp) endp = &endptr;
|
||||
*endp = (char*) arg;
|
||||
|
||||
/* Check for the weird "feature":
|
||||
* a "-" string is apparently a valid "number" for strto[u]l[l]!
|
||||
* It returns zero and errno is 0! :( */
|
||||
first = (arg[0] != '-' ? arg[0] : arg[1]);
|
||||
if (!isalnum(first)) return ret_ERANGE();
|
||||
|
||||
errno = 0;
|
||||
v = strtoll(arg, endp, base);
|
||||
return handle_errors(v, endp);
|
||||
}
|
||||
|
||||
#if ULONG_MAX != ULLONG_MAX
|
||||
unsigned long FAST_FUNC bb_strtoul(const char *arg, char **endp, int base)
|
||||
{
|
||||
unsigned long v;
|
||||
@ -121,7 +81,6 @@ long FAST_FUNC bb_strtol(const char *arg, char **endp, int base)
|
||||
v = strtol(arg, endp, base);
|
||||
return handle_errors(v, endp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UINT_MAX != ULONG_MAX
|
||||
unsigned FAST_FUNC bb_strtou(const char *arg, char **endp, int base)
|
||||
|
@ -7,6 +7,8 @@
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
*/
|
||||
|
||||
#include "autoconf.h"
|
||||
|
||||
#if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG
|
||||
# include <getopt.h>
|
||||
#endif
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
#include "libbb.h"
|
||||
|
||||
int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout)
|
||||
int32_t FAST_FUNC read_key(int fd, char *buffer, int timeout)
|
||||
{
|
||||
struct pollfd pfd;
|
||||
const char *seq;
|
||||
@ -224,6 +224,8 @@ int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout)
|
||||
}
|
||||
n++;
|
||||
/* Try to decipher "ESC [ NNN ; NNN R" sequence */
|
||||
#if (ENABLE_FEATURE_EDITING_ASK_TERMINAL || ENABLE_FEATURE_VI_ASK_TERMINAL || ENABLE_FEATURE_LESS_ASK_TERMINAL)
|
||||
# error "read_key's return value would have to be 64-bit to support this"
|
||||
if ((ENABLE_FEATURE_EDITING_ASK_TERMINAL
|
||||
|| ENABLE_FEATURE_VI_ASK_TERMINAL
|
||||
|| ENABLE_FEATURE_LESS_ASK_TERMINAL
|
||||
@ -251,6 +253,7 @@ int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout)
|
||||
/* Return it in high-order word */
|
||||
return ((int64_t) col << 32) | (uint32_t)KEYCODE_CURSOR_POS;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
got_all:
|
||||
|
||||
|
@ -9,18 +9,6 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
#define type long long
|
||||
#define xstrtou(rest) xstrtoull##rest
|
||||
#define xstrto(rest) xstrtoll##rest
|
||||
#define xatou(rest) xatoull##rest
|
||||
#define xato(rest) xatoll##rest
|
||||
#define XSTR_UTYPE_MAX ULLONG_MAX
|
||||
#define XSTR_TYPE_MAX LLONG_MAX
|
||||
#define XSTR_TYPE_MIN LLONG_MIN
|
||||
#define XSTR_STRTOU strtoull
|
||||
#include "xatonum_template.c"
|
||||
|
||||
#if ULONG_MAX != ULLONG_MAX
|
||||
#define type long
|
||||
#define xstrtou(rest) xstrtoul##rest
|
||||
#define xstrto(rest) xstrtol##rest
|
||||
@ -31,7 +19,6 @@
|
||||
#define XSTR_TYPE_MIN LONG_MIN
|
||||
#define XSTR_STRTOU strtoul
|
||||
#include "xatonum_template.c"
|
||||
#endif
|
||||
|
||||
#if UINT_MAX != ULONG_MAX
|
||||
static ALWAYS_INLINE
|
||||
|
28
shell/hush.c
28
shell/hush.c
@ -81,8 +81,10 @@
|
||||
* $ "export" i=`echo 'aaa bbb'`; echo "$i"
|
||||
* aaa
|
||||
*/
|
||||
#include "autoconf.h"
|
||||
|
||||
#if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
|
||||
|| defined(__APPLE__) \
|
||||
|| defined(__APPLE__) || defined(__GNO__) \
|
||||
)
|
||||
# include <malloc.h> /* for malloc_trim */
|
||||
#endif
|
||||
@ -300,8 +302,8 @@
|
||||
# undef USE_FOR_NOMMU
|
||||
# undef USE_FOR_MMU
|
||||
# define BB_MMU 0
|
||||
# define USE_FOR_NOMMU(...) __VA_ARGS__
|
||||
# define USE_FOR_MMU(...)
|
||||
# define USE_FOR_NOMMU(x) x
|
||||
# define USE_FOR_MMU(x)
|
||||
#endif
|
||||
|
||||
#include "NUM_APPLETS.h"
|
||||
@ -312,8 +314,8 @@
|
||||
# undef IF_FEATURE_SH_STANDALONE
|
||||
# undef IF_NOT_FEATURE_SH_STANDALONE
|
||||
# define ENABLE_FEATURE_SH_STANDALONE 0
|
||||
# define IF_FEATURE_SH_STANDALONE(...)
|
||||
# define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
|
||||
# define IF_FEATURE_SH_STANDALONE(x)
|
||||
# define IF_NOT_FEATURE_SH_STANDALONE(x) x
|
||||
#endif
|
||||
|
||||
#if !ENABLE_HUSH_INTERACTIVE
|
||||
@ -328,12 +330,12 @@
|
||||
/* Do we support ANY keywords? */
|
||||
#if ENABLE_HUSH_IF || ENABLE_HUSH_LOOPS || ENABLE_HUSH_CASE
|
||||
# define HAS_KEYWORDS 1
|
||||
# define IF_HAS_KEYWORDS(...) __VA_ARGS__
|
||||
# define IF_HAS_NO_KEYWORDS(...)
|
||||
# define IF_HAS_KEYWORDS(x) x
|
||||
# define IF_HAS_NO_KEYWORDS(x)
|
||||
#else
|
||||
# define HAS_KEYWORDS 0
|
||||
# define IF_HAS_KEYWORDS(...)
|
||||
# define IF_HAS_NO_KEYWORDS(...) __VA_ARGS__
|
||||
# define IF_HAS_KEYWORDS(x)
|
||||
# define IF_HAS_NO_KEYWORDS(x) x
|
||||
#endif
|
||||
|
||||
/* If you comment out one of these below, it will be #defined later
|
||||
@ -636,7 +638,7 @@ struct parse_context {
|
||||
* Neither of these (de)allocates the strings.
|
||||
* setenv allocates new strings in malloc space and does putenv,
|
||||
* and thus setenv is unusable (leaky) for shell's purposes */
|
||||
#define setenv(...) setenv_is_leaky_dont_use()
|
||||
#define setenv(x) setenv_is_leaky_dont_use()
|
||||
struct variable {
|
||||
struct variable *next;
|
||||
char *varstr; /* points to "name=" portion */
|
||||
@ -5670,7 +5672,9 @@ static void re_execute_shell(char ***to_free, const char *s,
|
||||
, (unsigned) G.last_exitcode
|
||||
, cnt
|
||||
, empty_trap_mask
|
||||
IF_HUSH_LOOPS(, G.depth_of_loop)
|
||||
# if ENABLE_HUSH_LOOPS
|
||||
, G.depth_of_loop
|
||||
# endif
|
||||
);
|
||||
# undef NOMMU_HACK_FMT
|
||||
/* 1:hush 2:-$<pid>:<pid>:<exitcode>:<etc...> <vars...> <funcs...>
|
||||
@ -8008,7 +8012,7 @@ int hush_main(int argc, char **argv)
|
||||
optarg++;
|
||||
builtin_argc = bb_strtou(optarg, &optarg, 16);
|
||||
optarg++;
|
||||
empty_trap_mask = bb_strtoull(optarg, &optarg, 16);
|
||||
empty_trap_mask = bb_strtoul(optarg, &optarg, 16);
|
||||
if (empty_trap_mask != 0) {
|
||||
int sig;
|
||||
install_special_sighandlers();
|
||||
|
@ -11,7 +11,7 @@ enum {
|
||||
SCAN_MOVE_FROM_LEFT = (1 << 0),
|
||||
SCAN_MOVE_FROM_RIGHT = (1 << 1),
|
||||
SCAN_MATCH_LEFT_HALF = (1 << 2),
|
||||
SCAN_MATCH_RIGHT_HALF = (1 << 3),
|
||||
SCAN_MATCH_RIGHT_HALF = (1 << 3)
|
||||
};
|
||||
|
||||
char* FAST_FUNC scan_and_match(char *string, const char *pattern, unsigned flags);
|
||||
|
@ -459,10 +459,8 @@ shell_builtin_ulimit(char **argv)
|
||||
else {
|
||||
if (sizeof(val) == sizeof(int))
|
||||
val = bb_strtou(val_str, NULL, 10);
|
||||
else if (sizeof(val) == sizeof(long))
|
||||
val = bb_strtoul(val_str, NULL, 10);
|
||||
else
|
||||
val = bb_strtoull(val_str, NULL, 10);
|
||||
val = bb_strtoul(val_str, NULL, 10);
|
||||
if (errno) {
|
||||
bb_error_msg("invalid number '%s'", val_str);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -30,7 +30,7 @@ int FAST_FUNC is_well_formed_var_name(const char *s, char terminator);
|
||||
|
||||
enum {
|
||||
BUILTIN_READ_SILENT = 1 << 0,
|
||||
BUILTIN_READ_RAW = 1 << 1,
|
||||
BUILTIN_READ_RAW = 1 << 1
|
||||
};
|
||||
const char* FAST_FUNC
|
||||
shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
|
||||
|
Loading…
x
Reference in New Issue
Block a user