aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-22 08:56:55 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-22 08:56:55 +0000
commitfa8cf20631cf02ae3e6b0db95a494261df1aee27 (patch)
tree9971c6951256dd0bba5ff2a7db08ed6f65ef218d /libbb
parent5658fe5f7869ce987e25dfb6554db5e062045319 (diff)
downloadbusybox-w32-fa8cf20631cf02ae3e6b0db95a494261df1aee27.tar.gz
busybox-w32-fa8cf20631cf02ae3e6b0db95a494261df1aee27.tar.bz2
busybox-w32-fa8cf20631cf02ae3e6b0db95a494261df1aee27.zip
Remove remaining libc5 support code
git-svn-id: svn://busybox.net/trunk/busybox@7090 69ca8d6d-28ef-0310-b511-8ec308f3f277
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:= \
27 arith.c bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \ 27 arith.c bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \
28 compare_string_array.c concat_path_file.c copy_file.c \ 28 compare_string_array.c concat_path_file.c copy_file.c \
29 copyfd.c correct_password.c create_icmp_socket.c \ 29 copyfd.c correct_password.c create_icmp_socket.c \
30 create_icmp6_socket.c device_open.c dirname.c dump.c error_msg.c \ 30 create_icmp6_socket.c device_open.c dump.c error_msg.c \
31 error_msg_and_die.c find_mount_point.c find_pid_by_name.c \ 31 error_msg_and_die.c find_mount_point.c find_pid_by_name.c \
32 find_root_device.c fgets_str.c full_read.c full_write.c get_console.c \ 32 find_root_device.c fgets_str.c full_read.c full_write.c get_console.c \
33 get_last_path_component.c get_line_from_file.c herror_msg.c \ 33 get_last_path_component.c get_line_from_file.c herror_msg.c \
34 herror_msg_and_die.c human_readable.c inet_common.c inode_hash.c \ 34 herror_msg_and_die.c human_readable.c inet_common.c inode_hash.c \
35 interface.c isdirectory.c kernel_version.c last_char_is.c libc5.c \ 35 interface.c isdirectory.c kernel_version.c last_char_is.c \
36 llist_add_to.c login.c loop.c make_directory.c mode_string.c \ 36 llist_add_to.c login.c loop.c make_directory.c mode_string.c \
37 module_syscalls.c mtab.c mtab_file.c my_getgrgid.c my_getgrnam.c \ 37 module_syscalls.c mtab.c mtab_file.c my_getgrgid.c my_getgrnam.c \
38 my_getpwnam.c my_getpwnamegid.c my_getpwuid.c obscure.c parse_mode.c \ 38 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 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * dirname implementation for busybox (for libc's missing one)
4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23/* Note: The previous busybox implementation did not handle NULL path
24 * and also moved a pointer before path, which is not portable in C.
25 * So I replaced it with my uClibc version.
26 */
27
28#include <string.h>
29#include "libbb.h"
30
31#if __GNU_LIBRARY__ < 5
32
33extern
34char *dirname(char *path)
35{
36 static const char null_or_empty_or_noslash[] = ".";
37 register char *s;
38 register char *last;
39 char *first;
40
41 last = s = path;
42
43 if (s != NULL) {
44
45 LOOP:
46 while (*s && (*s != '/')) ++s;
47 first = s;
48 while (*s == '/') ++s;
49 if (*s) {
50 last = first;
51 goto LOOP;
52 }
53
54 if (last == path) {
55 if (*last != '/') {
56 goto DOT;
57 }
58 if ((*++last == '/') && (last[1] == 0)) {
59 ++last;
60 }
61 }
62 *last = 0;
63 return path;
64 }
65 DOT:
66 return (char *) null_or_empty_or_noslash;
67}
68
69#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 @@
15 * that either displays or sets the characteristics of 15 * that either displays or sets the characteristics of
16 * one or more of the system's networking interfaces. 16 * one or more of the system's networking interfaces.
17 * 17 *
18 * Version: $Id: interface.c,v 1.16 2003/07/14 21:20:55 andersen Exp $ 18 * Version: $Id: interface.c,v 1.17 2003/07/22 08:56:46 andersen Exp $
19 * 19 *
20 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 20 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
21 * and others. Copyright 1993 MicroWalt Corporation 21 * and others. Copyright 1993 MicroWalt Corporation
@@ -76,6 +76,7 @@
76#include <fcntl.h> 76#include <fcntl.h>
77#include <ctype.h> 77#include <ctype.h>
78#include <sys/ioctl.h> 78#include <sys/ioctl.h>
79#include <sys/types.h>
79#include <net/if.h> 80#include <net/if.h>
80#include <net/if_arp.h> 81#include <net/if_arp.h>
81#include "libbb.h" 82#include "libbb.h"
@@ -88,10 +89,6 @@
88 89
89static int procnetdev_vsn = 1; 90static int procnetdev_vsn = 1;
90 91
91/* Ugh. But libc5 doesn't provide POSIX types. */
92#include <asm/types.h>
93
94
95#ifdef HAVE_HWSLIP 92#ifdef HAVE_HWSLIP
96#include <net/if_slip.h> 93#include <net/if_slip.h>
97#endif 94#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 @@
1/* vi: set sw=4 ts=4: */
2
3
4#include <features.h>
5#include <string.h>
6#include <stdio.h>
7#include <fcntl.h>
8#include <paths.h>
9#include <unistd.h>
10
11
12#if ! defined __dietlibc__ && __GNU_LIBRARY__ < 5
13
14/*
15 * Some systems already have updwtmp(). Some don't... This is
16 * the updwtmp() implementation from uClibc, Copyright 2002 by
17 * Erik Andersen <andersen@codepoet.org>
18 */
19extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
20{
21 int fd;
22
23 fd = open(wtmp_file, O_APPEND | O_WRONLY, 0);
24 if (fd >= 0) {
25 if (lockf(fd, F_LOCK, 0)==0) {
26 write(fd, (const char *) lutmp, sizeof(struct utmp));
27 lockf(fd, F_ULOCK, 0);
28 close(fd);
29 }
30 }
31}
32
33/* Copyright (C) 1991 Free Software Foundation, Inc.
34This file is part of the GNU C Library.
35
36The GNU C Library is free software; you can redistribute it and/or
37modify it under the terms of the GNU Library General Public License as
38published by the Free Software Foundation; either version 2 of the
39License, or (at your option) any later version.
40
41The GNU C Library is distributed in the hope that it will be useful,
42but WITHOUT ANY WARRANTY; without even the implied warranty of
43MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44Library General Public License for more details.
45
46You should have received a copy of the GNU Library General Public
47License along with the GNU C Library; see the file COPYING.LIB. If
48not, write to the Free Software Foundation, Inc., 675 Mass Ave,
49Cambridge, MA 02139, USA. */
50
51/*
52 * Modified by Manuel Novoa III Mar 1, 2001
53 *
54 * Converted original strtok.c code of strtok to __strtok_r.
55 * Cleaned up logic and reduced code size.
56 */
57
58
59char *strtok_r(char *s, const char *delim, char **save_ptr)
60{
61 char *token;
62
63 token = 0; /* Initialize to no token. */
64
65 if (s == 0) { /* If not first time called... */
66 s = *save_ptr; /* restart from where we left off. */
67 }
68
69 if (s != 0) { /* If not finished... */
70 *save_ptr = 0;
71
72 s += strspn(s, delim); /* Skip past any leading delimiters. */
73 if (*s != '\0') { /* We have a token. */
74 token = s;
75 *save_ptr = strpbrk(token, delim); /* Find token's end. */
76 if (*save_ptr != 0) {
77 /* Terminate the token and make SAVE_PTR point past it. */
78 *(*save_ptr)++ = '\0';
79 }
80 }
81 }
82
83 return token;
84}
85
86/* Basically getdelim() with the delimiter hard wired to '\n' */
87ssize_t getline(char **linebuf, size_t *n, FILE *file)
88{
89 return (getdelim (linebuf, n, '\n', file));
90}
91
92
93/*
94 * daemon implementation for uClibc
95 *
96 * Copyright (c) 1991, 1993
97 * The Regents of the University of California. All rights reserved.
98 *
99 * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
100 *
101 * The uClibc Library is free software; you can redistribute it and/or
102 * modify it under the terms of the GNU Library General Public License as
103 * published by the Free Software Foundation; either version 2 of the
104 * License, or (at your option) any later version.
105 *
106 * The GNU C Library is distributed in the hope that it will be useful,
107 * but WITHOUT ANY WARRANTY; without even the implied warranty of
108 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
109 * Library General Public License for more details.
110 *
111 * You should have received a copy of the GNU Library General Public
112 * License along with the GNU C Library; see the file COPYING.LIB. If not,
113 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
114 * Boston, MA 02111-1307, USA.
115 *
116 * Original copyright notice is retained at the end of this file.
117 */
118
119int daemon( int nochdir, int noclose )
120{
121 int fd;
122
123 switch (fork()) {
124 case -1:
125 return(-1);
126 case 0:
127 break;
128 default:
129 _exit(0);
130 }
131
132 if (setsid() == -1)
133 return(-1);
134
135 if (!nochdir)
136 chdir("/");
137
138 if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
139 dup2(fd, STDIN_FILENO);
140 dup2(fd, STDOUT_FILENO);
141 dup2(fd, STDERR_FILENO);
142 if (fd > 2)
143 close(fd);
144 }
145 return(0);
146}
147
148
149/*-
150 * Copyright (c) 1990, 1993
151 * The Regents of the University of California. All rights reserved.
152 *
153 * Redistribution and use in source and binary forms, with or without
154 * modification, are permitted provided that the following conditions
155 * are met:
156 * 1. Redistributions of source code must retain the above copyright
157 * notice, this list of conditions and the following disclaimer.
158 * 2. Redistributions in binary form must reproduce the above copyright
159 * notice, this list of conditions and the following disclaimer in the
160 * documentation and/or other materials provided with the distribution.
161 *
162 * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
163 * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
164 *
165 * 4. Neither the name of the University nor the names of its contributors
166 * may be used to endorse or promote products derived from this software
167 * without specific prior written permission.
168 *
169 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
170 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
171 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
172 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
173 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
174 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
175 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
176 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
177 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
178 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
179 * SUCH DAMAGE.
180 */
181
182
183#endif
184
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 @@
27 _syscall* defined. */ 27 _syscall* defined. */
28#define __LIBRARY__ 28#define __LIBRARY__
29#include <sys/syscall.h> 29#include <sys/syscall.h>
30#if __GNU_LIBRARY__ < 5
31/* This is needed for libc5 */
32#include <asm/unistd.h>
33#endif
34#include "libbb.h" 30#include "libbb.h"
35 31
36 32
37#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)) 33/* These syscalls are not included in very old glibc versions */
38/* These syscalls are not included as part of libc5 */ 34#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
39int delete_module(const char *name) 35int delete_module(const char *name)
40{ 36{
41 return(syscall(__NR_delete_module, name)); 37 return(syscall(__NR_delete_module, name));
@@ -79,7 +75,7 @@ unsigned long create_module(const char *name, size_t size)
79 return ret; 75 return ret;
80} 76}
81 77
82#endif /* __GNU_LIBRARY__ < 5 */ 78#endif
83 79
84 80
85/* END CODE */ 81/* 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 @@
27 _syscall* defined. */ 27 _syscall* defined. */
28#define __LIBRARY__ 28#define __LIBRARY__
29#include <sys/syscall.h> 29#include <sys/syscall.h>
30#if __GNU_LIBRARY__ < 5
31/* This is needed for libc5 */
32#include <asm/unistd.h>
33#endif
34#include "libbb.h" 30#include "libbb.h"
35 31
36int sysfs( int option, unsigned int fs_index, char * buf) 32int sysfs( int option, unsigned int fs_index, char * buf)
@@ -59,9 +55,9 @@ int pivot_root(const char * new_root,const char * put_old)
59 55
60 56
61 57
62#if __GNU_LIBRARY__ < 5 || ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)) 58/* These syscalls are not included in ancient glibc versions */
59#if ((__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1))
63 60
64/* These syscalls are not included as part of libc5 */
65int bdflush(int func, int data) 61int bdflush(int func, int data)
66{ 62{
67 return(syscall(__NR_bdflush, func, data)); 63 return(syscall(__NR_bdflush, func, data));
@@ -96,7 +92,7 @@ int umount2(const char * special_file, int flags)
96} 92}
97 93
98 94
99#endif /* __GNU_LIBRARY__ < 5 */ 95#endif
100 96
101 97
102/* END CODE */ 98/* END CODE */