summaryrefslogtreecommitdiffhomepage
path: root/libbb
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-07-22 08:56:55 +0000
committerEric Andersen <andersen@codepoet.org>2003-07-22 08:56:55 +0000
commit85e5e72bc1acd9d58c11bde6e14c8270cd9f169f (patch)
tree9971c6951256dd0bba5ff2a7db08ed6f65ef218d /libbb
parent0a14c9f924eaf6a64e78959a190d187d646b3c0c (diff)
Remove remaining libc5 support code
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Makefile.in4
-rw-r--r--libbb/dirname.c69
-rw-r--r--libbb/interface.c7
-rw-r--r--libbb/libc5.c184
-rw-r--r--libbb/module_syscalls.c10
-rw-r--r--libbb/syscalls.c10
6 files changed, 10 insertions, 274 deletions
diff --git a/libbb/Makefile.in b/libbb/Makefile.in
index cde3fb2fa..c4886e3ff 100644
--- a/libbb/Makefile.in
+++ b/libbb/Makefile.in
@@ -27,12 +27,12 @@ LIBBB_SRC:= \
arith.c bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \
compare_string_array.c concat_path_file.c copy_file.c \
copyfd.c correct_password.c create_icmp_socket.c \
- create_icmp6_socket.c device_open.c dirname.c dump.c error_msg.c \
+ create_icmp6_socket.c device_open.c dump.c error_msg.c \
error_msg_and_die.c find_mount_point.c find_pid_by_name.c \
find_root_device.c fgets_str.c full_read.c full_write.c get_console.c \
get_last_path_component.c get_line_from_file.c herror_msg.c \
herror_msg_and_die.c human_readable.c inet_common.c inode_hash.c \
- interface.c isdirectory.c kernel_version.c last_char_is.c libc5.c \
+ interface.c isdirectory.c kernel_version.c last_char_is.c \
llist_add_to.c login.c loop.c make_directory.c mode_string.c \
module_syscalls.c mtab.c mtab_file.c my_getgrgid.c my_getgrnam.c \
my_getpwnam.c my_getpwnamegid.c my_getpwuid.c obscure.c parse_mode.c \
diff --git a/libbb/dirname.c b/libbb/dirname.c
deleted file mode 100644
index 81298730b..000000000
--- a/libbb/dirname.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * dirname implementation for busybox (for libc's missing one)
- *
- * 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
- *
- */
-
-/* Note: The previous busybox implementation did not handle NULL path
- * and also moved a pointer before path, which is not portable in C.
- * So I replaced it with my uClibc version.
- */
-
-#include <string.h>
-#include "libbb.h"
-
-#if __GNU_LIBRARY__ < 5
-
-extern
-char *dirname(char *path)
-{
- static const char null_or_empty_or_noslash[] = ".";
- register char *s;
- register char *last;
- char *first;
-
- last = s = path;
-
- if (s != NULL) {
-
- LOOP:
- while (*s && (*s != '/')) ++s;
- first = s;
- while (*s == '/') ++s;
- if (*s) {
- last = first;
- goto LOOP;
- }
-
- if (last == path) {
- if (*last != '/') {
- goto DOT;
- }
- if ((*++last == '/') && (last[1] == 0)) {
- ++last;
- }
- }
- *last = 0;
- return path;
- }
- DOT:
- return (char *) null_or_empty_or_noslash;
-}
-
-#endif
diff --git a/libbb/interface.c b/libbb/interface.c
index fb3a42a0c..46c3ba96c 100644
--- a/libbb/interface.c
+++ b/libbb/interface.c
@@ -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.16 2003/07/14 21:20:55 andersen Exp $
+ * Version: $Id: interface.c,v 1.17 2003/07/22 08:56:46 andersen Exp $
*
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* and others. Copyright 1993 MicroWalt Corporation
@@ -76,6 +76,7 @@
#include <fcntl.h>
#include <ctype.h>
#include <sys/ioctl.h>
+#include <sys/types.h>
#include <net/if.h>
#include <net/if_arp.h>
#include "libbb.h"
@@ -88,10 +89,6 @@
static int procnetdev_vsn = 1;
-/* Ugh. But libc5 doesn't provide POSIX types. */
-#include <asm/types.h>
-
-
#ifdef HAVE_HWSLIP
#include <net/if_slip.h>
#endif
diff --git a/libbb/libc5.c b/libbb/libc5.c
deleted file mode 100644
index ac7919626..000000000
--- a/libbb/libc5.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* vi: set sw=4 ts=4: */
-
-
-#include <features.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <paths.h>
-#include <unistd.h>
-
-
-#if ! defined __dietlibc__ && __GNU_LIBRARY__ < 5
-
-/*
- * Some systems already have updwtmp(). Some don't... This is
- * the updwtmp() implementation from uClibc, Copyright 2002 by
- * Erik Andersen <andersen@codepoet.org>
- */
-extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
-{
- int fd;
-
- fd = open(wtmp_file, O_APPEND | O_WRONLY, 0);
- if (fd >= 0) {
- if (lockf(fd, F_LOCK, 0)==0) {
- write(fd, (const char *) lutmp, sizeof(struct utmp));
- lockf(fd, F_ULOCK, 0);
- close(fd);
- }
- }
-}
-
-/* Copyright (C) 1991 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-/*
- * Modified by Manuel Novoa III Mar 1, 2001
- *
- * Converted original strtok.c code of strtok to __strtok_r.
- * Cleaned up logic and reduced code size.
- */
-
-
-char *strtok_r(char *s, const char *delim, char **save_ptr)
-{
- char *token;
-
- token = 0; /* Initialize to no token. */
-
- if (s == 0) { /* If not first time called... */
- s = *save_ptr; /* restart from where we left off. */
- }
-
- if (s != 0) { /* If not finished... */
- *save_ptr = 0;
-
- s += strspn(s, delim); /* Skip past any leading delimiters. */
- if (*s != '\0') { /* We have a token. */
- token = s;
- *save_ptr = strpbrk(token, delim); /* Find token's end. */
- if (*save_ptr != 0) {
- /* Terminate the token and make SAVE_PTR point past it. */
- *(*save_ptr)++ = '\0';
- }
- }
- }
-
- return token;
-}
-
-/* Basically getdelim() with the delimiter hard wired to '\n' */
-ssize_t getline(char **linebuf, size_t *n, FILE *file)
-{
- return (getdelim (linebuf, n, '\n', file));
-}
-
-
-/*
- * daemon implementation for uClibc
- *
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
- *
- * The uClibc Library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * The GNU C Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with the GNU C Library; see the file COPYING.LIB. 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.
- */
-
-int daemon( int nochdir, int noclose )
-{
- int fd;
-
- switch (fork()) {
- case -1:
- return(-1);
- case 0:
- break;
- default:
- _exit(0);
- }
-
- if (setsid() == -1)
- return(-1);
-
- if (!nochdir)
- chdir("/");
-
- if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
- dup2(fd, STDIN_FILENO);
- dup2(fd, STDOUT_FILENO);
- dup2(fd, STDERR_FILENO);
- if (fd > 2)
- close(fd);
- }
- return(0);
-}
-
-
-/*-
- * Copyright (c) 1990, 1993
- * 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. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
- * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
- *
- * 4. 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.
- */
-
-
-#endif
-
diff --git a/libbb/module_syscalls.c b/libbb/module_syscalls.c
index 6b6ebed06..cb9258af2 100644
--- a/libbb/module_syscalls.c
+++ b/libbb/module_syscalls.c
@@ -27,15 +27,11 @@
_syscall* defined. */
#define __LIBRARY__
#include <sys/syscall.h>
-#if __GNU_LIBRARY__ < 5
-/* This is needed for libc5 */
-#include <asm/unistd.h>
-#endif
#include "libbb.h"
-#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
-/* These syscalls are not included as part of libc5 */
+/* These syscalls are not included in very old glibc versions */
+#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
int delete_module(const char *name)
{
return(syscall(__NR_delete_module, name));
@@ -79,7 +75,7 @@ unsigned long create_module(const char *name, size_t size)
return ret;
}
-#endif /* __GNU_LIBRARY__ < 5 */
+#endif
/* END CODE */
diff --git a/libbb/syscalls.c b/libbb/syscalls.c
index ee58d3674..8ceb35695 100644
--- a/libbb/syscalls.c
+++ b/libbb/syscalls.c
@@ -27,10 +27,6 @@
_syscall* defined. */
#define __LIBRARY__
#include <sys/syscall.h>
-#if __GNU_LIBRARY__ < 5
-/* This is needed for libc5 */
-#include <asm/unistd.h>
-#endif
#include "libbb.h"
int sysfs( int option, unsigned int fs_index, char * buf)
@@ -59,9 +55,9 @@ int pivot_root(const char * new_root,const char * put_old)
-#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
+/* These syscalls are not included in ancient glibc versions */
+#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
-/* These syscalls are not included as part of libc5 */
int bdflush(int func, int data)
{
return(syscall(__NR_bdflush, func, data));
@@ -96,7 +92,7 @@ int umount2(const char * special_file, int flags)
}
-#endif /* __GNU_LIBRARY__ < 5 */
+#endif
/* END CODE */