Imported from ../bash-2.03.tar.gz.

This commit is contained in:
Jari Aalto 1999-02-19 17:11:39 +00:00
commit b72432fdcc
191 changed files with 10113 additions and 3553 deletions

View file

@ -16,10 +16,13 @@ INSTALL_DATA = @INSTALL_DATA@
CC = @CC@
RANLIB = @RANLIB@
AR = @AR@
ARFLAGS = @ARFLAGS@
RM = rm -f
CP = cp
MV = mv
SHELL = @MAKE_SHELL@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
CPPFLAGS = @CPPFLAGS@
@ -44,7 +47,7 @@ LIBRARY_NAME = libsh.a
# The C code source files for this library.
CSOURCES = clktck.c getcwd.c getenv.c oslib.c setlinebuf.c \
strcasecmp.c strerror.c strtod.c strtol.c strtoul.c \
vprint.c itos.c
vprint.c itos.c rename.c
# The header files for this library.
HSOURCES =
@ -52,7 +55,7 @@ HSOURCES =
# The object files contained in $(LIBRARY_NAME)
OBJECTS = clktck.o getcwd.o getenv.o oslib.o setlinebuf.o \
strcasecmp.o strerror.o strtod.o strtol.o strtoul.o \
vprint.o itos.o
vprint.o itos.o rename.o
SUPPORT = Makefile
@ -60,7 +63,7 @@ all: $(LIBRARY_NAME)
$(LIBRARY_NAME): $(OBJECTS)
$(RM) $@
$(AR) cr $@ $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
-test -n "$(RANLIB)" && $(RANLIB) $@
force:
@ -86,6 +89,7 @@ getcwd.o: getcwd.c
getenv.o: getenv.c
itos.o: itos.c
oslib.o: oslib.c
rename.o: rename.c
setlinebuf.o: setlinebuf.c
strcasecmp.o: strcasecmp.c
strerror.o: strerror.c
@ -100,6 +104,7 @@ getcwd.o: ${BUILD_DIR}/config.h
getenv.o: ${BUILD_DIR}/config.h
itos.o: ${BUILD_DIR}/config.h
oslib.o: ${BUILD_DIR}/config.h
rename.o: ${BUILD_DIR}/config.h
setlinebuf.o: ${BUILD_DIR}/config.h
strcasecmp.o: ${BUILD_DIR}/config.h
strerror.o: ${BUILD_DIR}/config.h
@ -143,6 +148,8 @@ oslib.o: ${topdir}/pathnames.h ${topdir}/externs.h
oslib.o: ${POSIX_INC}/posixstat.h ${POSIX_INC}/filecntl.h
oslib.o: ${POSIX_INC}/ansi_stdlib.h
rename.o: ${topdir}/bashtypes.h ${topdir}/stdc.h
strcasecmp.o: ${topdir}/stdc.h ${topdir}/bashansi.h ${topdir}/ansi_stdlib.h
strerror.o: ${topdir}/bashtypes.h

View file

@ -31,13 +31,16 @@
of an integer. 32 is larger than the string rep of 2^^31 - 1. */
#define MAX_INT_LEN 32
/* Integer to string conversion. This conses the string; the
caller should free it. */
/* Integer to string conversion. The caller passes the buffer and
the size. This should check for buffer underflow, but currently
does not. */
char *
itos (i)
inttostr (i, buf, len)
int i;
char *buf;
int len;
{
char buf[MAX_INT_LEN], *p, *ret;
char *p;
int negative = 0;
unsigned int ui;
@ -49,7 +52,7 @@ itos (i)
ui = (unsigned int) i;
p = buf + MAX_INT_LEN - 2;
p = buf + len - 2;
p[1] = '\0';
do
@ -59,6 +62,17 @@ itos (i)
if (negative)
*p-- = '-';
ret = savestring (p + 1);
return (ret);
return (p + 1);
}
/* Integer to string conversion. This conses the string; the
caller should free it. */
char *
itos (i)
int i;
{
char *p, lbuf[MAX_INT_LEN];
p = inttostr (i, lbuf, sizeof(lbuf));
return (savestring (p));
}

View file

@ -154,6 +154,9 @@ getdtablesize ()
#endif /* !HAVE_GETDTABLESIZE */
#if !defined (HAVE_BCOPY)
# if defined (bcopy)
# undef bcopy
# endif
void
bcopy (s,d,n)
char *d, *s;
@ -164,6 +167,9 @@ bcopy (s,d,n)
#endif /* !HAVE_BCOPY */
#if !defined (HAVE_BZERO)
# if defined (bzero)
# undef bzero
# endif
void
bzero (s, n)
char *s;

27
lib/sh/rename.c Normal file
View file

@ -0,0 +1,27 @@
/*
* rename - rename a file
*/
#include <config.h>
#if !defined (HAVE_RENAME)
#include <bashtypes.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include <stdc.h>
int
rename (from, to)
const char *from, *to;
{
unlink (to);
if (link (from, to) < 0)
return (-1);
unlink (from);
return (0);
}
#endif /* !HAVE_RENAME */

View file

@ -34,6 +34,7 @@ extern int errno;
# include <limits.h>
#endif
#include <stdc.h>
#include <bashansi.h>
#ifndef NULL