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:
parent
14d7065ef1
commit
ea224be6aa
@ -14,8 +14,6 @@
|
||||
|
||||
#include "busybox.h"
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.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
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include "pwd_.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
|
||||
* 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. */
|
||||
|
||||
e = (char *) bb_skip_whitespace(e+1);
|
||||
e = skip_whitespace(e+1);
|
||||
|
||||
for (i=0 ; i < 3 ; i++) {
|
||||
const char *q;
|
||||
@ -253,7 +250,7 @@ static void parse_config_file(void)
|
||||
|
||||
/* 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
|
||||
* user/group info. */
|
||||
|
112
coreutils/ls.c
112
coreutils/ls.c
@ -36,32 +36,18 @@ enum {
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include "busybox.h"
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <termios.h>
|
||||
#include <getopt.h> /* struct option */
|
||||
#include <sys/ioctl.h>
|
||||
#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>
|
||||
#endif
|
||||
|
||||
/* what is the overall style of the listing */
|
||||
#define STYLE_AUTO (0)
|
||||
#define STYLE_COLUMNS (1U<<21) /* fill columns */
|
||||
#define STYLE_LONG (2U<<21) /* one record per line, extended info */
|
||||
#define STYLE_SINGLE (3U<<21) /* one record per line */
|
||||
@ -99,7 +85,7 @@ enum {
|
||||
|
||||
#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 */
|
||||
#define SORT_ORDER_FORWARD 0 /* 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_MASK (7U<<28)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
|
||||
/* which of the three times will be used */
|
||||
@ -416,11 +401,8 @@ static int sortcmp(const void *a, const void *b)
|
||||
|
||||
if (dif == 0) {
|
||||
/* sort by name- may be a tie_breaker for time or size cmp */
|
||||
#ifdef CONFIG_LOCALE_SUPPORT
|
||||
dif = strcoll(d1->name, d2->name);
|
||||
#else
|
||||
dif = strcmp(d1->name, d2->name);
|
||||
#endif
|
||||
if (ENABLE_LOCALE_SUPPORT) dif = strcoll(d1->name, d2->name);
|
||||
else dif = strcmp(d1->name, d2->name);
|
||||
}
|
||||
|
||||
if (all_fmt & SORT_ORDER_REVERSE) {
|
||||
@ -434,8 +416,12 @@ static void dnsort(struct dnode **dn, int size)
|
||||
{
|
||||
qsort(dn, size, sizeof *dn, sortcmp);
|
||||
}
|
||||
#else
|
||||
#define sortcmp(a, b) 0
|
||||
#define dnsort(dn, size)
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
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;
|
||||
struct dnode **subdnp;
|
||||
|
||||
#ifdef CONFIG_FEATURE_LS_RECURSIVE
|
||||
int dndirs;
|
||||
struct dnode **dnd;
|
||||
#endif
|
||||
|
||||
if (dn == NULL || ndirs < 1)
|
||||
return;
|
||||
@ -522,9 +505,7 @@ static void showdirs(struct dnode **dn, int ndirs, int first)
|
||||
nfiles = countfiles(subdnp);
|
||||
if (nfiles > 0) {
|
||||
/* list all files at this level */
|
||||
#ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
dnsort(subdnp, nfiles);
|
||||
#endif
|
||||
if (ENABLE_FEATURE_LS_SORTFILES) dnsort(subdnp, nfiles);
|
||||
showfiles(subdnp, nfiles);
|
||||
#ifdef CONFIG_FEATURE_LS_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);
|
||||
dndirs = countsubdirs(subdnp, nfiles);
|
||||
if (dndirs > 0) {
|
||||
#ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
dnsort(dnd, dndirs);
|
||||
#endif
|
||||
if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnd, dndirs);
|
||||
showdirs(dnd, dndirs, 0);
|
||||
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 ""
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
# define LS_STR_SORTFILES "SXrv"
|
||||
#else
|
||||
# define LS_STR_SORTFILES ""
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_LS_FILETYPES
|
||||
# define LS_STR_FILETYPES "Fp"
|
||||
#else
|
||||
@ -840,7 +813,7 @@ static int list_single(struct dnode *dn)
|
||||
|
||||
static const char ls_options[]="Cadil1gnsxAk" \
|
||||
LS_STR_TIMESTAMPS \
|
||||
LS_STR_SORTFILES \
|
||||
USE_FEATURE_LS_SORTFILES("SXrv") \
|
||||
LS_STR_FILETYPES \
|
||||
LS_STR_FOLLOW_LINKS \
|
||||
LS_STR_RECURSIVE \
|
||||
@ -872,22 +845,10 @@ static const unsigned opt_flags[] = {
|
||||
0, /* k - ingored */
|
||||
#endif
|
||||
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
|
||||
# ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
TIME_CHANGE | SORT_CTIME, /* c */
|
||||
# else
|
||||
TIME_CHANGE, /* c */
|
||||
# endif
|
||||
TIME_CHANGE | (ENABLE_FEATURE_LS_SORTFILES * SORT_CTIME), /* c */
|
||||
LIST_FULLTIME, /* e */
|
||||
# ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
SORT_MTIME, /* t */
|
||||
# else
|
||||
0, /* t - ignored -- is this correct? */
|
||||
# endif
|
||||
# ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
TIME_ACCESS | SORT_ATIME, /* u */
|
||||
# else
|
||||
TIME_ACCESS, /* u */
|
||||
# endif
|
||||
ENABLE_FEATURE_LS_SORTFILES * SORT_MTIME, /* t */
|
||||
TIME_ACCESS | (ENABLE_FEATURE_LS_SORTFILES * SORT_ATIME), /* u */
|
||||
#endif
|
||||
#ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
SORT_SIZE, /* S */
|
||||
@ -943,14 +904,8 @@ int ls_main(int argc, char **argv)
|
||||
char *color_opt;
|
||||
#endif
|
||||
|
||||
all_fmt = LIST_SHORT | STYLE_AUTO
|
||||
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
|
||||
| TIME_MOD
|
||||
#endif
|
||||
#ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
| SORT_NAME | SORT_ORDER_FORWARD
|
||||
#endif
|
||||
;
|
||||
all_fmt = LIST_SHORT | (ENABLE_FEATURE_LS_TIMESTAMPS * TIME_MOD) |
|
||||
(ENABLE_FEATURE_LS_SORTFILES * (SORT_NAME | SORT_ORDER_FORWARD));
|
||||
|
||||
#ifdef CONFIG_FEATURE_AUTOWIDTH
|
||||
/* Obtain the terminal width. */
|
||||
@ -993,11 +948,9 @@ int ls_main(int argc, char **argv)
|
||||
if (flags & STYLE_MASK_TRIGGER) {
|
||||
all_fmt &= ~STYLE_MASK;
|
||||
}
|
||||
#ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
if (flags & SORT_MASK_TRIGGER) {
|
||||
if (ENABLE_FEATURE_LS_SORTFILES && (flags & SORT_MASK_TRIGGER)) {
|
||||
all_fmt &= ~SORT_MASK;
|
||||
}
|
||||
#endif
|
||||
if (flags & DISP_MASK_TRIGGER) {
|
||||
all_fmt &= ~DISP_MASK;
|
||||
}
|
||||
@ -1049,12 +1002,12 @@ int ls_main(int argc, char **argv)
|
||||
if (all_fmt & DISP_NOLIST)
|
||||
all_fmt &= ~DISP_RECURSIVE; /* no recurse if listing only dir */
|
||||
#endif
|
||||
#if defined (CONFIG_FEATURE_LS_TIMESTAMPS) && defined (CONFIG_FEATURE_LS_SORTFILES)
|
||||
if (all_fmt & TIME_CHANGE)
|
||||
all_fmt = (all_fmt & ~SORT_MASK) | SORT_CTIME;
|
||||
if (all_fmt & TIME_ACCESS)
|
||||
all_fmt = (all_fmt & ~SORT_MASK) | SORT_ATIME;
|
||||
#endif
|
||||
if (ENABLE_FEATURE_LS_TIMESTAMPS && ENABLE_FEATURE_LS_SORTFILES) {
|
||||
if (all_fmt & TIME_CHANGE)
|
||||
all_fmt = (all_fmt & ~SORT_MASK) | SORT_CTIME;
|
||||
if (all_fmt & TIME_ACCESS)
|
||||
all_fmt = (all_fmt & ~SORT_MASK) | SORT_ATIME;
|
||||
}
|
||||
if ((all_fmt & STYLE_MASK) != STYLE_LONG) /* only for long list */
|
||||
all_fmt &= ~(LIST_ID_NUMERIC|LIST_FULLTIME|LIST_ID_NAME|LIST_ID_NUMERIC);
|
||||
#ifdef CONFIG_FEATURE_LS_USERNAME
|
||||
@ -1063,13 +1016,8 @@ int ls_main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
/* choose a display format */
|
||||
if ((all_fmt & STYLE_MASK) == STYLE_AUTO)
|
||||
#if STYLE_AUTO != 0
|
||||
all_fmt = (all_fmt & ~STYLE_MASK)
|
||||
| (isatty(STDOUT_FILENO) ? STYLE_COLUMNS : STYLE_SINGLE);
|
||||
#else
|
||||
if (!(all_fmt & STYLE_MASK))
|
||||
all_fmt |= (isatty(STDOUT_FILENO) ? STYLE_COLUMNS : STYLE_SINGLE);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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) {
|
||||
#ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
dnsort(dnp, nfiles);
|
||||
#endif
|
||||
if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnp, nfiles);
|
||||
if (nfiles > 0)
|
||||
showfiles(dnp, nfiles);
|
||||
} else {
|
||||
@ -1125,17 +1071,13 @@ int ls_main(int argc, char **argv)
|
||||
dndirs = countdirs(dnp, nfiles);
|
||||
dnfiles = nfiles - dndirs;
|
||||
if (dnfiles > 0) {
|
||||
#ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
dnsort(dnf, dnfiles);
|
||||
#endif
|
||||
if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnf, dnfiles);
|
||||
showfiles(dnf, dnfiles);
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
free(dnf);
|
||||
}
|
||||
if (dndirs > 0) {
|
||||
#ifdef CONFIG_FEATURE_LS_SORTFILES
|
||||
dnsort(dnd, dndirs);
|
||||
#endif
|
||||
if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnd, dndirs);
|
||||
showdirs(dnd, dndirs, dnfiles == 0);
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
free(dnd);
|
||||
|
@ -19,14 +19,12 @@
|
||||
* "This program is in the Public Domain."
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "busybox.h"
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* test(1) accepts the following grammar:
|
||||
oexpr ::= aexpr | aexpr "-o" oexpr ;
|
||||
@ -482,8 +480,7 @@ static arith_t getn(const char *s)
|
||||
if (errno != 0)
|
||||
syntax(s, "out of range");
|
||||
|
||||
/* p = bb_skip_whitespace(p); avoid const warning */
|
||||
if (*(bb_skip_whitespace(p)))
|
||||
if (*(skip_whitespace(p)))
|
||||
syntax(s, "bad number");
|
||||
|
||||
return r;
|
||||
|
@ -10,12 +10,10 @@
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
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) {
|
||||
e1 = s1;
|
||||
for (i=skip_fields ; i ; i--) {
|
||||
e1 = bb_skip_whitespace(e1);
|
||||
e1 = skip_whitespace(e1);
|
||||
while (*e1 && !isspace(*e1)) {
|
||||
++e1;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ extern void bb_warn_ignoring_args(int n);
|
||||
|
||||
extern void chomp(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);
|
||||
void run_applet_by_name(const char *name, int argc, char **argv);
|
||||
|
33
libbb/dump.c
33
libbb/dump.c
@ -10,11 +10,10 @@
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "libbb.h"
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h> /* for isdigit() */
|
||||
#include "libbb.h"
|
||||
#include "dump.h"
|
||||
|
||||
enum _vflag bb_dump_vflag = FIRST;
|
||||
@ -83,9 +82,9 @@ int bb_dump_size(FS * fs)
|
||||
static void rewrite(FS * fs)
|
||||
{
|
||||
enum { NOTOKAY, USEBCNT, USEPREC } sokay;
|
||||
register PR *pr, **nextpr = NULL;
|
||||
register FU *fu;
|
||||
register char *p1, *p2, *p3;
|
||||
PR *pr, **nextpr = NULL;
|
||||
FU *fu;
|
||||
char *p1, *p2, *p3;
|
||||
char savech, *fmtp;
|
||||
const char *byte_count_str;
|
||||
int nconv, prec = 0;
|
||||
@ -98,7 +97,7 @@ static void rewrite(FS * fs)
|
||||
for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
|
||||
/* NOSTRICT */
|
||||
/* DBU:[dvae@cray.com] calloc so that forward ptrs start out NULL*/
|
||||
pr = (PR *) xzalloc(sizeof(PR));
|
||||
pr = xzalloc(sizeof(PR));
|
||||
if (!fu->nextpr)
|
||||
fu->nextpr = pr;
|
||||
/* ignore nextpr -- its unused inside the loop and is
|
||||
@ -246,8 +245,7 @@ static void rewrite(FS * fs)
|
||||
{
|
||||
savech = *p3;
|
||||
*p3 = '\0';
|
||||
if (!(pr->fmt = realloc(pr->fmt, strlen(pr->fmt)+(p3-p2)+1)))
|
||||
bb_perror_msg_and_die("hexdump");
|
||||
pr->fmt = xrealloc(pr->fmt, strlen(pr->fmt)+(p3-p2)+1);
|
||||
strcat(pr->fmt, p2);
|
||||
*p3 = savech;
|
||||
p2 = p3;
|
||||
@ -673,17 +671,16 @@ int bb_dump_dump(char **argv)
|
||||
|
||||
void bb_dump_add(const char *fmt)
|
||||
{
|
||||
register const char *p;
|
||||
register char *p1;
|
||||
register char *p2;
|
||||
const char *p;
|
||||
char *p1;
|
||||
char *p2;
|
||||
static FS **nextfs;
|
||||
FS *tfs;
|
||||
FU *tfu, **nextfu;
|
||||
const char *savep;
|
||||
|
||||
/* start new linked list of format units */
|
||||
/* NOSTRICT */
|
||||
tfs = (FS *) xzalloc(sizeof(FS)); /*DBU:[dave@cray.com] start out NULL */
|
||||
tfs = xzalloc(sizeof(FS)); /*DBU:[dave@cray.com] start out NULL */
|
||||
if (!bb_dump_fshead) {
|
||||
bb_dump_fshead = tfs;
|
||||
} else {
|
||||
@ -695,7 +692,7 @@ void bb_dump_add(const char *fmt)
|
||||
/* take the format string and break it up into format units */
|
||||
for (p = fmt;;) {
|
||||
/* bb_dump_skip leading white space */
|
||||
p = bb_skip_whitespace(p);
|
||||
p = skip_whitespace(p);
|
||||
if (!*p) {
|
||||
break;
|
||||
}
|
||||
@ -703,7 +700,7 @@ void bb_dump_add(const char *fmt)
|
||||
/* allocate a new format unit and link it in */
|
||||
/* NOSTRICT */
|
||||
/* 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->reps = 1;
|
||||
@ -718,12 +715,12 @@ void bb_dump_add(const char *fmt)
|
||||
tfu->reps = atoi(savep);
|
||||
tfu->flags = F_SETREP;
|
||||
/* bb_dump_skip trailing white space */
|
||||
p = bb_skip_whitespace(++p);
|
||||
p = skip_whitespace(++p);
|
||||
}
|
||||
|
||||
/* bb_dump_skip slash and trailing white space */
|
||||
if (*p == '/') {
|
||||
p = bb_skip_whitespace(++p);
|
||||
p = skip_whitespace(++p);
|
||||
}
|
||||
|
||||
/* byte count */
|
||||
@ -734,7 +731,7 @@ void bb_dump_add(const char *fmt)
|
||||
}
|
||||
tfu->bcnt = atoi(savep);
|
||||
/* bb_dump_skip trailing white space */
|
||||
p = bb_skip_whitespace(++p);
|
||||
p = skip_whitespace(++p);
|
||||
}
|
||||
|
||||
/* format */
|
||||
|
@ -8,13 +8,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
#include "inet_common.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "libbb.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
# include <resolv.h>
|
||||
|
@ -20,9 +20,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
#include <string.h>
|
||||
#include <crypt.h>
|
||||
#include "libbb.h"
|
||||
|
||||
|
||||
char *pw_encrypt(const char *clear, const char *salt)
|
||||
|
@ -4,30 +4,15 @@
|
||||
*
|
||||
* Copyright (C) 2003 Manuel Novoa III <mjn3@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 GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include "libbb.h"
|
||||
|
||||
const char *bb_skip_whitespace(const char *s)
|
||||
char *skip_whitespace(const char *s)
|
||||
{
|
||||
while (isspace(*s)) {
|
||||
++s;
|
||||
}
|
||||
while (isspace(*s)) ++s;
|
||||
|
||||
return s;
|
||||
return (char *) s;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
#include <features.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -27,10 +28,9 @@
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "pwd_.h"
|
||||
#include "grp_.h"
|
||||
#include "shadow_.h"
|
||||
#include "libbb.h"
|
||||
//#include "pwd_.h"
|
||||
//#include "grp_.h"
|
||||
//#include "shadow_.h"
|
||||
|
||||
#ifndef _PATH_SHADOW
|
||||
#define _PATH_SHADOW "/etc/shadow"
|
||||
|
@ -9,8 +9,7 @@
|
||||
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "libbb.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "rt_names.h"
|
||||
|
@ -5,27 +5,12 @@
|
||||
* Copyright (c) 1989
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
* Licensed under GPLv2 or later, see file License in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include "dump.h"
|
||||
|
||||
static void bb_dump_addfile(char *name)
|
||||
@ -37,7 +22,7 @@ static void bb_dump_addfile(char *name)
|
||||
fp = bb_xfopen(name, "r");
|
||||
|
||||
while ((buf = bb_get_chomped_line_from_file(fp)) != NULL) {
|
||||
p = (char *) bb_skip_whitespace(buf);
|
||||
p = skip_whitespace(buf);
|
||||
|
||||
if (*p && (*p != '#')) {
|
||||
bb_dump_add(p);
|
||||
@ -116,31 +101,3 @@ int hexdump_main(int argc, char **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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user