skip_whitespace() shouldn't claim its return value is const, it doesn't know

that and callers wind up typecasting it back.
This commit is contained in:
Rob Landley 2006-06-18 20:20:07 +00:00
parent 14d7065ef1
commit ea224be6aa
12 changed files with 65 additions and 193 deletions

View File

@ -14,8 +14,6 @@
#include "busybox.h" #include "busybox.h"
#include <unistd.h> #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
@ -43,7 +41,6 @@ const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
#ifdef CONFIG_FEATURE_SUID_CONFIG #ifdef CONFIG_FEATURE_SUID_CONFIG
#include <sys/stat.h>
#include <ctype.h> #include <ctype.h>
#include "pwd_.h" #include "pwd_.h"
#include "grp_.h" #include "grp_.h"
@ -99,7 +96,7 @@ static char *get_trimmed_slice(char *s, char *e)
/* Next, advance past all leading space and return a ptr to the /* Next, advance past all leading space and return a ptr to the
* first non-space char; possibly the terminating nul. */ * first non-space char; possibly the terminating nul. */
return (char *) bb_skip_whitespace(s); return skip_whitespace(s);
} }
@ -240,7 +237,7 @@ static void parse_config_file(void)
/* Get the specified mode. */ /* Get the specified mode. */
e = (char *) bb_skip_whitespace(e+1); e = skip_whitespace(e+1);
for (i=0 ; i < 3 ; i++) { for (i=0 ; i < 3 ; i++) {
const char *q; const char *q;
@ -253,7 +250,7 @@ static void parse_config_file(void)
/* Now get the the user/group info. */ /* Now get the the user/group info. */
s = (char *) bb_skip_whitespace(e); s = skip_whitespace(e);
/* Note: We require whitespace between the mode and the /* Note: We require whitespace between the mode and the
* user/group info. */ * user/group info. */

View File

@ -36,32 +36,18 @@ enum {
/************************************************************************/ /************************************************************************/
#include <sys/types.h> #include "busybox.h"
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h>
#include <errno.h> #include <errno.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>
#include <termios.h>
#include <getopt.h> /* struct option */ #include <getopt.h> /* struct option */
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/sysmacros.h> /* major() and minor() */ #include <sys/sysmacros.h> /* major() and minor() */
#include "busybox.h"
#ifdef CONFIG_SELINUX
#include <selinux/selinux.h> /* for is_selinux_enabled() */
#endif
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
#include <time.h> #include <time.h>
#endif
/* what is the overall style of the listing */ /* what is the overall style of the listing */
#define STYLE_AUTO (0)
#define STYLE_COLUMNS (1U<<21) /* fill columns */ #define STYLE_COLUMNS (1U<<21) /* fill columns */
#define STYLE_LONG (2U<<21) /* one record per line, extended info */ #define STYLE_LONG (2U<<21) /* one record per line, extended info */
#define STYLE_SINGLE (3U<<21) /* one record per line */ #define STYLE_SINGLE (3U<<21) /* one record per line */
@ -99,7 +85,7 @@ enum {
#define DISP_MASK (((DISP_ROWS << 1) - 1) & ~(DISP_DIRNAME - 1)) #define DISP_MASK (((DISP_ROWS << 1) - 1) & ~(DISP_DIRNAME - 1))
#ifdef CONFIG_FEATURE_LS_SORTFILES // CONFIG_FEATURE_LS_SORTFILES
/* how will the files be sorted */ /* how will the files be sorted */
#define SORT_ORDER_FORWARD 0 /* sort in reverse order */ #define SORT_ORDER_FORWARD 0 /* sort in reverse order */
#define SORT_ORDER_REVERSE (1U<<27) /* sort in reverse order */ #define SORT_ORDER_REVERSE (1U<<27) /* sort in reverse order */
@ -114,7 +100,6 @@ enum {
#define SORT_DIR (7U<<28) /* sort by file or directory */ #define SORT_DIR (7U<<28) /* sort by file or directory */
#define SORT_MASK (7U<<28) #define SORT_MASK (7U<<28)
#endif
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS #ifdef CONFIG_FEATURE_LS_TIMESTAMPS
/* which of the three times will be used */ /* which of the three times will be used */
@ -416,11 +401,8 @@ static int sortcmp(const void *a, const void *b)
if (dif == 0) { if (dif == 0) {
/* sort by name- may be a tie_breaker for time or size cmp */ /* sort by name- may be a tie_breaker for time or size cmp */
#ifdef CONFIG_LOCALE_SUPPORT if (ENABLE_LOCALE_SUPPORT) dif = strcoll(d1->name, d2->name);
dif = strcoll(d1->name, d2->name); else dif = strcmp(d1->name, d2->name);
#else
dif = strcmp(d1->name, d2->name);
#endif
} }
if (all_fmt & SORT_ORDER_REVERSE) { if (all_fmt & SORT_ORDER_REVERSE) {
@ -434,8 +416,12 @@ static void dnsort(struct dnode **dn, int size)
{ {
qsort(dn, size, sizeof *dn, sortcmp); qsort(dn, size, sizeof *dn, sortcmp);
} }
#else
#define sortcmp(a, b) 0
#define dnsort(dn, size)
#endif #endif
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
static void showfiles(struct dnode **dn, int nfiles) static void showfiles(struct dnode **dn, int nfiles)
{ {
@ -502,11 +488,8 @@ static void showdirs(struct dnode **dn, int ndirs, int first)
{ {
int i, nfiles; int i, nfiles;
struct dnode **subdnp; struct dnode **subdnp;
#ifdef CONFIG_FEATURE_LS_RECURSIVE
int dndirs; int dndirs;
struct dnode **dnd; struct dnode **dnd;
#endif
if (dn == NULL || ndirs < 1) if (dn == NULL || ndirs < 1)
return; return;
@ -522,9 +505,7 @@ static void showdirs(struct dnode **dn, int ndirs, int first)
nfiles = countfiles(subdnp); nfiles = countfiles(subdnp);
if (nfiles > 0) { if (nfiles > 0) {
/* list all files at this level */ /* list all files at this level */
#ifdef CONFIG_FEATURE_LS_SORTFILES if (ENABLE_FEATURE_LS_SORTFILES) dnsort(subdnp, nfiles);
dnsort(subdnp, nfiles);
#endif
showfiles(subdnp, nfiles); showfiles(subdnp, nfiles);
#ifdef CONFIG_FEATURE_LS_RECURSIVE #ifdef CONFIG_FEATURE_LS_RECURSIVE
if (all_fmt & DISP_RECURSIVE) { if (all_fmt & DISP_RECURSIVE) {
@ -532,9 +513,7 @@ static void showdirs(struct dnode **dn, int ndirs, int first)
dnd = splitdnarray(subdnp, nfiles, SPLIT_SUBDIR); dnd = splitdnarray(subdnp, nfiles, SPLIT_SUBDIR);
dndirs = countsubdirs(subdnp, nfiles); dndirs = countsubdirs(subdnp, nfiles);
if (dndirs > 0) { if (dndirs > 0) {
#ifdef CONFIG_FEATURE_LS_SORTFILES if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnd, dndirs);
dnsort(dnd, dndirs);
#endif
showdirs(dnd, dndirs, 0); showdirs(dnd, dndirs, 0);
free(dnd); /* free the array of dnode pointers to the dirs */ free(dnd); /* free the array of dnode pointers to the dirs */
} }
@ -796,12 +775,6 @@ static int list_single(struct dnode *dn)
# define LS_STR_TIMESTAMPS "" # define LS_STR_TIMESTAMPS ""
#endif #endif
#ifdef CONFIG_FEATURE_LS_SORTFILES
# define LS_STR_SORTFILES "SXrv"
#else
# define LS_STR_SORTFILES ""
#endif
#ifdef CONFIG_FEATURE_LS_FILETYPES #ifdef CONFIG_FEATURE_LS_FILETYPES
# define LS_STR_FILETYPES "Fp" # define LS_STR_FILETYPES "Fp"
#else #else
@ -840,7 +813,7 @@ static int list_single(struct dnode *dn)
static const char ls_options[]="Cadil1gnsxAk" \ static const char ls_options[]="Cadil1gnsxAk" \
LS_STR_TIMESTAMPS \ LS_STR_TIMESTAMPS \
LS_STR_SORTFILES \ USE_FEATURE_LS_SORTFILES("SXrv") \
LS_STR_FILETYPES \ LS_STR_FILETYPES \
LS_STR_FOLLOW_LINKS \ LS_STR_FOLLOW_LINKS \
LS_STR_RECURSIVE \ LS_STR_RECURSIVE \
@ -872,22 +845,10 @@ static const unsigned opt_flags[] = {
0, /* k - ingored */ 0, /* k - ingored */
#endif #endif
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS #ifdef CONFIG_FEATURE_LS_TIMESTAMPS
# ifdef CONFIG_FEATURE_LS_SORTFILES TIME_CHANGE | (ENABLE_FEATURE_LS_SORTFILES * SORT_CTIME), /* c */
TIME_CHANGE | SORT_CTIME, /* c */
# else
TIME_CHANGE, /* c */
# endif
LIST_FULLTIME, /* e */ LIST_FULLTIME, /* e */
# ifdef CONFIG_FEATURE_LS_SORTFILES ENABLE_FEATURE_LS_SORTFILES * SORT_MTIME, /* t */
SORT_MTIME, /* t */ TIME_ACCESS | (ENABLE_FEATURE_LS_SORTFILES * SORT_ATIME), /* u */
# else
0, /* t - ignored -- is this correct? */
# endif
# ifdef CONFIG_FEATURE_LS_SORTFILES
TIME_ACCESS | SORT_ATIME, /* u */
# else
TIME_ACCESS, /* u */
# endif
#endif #endif
#ifdef CONFIG_FEATURE_LS_SORTFILES #ifdef CONFIG_FEATURE_LS_SORTFILES
SORT_SIZE, /* S */ SORT_SIZE, /* S */
@ -943,14 +904,8 @@ int ls_main(int argc, char **argv)
char *color_opt; char *color_opt;
#endif #endif
all_fmt = LIST_SHORT | STYLE_AUTO all_fmt = LIST_SHORT | (ENABLE_FEATURE_LS_TIMESTAMPS * TIME_MOD) |
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS (ENABLE_FEATURE_LS_SORTFILES * (SORT_NAME | SORT_ORDER_FORWARD));
| TIME_MOD
#endif
#ifdef CONFIG_FEATURE_LS_SORTFILES
| SORT_NAME | SORT_ORDER_FORWARD
#endif
;
#ifdef CONFIG_FEATURE_AUTOWIDTH #ifdef CONFIG_FEATURE_AUTOWIDTH
/* Obtain the terminal width. */ /* Obtain the terminal width. */
@ -993,11 +948,9 @@ int ls_main(int argc, char **argv)
if (flags & STYLE_MASK_TRIGGER) { if (flags & STYLE_MASK_TRIGGER) {
all_fmt &= ~STYLE_MASK; all_fmt &= ~STYLE_MASK;
} }
#ifdef CONFIG_FEATURE_LS_SORTFILES if (ENABLE_FEATURE_LS_SORTFILES && (flags & SORT_MASK_TRIGGER)) {
if (flags & SORT_MASK_TRIGGER) {
all_fmt &= ~SORT_MASK; all_fmt &= ~SORT_MASK;
} }
#endif
if (flags & DISP_MASK_TRIGGER) { if (flags & DISP_MASK_TRIGGER) {
all_fmt &= ~DISP_MASK; all_fmt &= ~DISP_MASK;
} }
@ -1049,12 +1002,12 @@ int ls_main(int argc, char **argv)
if (all_fmt & DISP_NOLIST) if (all_fmt & DISP_NOLIST)
all_fmt &= ~DISP_RECURSIVE; /* no recurse if listing only dir */ all_fmt &= ~DISP_RECURSIVE; /* no recurse if listing only dir */
#endif #endif
#if defined (CONFIG_FEATURE_LS_TIMESTAMPS) && defined (CONFIG_FEATURE_LS_SORTFILES) if (ENABLE_FEATURE_LS_TIMESTAMPS && ENABLE_FEATURE_LS_SORTFILES) {
if (all_fmt & TIME_CHANGE) if (all_fmt & TIME_CHANGE)
all_fmt = (all_fmt & ~SORT_MASK) | SORT_CTIME; all_fmt = (all_fmt & ~SORT_MASK) | SORT_CTIME;
if (all_fmt & TIME_ACCESS) if (all_fmt & TIME_ACCESS)
all_fmt = (all_fmt & ~SORT_MASK) | SORT_ATIME; all_fmt = (all_fmt & ~SORT_MASK) | SORT_ATIME;
#endif }
if ((all_fmt & STYLE_MASK) != STYLE_LONG) /* only for long list */ if ((all_fmt & STYLE_MASK) != STYLE_LONG) /* only for long list */
all_fmt &= ~(LIST_ID_NUMERIC|LIST_FULLTIME|LIST_ID_NAME|LIST_ID_NUMERIC); all_fmt &= ~(LIST_ID_NUMERIC|LIST_FULLTIME|LIST_ID_NAME|LIST_ID_NUMERIC);
#ifdef CONFIG_FEATURE_LS_USERNAME #ifdef CONFIG_FEATURE_LS_USERNAME
@ -1063,13 +1016,8 @@ int ls_main(int argc, char **argv)
#endif #endif
/* choose a display format */ /* choose a display format */
if ((all_fmt & STYLE_MASK) == STYLE_AUTO) if (!(all_fmt & STYLE_MASK))
#if STYLE_AUTO != 0
all_fmt = (all_fmt & ~STYLE_MASK)
| (isatty(STDOUT_FILENO) ? STYLE_COLUMNS : STYLE_SINGLE);
#else
all_fmt |= (isatty(STDOUT_FILENO) ? STYLE_COLUMNS : STYLE_SINGLE); all_fmt |= (isatty(STDOUT_FILENO) ? STYLE_COLUMNS : STYLE_SINGLE);
#endif
/* /*
* when there are no cmd line args we have to supply a default "." arg. * when there are no cmd line args we have to supply a default "." arg.
@ -1114,9 +1062,7 @@ int ls_main(int argc, char **argv)
} }
if (all_fmt & DISP_NOLIST) { if (all_fmt & DISP_NOLIST) {
#ifdef CONFIG_FEATURE_LS_SORTFILES if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnp, nfiles);
dnsort(dnp, nfiles);
#endif
if (nfiles > 0) if (nfiles > 0)
showfiles(dnp, nfiles); showfiles(dnp, nfiles);
} else { } else {
@ -1125,17 +1071,13 @@ int ls_main(int argc, char **argv)
dndirs = countdirs(dnp, nfiles); dndirs = countdirs(dnp, nfiles);
dnfiles = nfiles - dndirs; dnfiles = nfiles - dndirs;
if (dnfiles > 0) { if (dnfiles > 0) {
#ifdef CONFIG_FEATURE_LS_SORTFILES if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnf, dnfiles);
dnsort(dnf, dnfiles);
#endif
showfiles(dnf, dnfiles); showfiles(dnf, dnfiles);
if (ENABLE_FEATURE_CLEAN_UP) if (ENABLE_FEATURE_CLEAN_UP)
free(dnf); free(dnf);
} }
if (dndirs > 0) { if (dndirs > 0) {
#ifdef CONFIG_FEATURE_LS_SORTFILES if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnd, dndirs);
dnsort(dnd, dndirs);
#endif
showdirs(dnd, dndirs, dnfiles == 0); showdirs(dnd, dndirs, dnfiles == 0);
if (ENABLE_FEATURE_CLEAN_UP) if (ENABLE_FEATURE_CLEAN_UP)
free(dnd); free(dnd);

View File

@ -19,14 +19,12 @@
* "This program is in the Public Domain." * "This program is in the Public Domain."
*/ */
#include <sys/types.h> #include "busybox.h"
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <setjmp.h> #include <setjmp.h>
#include "busybox.h"
/* test(1) accepts the following grammar: /* test(1) accepts the following grammar:
oexpr ::= aexpr | aexpr "-o" oexpr ; oexpr ::= aexpr | aexpr "-o" oexpr ;
@ -482,8 +480,7 @@ static arith_t getn(const char *s)
if (errno != 0) if (errno != 0)
syntax(s, "out of range"); syntax(s, "out of range");
/* p = bb_skip_whitespace(p); avoid const warning */ if (*(skip_whitespace(p)))
if (*(bb_skip_whitespace(p)))
syntax(s, "bad number"); syntax(s, "bad number");
return r; return r;

View File

@ -10,12 +10,10 @@
/* BB_AUDIT SUSv3 compliant */ /* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */
#include <stdio.h> #include "busybox.h"
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <unistd.h> #include <unistd.h>
#include "busybox.h"
static const char uniq_opts[] = "f:s:" "cdu\0\1\2\4"; static const char uniq_opts[] = "f:s:" "cdu\0\1\2\4";
@ -77,7 +75,7 @@ int uniq_main(int argc, char **argv)
while ((s1 = bb_get_chomped_line_from_file(in)) != NULL) { while ((s1 = bb_get_chomped_line_from_file(in)) != NULL) {
e1 = s1; e1 = s1;
for (i=skip_fields ; i ; i--) { for (i=skip_fields ; i ; i--) {
e1 = bb_skip_whitespace(e1); e1 = skip_whitespace(e1);
while (*e1 && !isspace(*e1)) { while (*e1 && !isspace(*e1)) {
++e1; ++e1;
} }

View File

@ -200,7 +200,7 @@ extern void bb_warn_ignoring_args(int n);
extern void chomp(char *s); extern void chomp(char *s);
extern void trim(char *s); extern void trim(char *s);
extern const char *bb_skip_whitespace(const char *); extern char *skip_whitespace(const char *);
extern struct BB_applet *find_applet_by_name(const char *name); extern struct BB_applet *find_applet_by_name(const char *name);
void run_applet_by_name(const char *name, int argc, char **argv); void run_applet_by_name(const char *name, int argc, char **argv);

View File

@ -10,11 +10,10 @@
* Original copyright notice is retained at the end of this file. * Original copyright notice is retained at the end of this file.
*/ */
#include <stdlib.h> #include "libbb.h"
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> /* for isdigit() */ #include <ctype.h> /* for isdigit() */
#include "libbb.h"
#include "dump.h" #include "dump.h"
enum _vflag bb_dump_vflag = FIRST; enum _vflag bb_dump_vflag = FIRST;
@ -83,9 +82,9 @@ int bb_dump_size(FS * fs)
static void rewrite(FS * fs) static void rewrite(FS * fs)
{ {
enum { NOTOKAY, USEBCNT, USEPREC } sokay; enum { NOTOKAY, USEBCNT, USEPREC } sokay;
register PR *pr, **nextpr = NULL; PR *pr, **nextpr = NULL;
register FU *fu; FU *fu;
register char *p1, *p2, *p3; char *p1, *p2, *p3;
char savech, *fmtp; char savech, *fmtp;
const char *byte_count_str; const char *byte_count_str;
int nconv, prec = 0; int nconv, prec = 0;
@ -98,7 +97,7 @@ static void rewrite(FS * fs)
for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) { for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
/* NOSTRICT */ /* NOSTRICT */
/* DBU:[dvae@cray.com] calloc so that forward ptrs start out NULL*/ /* DBU:[dvae@cray.com] calloc so that forward ptrs start out NULL*/
pr = (PR *) xzalloc(sizeof(PR)); pr = xzalloc(sizeof(PR));
if (!fu->nextpr) if (!fu->nextpr)
fu->nextpr = pr; fu->nextpr = pr;
/* ignore nextpr -- its unused inside the loop and is /* ignore nextpr -- its unused inside the loop and is
@ -246,8 +245,7 @@ static void rewrite(FS * fs)
{ {
savech = *p3; savech = *p3;
*p3 = '\0'; *p3 = '\0';
if (!(pr->fmt = realloc(pr->fmt, strlen(pr->fmt)+(p3-p2)+1))) pr->fmt = xrealloc(pr->fmt, strlen(pr->fmt)+(p3-p2)+1);
bb_perror_msg_and_die("hexdump");
strcat(pr->fmt, p2); strcat(pr->fmt, p2);
*p3 = savech; *p3 = savech;
p2 = p3; p2 = p3;
@ -673,17 +671,16 @@ int bb_dump_dump(char **argv)
void bb_dump_add(const char *fmt) void bb_dump_add(const char *fmt)
{ {
register const char *p; const char *p;
register char *p1; char *p1;
register char *p2; char *p2;
static FS **nextfs; static FS **nextfs;
FS *tfs; FS *tfs;
FU *tfu, **nextfu; FU *tfu, **nextfu;
const char *savep; const char *savep;
/* start new linked list of format units */ /* start new linked list of format units */
/* NOSTRICT */ tfs = xzalloc(sizeof(FS)); /*DBU:[dave@cray.com] start out NULL */
tfs = (FS *) xzalloc(sizeof(FS)); /*DBU:[dave@cray.com] start out NULL */
if (!bb_dump_fshead) { if (!bb_dump_fshead) {
bb_dump_fshead = tfs; bb_dump_fshead = tfs;
} else { } else {
@ -695,7 +692,7 @@ void bb_dump_add(const char *fmt)
/* take the format string and break it up into format units */ /* take the format string and break it up into format units */
for (p = fmt;;) { for (p = fmt;;) {
/* bb_dump_skip leading white space */ /* bb_dump_skip leading white space */
p = bb_skip_whitespace(p); p = skip_whitespace(p);
if (!*p) { if (!*p) {
break; break;
} }
@ -703,7 +700,7 @@ void bb_dump_add(const char *fmt)
/* allocate a new format unit and link it in */ /* allocate a new format unit and link it in */
/* NOSTRICT */ /* NOSTRICT */
/* DBU:[dave@cray.com] calloc so that forward pointers start out NULL */ /* DBU:[dave@cray.com] calloc so that forward pointers start out NULL */
tfu = (FU *) xzalloc(sizeof(FU)); tfu = xzalloc(sizeof(FU));
*nextfu = tfu; *nextfu = tfu;
nextfu = &tfu->nextfu; nextfu = &tfu->nextfu;
tfu->reps = 1; tfu->reps = 1;
@ -718,12 +715,12 @@ void bb_dump_add(const char *fmt)
tfu->reps = atoi(savep); tfu->reps = atoi(savep);
tfu->flags = F_SETREP; tfu->flags = F_SETREP;
/* bb_dump_skip trailing white space */ /* bb_dump_skip trailing white space */
p = bb_skip_whitespace(++p); p = skip_whitespace(++p);
} }
/* bb_dump_skip slash and trailing white space */ /* bb_dump_skip slash and trailing white space */
if (*p == '/') { if (*p == '/') {
p = bb_skip_whitespace(++p); p = skip_whitespace(++p);
} }
/* byte count */ /* byte count */
@ -734,7 +731,7 @@ void bb_dump_add(const char *fmt)
} }
tfu->bcnt = atoi(savep); tfu->bcnt = atoi(savep);
/* bb_dump_skip trailing white space */ /* bb_dump_skip trailing white space */
p = bb_skip_whitespace(++p); p = skip_whitespace(++p);
} }
/* format */ /* format */

View File

@ -8,13 +8,13 @@
* *
*/ */
#include "libbb.h"
#include "inet_common.h" #include "inet_common.h"
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "libbb.h"
#ifdef DEBUG #ifdef DEBUG
# include <resolv.h> # include <resolv.h>

View File

@ -20,9 +20,9 @@
* *
*/ */
#include "libbb.h"
#include <string.h> #include <string.h>
#include <crypt.h> #include <crypt.h>
#include "libbb.h"
char *pw_encrypt(const char *clear, const char *salt) char *pw_encrypt(const char *clear, const char *salt)

View File

@ -4,30 +4,15 @@
* *
* Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
* *
* This program is free software; you can redistribute it and/or modify * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
* 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
*
*/ */
#include <ctype.h> #include <ctype.h>
#include "libbb.h" #include "libbb.h"
const char *bb_skip_whitespace(const char *s) char *skip_whitespace(const char *s)
{ {
while (isspace(*s)) { while (isspace(*s)) ++s;
++s;
}
return s; return (char *) s;
} }

View File

@ -17,6 +17,7 @@
* *
*/ */
#include "libbb.h"
#include <features.h> #include <features.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -27,10 +28,9 @@
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include "pwd_.h" //#include "pwd_.h"
#include "grp_.h" //#include "grp_.h"
#include "shadow_.h" //#include "shadow_.h"
#include "libbb.h"
#ifndef _PATH_SHADOW #ifndef _PATH_SHADOW
#define _PATH_SHADOW "/etc/shadow" #define _PATH_SHADOW "/etc/shadow"

View File

@ -9,8 +9,7 @@
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/ */
#include <stdio.h> #include "libbb.h"
#include <arpa/inet.h>
#include <string.h> #include <string.h>
#include "rt_names.h" #include "rt_names.h"

View File

@ -5,27 +5,12 @@
* Copyright (c) 1989 * Copyright (c) 1989
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * Licensed under GPLv2 or later, see file License in this tarball for details.
* 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
*
* Original copyright notice is retained at the end of this file.
*/ */
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include "busybox.h" #include "busybox.h"
#include <getopt.h>
#include <string.h>
#include "dump.h" #include "dump.h"
static void bb_dump_addfile(char *name) static void bb_dump_addfile(char *name)
@ -37,7 +22,7 @@ static void bb_dump_addfile(char *name)
fp = bb_xfopen(name, "r"); fp = bb_xfopen(name, "r");
while ((buf = bb_get_chomped_line_from_file(fp)) != NULL) { while ((buf = bb_get_chomped_line_from_file(fp)) != NULL) {
p = (char *) bb_skip_whitespace(buf); p = skip_whitespace(buf);
if (*p && (*p != '#')) { if (*p && (*p != '#')) {
bb_dump_add(p); bb_dump_add(p);
@ -116,31 +101,3 @@ int hexdump_main(int argc, char **argv)
return(bb_dump_dump(argv)); return(bb_dump_dump(argv));
} }
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/