Remove trailing whitespace. Update copyright to include 2004.

This commit is contained in:
Eric Andersen
2004-03-15 08:29:22 +00:00
parent 8854004b41
commit c7bda1ce65
374 changed files with 2048 additions and 2051 deletions

View File

@@ -1,6 +1,6 @@
# Makefile for busybox
#
# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
# Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -1,11 +1,11 @@
Please see the LICENSE file for copyright information (GPLv2)
libbb is BusyBox's utility library. All of this stuff used to be stuffed into
a single file named utility.c. When I split utility.c to create libbb, some of
the very oldest stuff ended up without their original copyright and licensing
information (which is now lost in the mists of time). If you see something
that you wrote that is mis-attributed, do let me know so we can fix that up.
Erik Andersen
Erik Andersen
<andersen@codepoet.org>

View File

@@ -11,7 +11,7 @@ void bb_xasprintf(char **string_ptr, const char *format, ...)
{
va_list p;
int r;
va_start(p, format);
r = vasprintf(string_ptr, format, p);
va_end(p);

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) many different people.
* Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@
void chomp(char *s)
{
char *lc = last_char_is(s, '\n');
if(lc)
*lc = 0;
}

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) many different people.
* Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -49,14 +49,14 @@
int correct_password ( const struct passwd *pw )
{
char *unencrypted, *encrypted, *correct;
#ifdef CONFIG_FEATURE_SHADOWPASSWDS
if (( strcmp ( pw-> pw_passwd, "x" ) == 0 ) || ( strcmp ( pw-> pw_passwd, "*" ) == 0 )) {
struct spwd *sp = getspnam ( pw-> pw_name );
if ( !sp )
bb_error_msg_and_die ( "no valid shadow password" );
correct = sp-> sp_pwdp;
}
else

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -248,8 +248,8 @@ static void rewrite(FS * fs)
pr->cchar = pr->fmt + (p1 - fmtp);
/* DBU:[dave@cray.com] w/o this, trailing fmt text, space is lost.
* Skip subsequent text and up to the next % sign and tack the
* additional text onto fmt: eg. if fmt is "%x is a HEX number",
* Skip subsequent text and up to the next % sign and tack the
* additional text onto fmt: eg. if fmt is "%x is a HEX number",
* we lose the " is a HEX number" part of fmt.
*/
for (p3 = p2; *p3 && *p3 != '%'; p3++);

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) many different people.
* Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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
@@ -25,15 +25,15 @@
#include <stdlib.h>
#include "libbb.h"
#define COMM_LEN 16 /* synchronize with size of comm in struct task_struct
#define COMM_LEN 16 /* synchronize with size of comm in struct task_struct
in /usr/include/linux/sched.h */
/* find_pid_by_name()
*
*
* Modified by Vladimir Oleynik for use with libbb/procps.c
* This finds the pid of the specified process.
* Currently, it's implemented by rummaging through
* Currently, it's implemented by rummaging through
* the proc filesystem.
*
* Returns a list of all matching PIDs

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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
@@ -35,7 +35,7 @@ extern char *find_real_root_device_name(const char* name)
char *fileName = NULL;
dev_t dev;
if (stat("/", &rootStat) != 0)
if (stat("/", &rootStat) != 0)
bb_perror_msg("could not stat '/'");
else {
/* This check is here in case they pass in /dev name */
@@ -45,7 +45,7 @@ extern char *find_real_root_device_name(const char* name)
dev = rootStat.st_dev;
dir = opendir("/dev");
if (!dir)
if (!dir)
bb_perror_msg("could not open '/dev'");
else {
while((entry = readdir(dir)) != NULL) {
@@ -59,9 +59,9 @@ extern char *find_real_root_device_name(const char* name)
/* Some char devices have the same dev_t as block
* devices, so make sure this is a block device */
if (stat(fileName, &statBuf) == 0 &&
if (stat(fileName, &statBuf) == 0 &&
S_ISBLK(statBuf.st_mode)!=0 &&
statBuf.st_rdev == dev)
statBuf.st_rdev == dev)
break;
free(fileName);
fileName=NULL;

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -29,7 +29,7 @@
/* From <linux/kd.h> */
/* From <linux/kd.h> */
static const int KDGKBTYPE = 0x4B33; /* get keyboard type */

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) many different people.
* Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -2,7 +2,7 @@
/*
* Determine the width and height of the terminal.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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
@@ -30,7 +30,7 @@
/* It is perfectly ok to pass in a NULL for either width or for
* height, in which case that value will not be set. It is also
* perfectly ok to have CONFIG_FEATURE_AUTOWIDTH disabled, in
* perfectly ok to have CONFIG_FEATURE_AUTOWIDTH disabled, in
* which case you will always get 80x24 */
void get_terminal_width_height(int fd, int *width, int *height)
{

View File

@@ -4,7 +4,7 @@
*
* Copyright (C) 2003 Glenn L. McGrath
* Copyright (C) 2003 Erik Andersen
*
*
* 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
@@ -47,27 +47,27 @@
LICENSE TERMS
The free distribution and use of this software in both source and binary
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 10/11/2002
@@ -805,7 +805,7 @@ extern int hash_fd(int src_fd, const size_t size, const uint8_t hash_algo,
cx = &md5_cx;
}
#endif
/* Initialize the computation context. */
#ifdef CONFIG_SHA1SUM
if (hash_algo == HASH_SHA1) {

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -13,8 +13,8 @@
* representations (say, powers of 1024) and manipulating coefficients.
* The base ten "bytes" output could be handled similarly.
*
* 2) This routine always outputs a decimal point and a tenths digit when
* display_unit != 0. Hence, it isn't uncommon for the returned string
* 2) This routine always outputs a decimal point and a tenths digit when
* display_unit != 0. Hence, it isn't uncommon for the returned string
* to have a length of 5 or 6.
*
* It might be nice to add a flag to indicate no decimal digits in
@@ -28,7 +28,7 @@
#include <stdio.h>
#include "libbb.h"
const char *make_human_readable_str(unsigned long long size,
const char *make_human_readable_str(unsigned long long size,
unsigned long block_size, unsigned long display_unit)
{
/* The code will adjust for additional (appended) units. */
@@ -37,7 +37,7 @@ const char *make_human_readable_str(unsigned long long size,
static const char fmt_tenths[] = "%Lu.%d%c";
static char str[21]; /* Sufficient for 64 bit unsigned integers. */
unsigned long long val;
int frac;
const char *u;

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) many different people.
* Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
@@ -69,7 +69,7 @@ void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name)
int i;
size_t s;
ino_dev_hashtable_bucket_t *bucket;
i = hash_inode(statbuf->st_ino);
s = name ? strlen(name) : 0;
bucket = xmalloc(sizeof(ino_dev_hashtable_bucket_t) + s);

View File

@@ -1,5 +1,5 @@
/*
* stolen from net-tools-1.59 and stripped down for busybox by
* stolen from net-tools-1.59 and stripped down for busybox by
* Erik Andersen <andersen@codepoet.org>
*
* Heavily modified by Manuel Novoa III Mar 12, 2001
@@ -15,7 +15,7 @@
* that either displays or sets the characteristics of
* one or more of the system's networking interfaces.
*
* Version: $Id: interface.c,v 1.20 2003/08/29 11:34:08 bug1 Exp $
* Version: $Id: interface.c,v 1.21 2004/03/15 08:28:42 andersen Exp $
*
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* and others. Copyright 1993 MicroWalt Corporation
@@ -31,17 +31,17 @@
*
* {1.34} - 19980630 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - gettext instead of catgets for i18n
* 10/1998 - Andi Kleen. Use interface list primitives.
* 20001008 - Bernd Eckenfels, Patch from RH for setting mtu
* 10/1998 - Andi Kleen. Use interface list primitives.
* 20001008 - Bernd Eckenfels, Patch from RH for setting mtu
* (default AF was wrong)
*/
/* #define KEEP_UNUSED */
/*
*
/*
*
* Protocol Families.
*
*
*/
#define HAVE_AFINET 1
#undef HAVE_AFIPX
@@ -51,10 +51,10 @@
#undef HAVE_AFECONET
#undef HAVE_AFASH
/*
*
/*
*
* Device Hardware types.
*
*
*/
#define HAVE_HWETHER 1
#define HAVE_HWPPP 1
@@ -1822,7 +1822,7 @@ static void ife_print(struct interface *ptr)
hw = get_hwntype(-1);
printf(_("%-9.9s Link encap:%s "), ptr->name, _(hw->title));
/* For some hardware types (eg Ash, ATM) we don't print the
/* For some hardware types (eg Ash, ATM) we don't print the
hardware address if it's null. */
if (hw->print != NULL && (!(hw_null_address(hw, ptr->hwaddr) &&
hw->suppress_null_addr)))
@@ -2011,7 +2011,7 @@ static void ife_print(struct interface *ptr)
printf(" ");
if (ptr->map.irq)
printf(_("Interrupt:%d "), ptr->map.irq);
if (ptr->map.base_addr >= 0x100) /* Only print devices using it for
if (ptr->map.base_addr >= 0x100) /* Only print devices using it for
I/O maps */
printf(_("Base address:0x%lx "),
(unsigned long) ptr->map.base_addr);

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* 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.
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* some system calls possibly missing from libc
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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
@@ -23,8 +23,8 @@
#include "libbb.h"
/* Busybox mount uses either /proc/mounts or /etc/mtab to
* get the list of currently mounted filesystems */
/* Busybox mount uses either /proc/mounts or /etc/mtab to
* get the list of currently mounted filesystems */
#if defined CONFIG_FEATURE_MTAB_SUPPORT
const char bb_path_mtab_file[] = CONFIG_FEATURE_MTAB_FILENAME;
#else

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -31,7 +31,7 @@
extern int bb_parse_mode(const char *s, mode_t *current_mode)
{
static const mode_t who_mask[] = {
static const mode_t who_mask[] = {
S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO, /* a */
S_ISUID | S_IRWXU, /* u */
S_ISGID | S_IRWXG, /* g */

View File

@@ -34,7 +34,7 @@ unsigned long bb_xparse_number(const char *numstr,
unsigned long int r;
char *e;
int old_errno;
/* Since this is a lib function, we're not allowed to reset errno to 0.
* Doing so could break an app that is deferring checking of errno.
* So, save the old value so that we can restore it if successful. */

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -46,7 +46,7 @@
#include <stdarg.h>
#include "libbb.h"
#if defined(__UCLIBC__)
#if defined(__UCLIBC__)
# if defined(__FLAG_ERROR)
/* Using my newer stdio implementation. Unlocked macros are:

View File

@@ -19,7 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*
*/
#include <stdio.h>
@@ -37,7 +37,7 @@ char bb_process_escape_sequence(const char **ptr)
unsigned int num_digits;
unsigned int r;
unsigned int n;
n = 0;
q = *ptr;

View File

@@ -2,7 +2,7 @@
/*
* Utility routine.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) many different people.
* Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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
@@ -30,12 +30,12 @@
/*
* Walk down all the directories under the specified
* Walk down all the directories under the specified
* location, and do something (something specified
* by the fileAction and dirAction function pointers).
*
* Unfortunately, while nftw(3) could replace this and reduce
* code size a bit, nftw() wasn't supported before GNU libc 2.1,
* Unfortunately, while nftw(3) could replace this and reduce
* code size a bit, nftw() wasn't supported before GNU libc 2.1,
* and so isn't sufficiently portable to take over since glibc2.1
* is so stinking huge.
*/

View File

@@ -111,7 +111,7 @@ extern int run_parts(char **args, const unsigned char test_mode, char **env)
exitstatus = 1;
}
}
}
}
else if (!S_ISDIR(st.st_mode)) {
bb_error_msg("component %s is not an executable plain file", filename);
exitstatus = 1;
@@ -121,6 +121,6 @@ extern int run_parts(char **args, const unsigned char test_mode, char **env)
free(filename);
}
free(namelist);
return(exitstatus);
}

View File

@@ -54,20 +54,20 @@ void run_shell ( const char *shell, int loginshell, const char *command, const c
const char **args;
int argno = 1;
int additional_args_cnt = 0;
for ( args = additional_args; args && *args; args++ )
additional_args_cnt++;
args = (const char **) xmalloc (sizeof (char *) * ( 4 + additional_args_cnt ));
args [0] = bb_get_last_path_component ( bb_xstrdup ( shell ));
if ( loginshell ) {
char *args0;
bb_xasprintf ( &args0, "-%s", args [0] );
args [0] = args0;
}
if ( command ) {
args [argno++] = "-c";
args [argno++] = command;

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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
@@ -24,11 +24,11 @@
/* Like strncpy but make sure the resulting string is always 0 terminated. */
/* Like strncpy but make sure the resulting string is always 0 terminated. */
extern char * safe_strncpy(char *dst, const char *src, size_t size)
{
{
dst[size-1] = '\0';
return strncpy(dst, src, size-1);
return strncpy(dst, src, size-1);
}

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -52,13 +52,13 @@ void setup_environment ( const char *shell, int loginshell, int changeenv, const
{
if ( loginshell ) {
const char *term;
/* Change the current working directory to be the home directory
* of the user. It is a fatal error for this process to be unable
* to change to that directory. There is no "default" home
* directory.
* Some systems default to HOME=/
*/
*/
if ( chdir ( pw-> pw_dir )) {
if ( chdir ( "/" )) {
syslog ( LOG_WARNING, "unable to cd to %s' for user %s'\n", pw-> pw_dir, pw-> pw_name );

View File

@@ -2,7 +2,7 @@
/*
* some system calls possibly missing from libc
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) many different people.
* Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) many different people.
* Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -40,9 +40,9 @@ void vfork_daemon_rexec(int nochdir, int noclose,
int fd;
char **vfork_args;
int a = 0;
setsid();
if (!nochdir)
chdir("/");
@@ -73,6 +73,6 @@ void vfork_daemon_rexec(int nochdir, int noclose,
bb_perror_msg_and_die("vfork");
default: /* parent */
exit(0);
}
}
}
#endif /* uClinux */

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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

View File

@@ -64,7 +64,7 @@ int xconnect(struct sockaddr_in *s_addr)
int s = socket(AF_INET, SOCK_STREAM, 0);
if (connect(s, (struct sockaddr_in *)s_addr, sizeof(struct sockaddr_in)) < 0)
{
bb_perror_msg_and_die("Unable to connect to remote host (%s)",
bb_perror_msg_and_die("Unable to connect to remote host (%s)",
inet_ntoa(s_addr->sin_addr));
}
return s;

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2004 by Erik Andersen <andersen@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
@@ -85,7 +85,7 @@ extern char * bb_xstrndup (const char *s, int n) {
bb_error_msg_and_die("bb_xstrndup bug");
t = xmalloc(++n);
return safe_strncpy(t,s,n);
}
#endif
@@ -104,7 +104,7 @@ FILE *bb_xfopen(const char *path, const char *mode)
extern int bb_xopen(const char *pathname, int flags)
{
int ret;
ret = open(pathname, flags, 0777);
if (ret == -1) {
bb_perror_msg_and_die("%s", pathname);
@@ -146,10 +146,10 @@ extern void bb_xread_all(int fd, void *buf, size_t count)
extern unsigned char bb_xread_char(int fd)
{
char tmp;
bb_xread_all(fd, &tmp, 1);
return(tmp);
return(tmp);
}
#endif

View File

@@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* Copyright (C) 2003 Erik Andersen <andersen@codepoet.org>
* Copyright (C) 2003-2004 Erik Andersen <andersen@codepoet.org>
*/

View File

@@ -29,7 +29,7 @@
#include "libbb.h"
#ifdef L_xgetularg_bnd_sfx
extern
extern
unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base,
unsigned long lower,
unsigned long upper,
@@ -61,7 +61,7 @@ unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base,
bb_show_usage();
}
errno = old_errno; /* Ok. So restore errno. */
/* Do optional suffix parsing. Allow 'empty' suffix tables.
* Note that we also all nul suffixes with associated multipliers,
* to allow for scaling of the arg by some default multiplier. */
@@ -78,7 +78,7 @@ unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base,
}
++suffixes;
}
}
}
/* Finally, check for illegal trailing chars and range limits. */
/* Note: although we allow leading space (via stroul), trailing space
@@ -92,7 +92,7 @@ unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base,
#endif
#ifdef L_xgetlarg_bnd_sfx
extern
extern
long bb_xgetlarg_bnd_sfx(const char *arg, int base,
long lower,
long upper,
@@ -124,7 +124,7 @@ long bb_xgetlarg_bnd_sfx(const char *arg, int base,
#endif
#ifdef L_getlarg10_sfx
extern
extern
long bb_xgetlarg10_sfx(const char *arg, const struct suffix_mult *suffixes)
{
return bb_xgetlarg_bnd_sfx(arg, 10, LONG_MIN, LONG_MAX, suffixes);
@@ -132,7 +132,7 @@ long bb_xgetlarg10_sfx(const char *arg, const struct suffix_mult *suffixes)
#endif
#ifdef L_xgetularg_bnd
extern
extern
unsigned long bb_xgetularg_bnd(const char *arg, int base,
unsigned long lower,
unsigned long upper)
@@ -142,7 +142,7 @@ unsigned long bb_xgetularg_bnd(const char *arg, int base,
#endif
#ifdef L_xgetularg10_bnd
extern
extern
unsigned long bb_xgetularg10_bnd(const char *arg,
unsigned long lower,
unsigned long upper)
@@ -152,7 +152,7 @@ unsigned long bb_xgetularg10_bnd(const char *arg,
#endif
#ifdef L_xgetularg10
extern
extern
unsigned long bb_xgetularg10(const char *arg)
{
return bb_xgetularg10_bnd(arg, 0, ULONG_MAX);

View File

@@ -14,10 +14,10 @@
#include "libbb.h"
extern char *xreadlink(const char *path)
{
{
static const int GROWBY = 80; /* how large we will grow strings by */
char *buf = NULL;
char *buf = NULL;
int bufsize = 0, readsize = 0;
do {
@@ -27,10 +27,10 @@ extern char *xreadlink(const char *path)
bb_perror_msg("%s", path);
return NULL;
}
}
}
while (bufsize < readsize + 1);
buf[readsize] = '\0';
return buf;
}
}

View File

@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) many different people.
* Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify