* libc/argz: New directory.
* libc/argz/*: New files. * libc/argz/argz_add.c: New file. * libc/argz/argz_add_sep.c: New file. * libc/argz/argz_append.c: New file. * libc/argz/argz_count.c: New file. * libc/argz/argz_create.c: New file. * libc/argz/argz_create_sep.c: New file. * libc/argz/argz_delete.c: New file. * libc/argz/argz_extract.c: New file. * libc/argz/argz_insert.c: New file. * libc/argz/argz_next.c: New file. * libc/argz/argz_replace.c: New file. * libc/argz/argz_stringify.c: New file. * libc/argz/buf_findstr.c: New file. * libc/argz/envz_add.c: New file. * libc/argz/envz_entry.c: New file. * libc/argz/envz_get.c: New file. * libc/argz/envz_merge.c: New file. * libc/argz/envz_remove.c: New file. * libc/argz/envz_strip.c: New file. * libc/include/argz.h: New file. * libc/include/envz.h: New file. * Makefile.am (LIBC_OBJECTLISTS): Add libc/argz/objectlist.awk.in. * libc/Makefile.am (SUBDIRS): Add argz. (SUBLIBS): Add argz/libargz.la. * libc/configure.in (AC_OUTPUT): Add argz/Makefile. * libc/include/errno.h: Add error_t typedef.
This commit is contained in:
parent
a77d35f7d2
commit
b56d7e7937
|
@ -1,3 +1,35 @@
|
|||
2002-06-14 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||
|
||||
* libc/argz: New directory.
|
||||
* libc/argz/*: New files.
|
||||
* libc/argz/argz_add.c: New file.
|
||||
* libc/argz/argz_add_sep.c: New file.
|
||||
* libc/argz/argz_append.c: New file.
|
||||
* libc/argz/argz_count.c: New file.
|
||||
* libc/argz/argz_create.c: New file.
|
||||
* libc/argz/argz_create_sep.c: New file.
|
||||
* libc/argz/argz_delete.c: New file.
|
||||
* libc/argz/argz_extract.c: New file.
|
||||
* libc/argz/argz_insert.c: New file.
|
||||
* libc/argz/argz_next.c: New file.
|
||||
* libc/argz/argz_replace.c: New file.
|
||||
* libc/argz/argz_stringify.c: New file.
|
||||
* libc/argz/buf_findstr.c: New file.
|
||||
* libc/argz/envz_add.c: New file.
|
||||
* libc/argz/envz_entry.c: New file.
|
||||
* libc/argz/envz_get.c: New file.
|
||||
* libc/argz/envz_merge.c: New file.
|
||||
* libc/argz/envz_remove.c: New file.
|
||||
* libc/argz/envz_strip.c: New file.
|
||||
* libc/include/argz.h: New file.
|
||||
* libc/include/envz.h: New file.
|
||||
* Makefile.am (LIBC_OBJECTLISTS): Add
|
||||
libc/argz/objectlist.awk.in.
|
||||
* libc/Makefile.am (SUBDIRS): Add argz.
|
||||
(SUBLIBS): Add argz/libargz.la.
|
||||
* libc/configure.in (AC_OUTPUT): Add argz/Makefile.
|
||||
* libc/include/errno.h: Add error_t typedef.
|
||||
|
||||
2002-06-13 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* libc/include/stdlib.h: Add _Exit prototype.
|
||||
|
|
|
@ -103,6 +103,7 @@ LIBC_OBJECTLISTS = \
|
|||
$(SIGNAL_OBJECTLIST) \
|
||||
$(SYSCALL_OBJECTLIST) \
|
||||
$(UNIX_OBJECTLIST) \
|
||||
libc/argz/objectlist.awk.in \
|
||||
libc/stdlib/objectlist.awk.in \
|
||||
libc/time/objectlist.awk.in \
|
||||
libc/ctype/objectlist.awk.in \
|
||||
|
|
|
@ -201,6 +201,7 @@ LIBC_OBJECTLISTS = \
|
|||
$(SIGNAL_OBJECTLIST) \
|
||||
$(SYSCALL_OBJECTLIST) \
|
||||
$(UNIX_OBJECTLIST) \
|
||||
libc/argz/objectlist.awk.in \
|
||||
libc/stdlib/objectlist.awk.in \
|
||||
libc/time/objectlist.awk.in \
|
||||
libc/ctype/objectlist.awk.in \
|
||||
|
|
|
@ -20,7 +20,7 @@ endif
|
|||
|
||||
# The order of SUBDIRS is important for the integrated documentation.
|
||||
# Do not change the order without considering the doc impact.
|
||||
SUBDIRS = stdlib ctype stdio string $(SIGNAL_SUBDIR) time locale sys reent \
|
||||
SUBDIRS = argz stdlib ctype stdio string $(SIGNAL_SUBDIR) time locale sys reent \
|
||||
$(extra_dir) errno misc machine $(UNIX_SUBDIR) $(POSIX_SUBDIR) $(SYSCALLS_SUBDIR) .
|
||||
|
||||
noinst_DATA = $(CRT0)
|
||||
|
@ -28,6 +28,7 @@ noinst_DATA = $(CRT0)
|
|||
if USE_LIBTOOL
|
||||
noinst_LTLIBRARIES = libc.la
|
||||
SUBLIBS = \
|
||||
argz/libargz.$(aext) \
|
||||
stdlib/libstdlib.$(aext) \
|
||||
ctype/libctype.$(aext) \
|
||||
stdio/libstdio.$(aext) \
|
||||
|
@ -47,6 +48,7 @@ SUBLIBS = \
|
|||
else
|
||||
noinst_LIBRARIES = libc.a
|
||||
SUBLIBS = \
|
||||
argz/lib.$(aext) \
|
||||
stdlib/lib.$(aext) \
|
||||
ctype/lib.$(aext) \
|
||||
stdio/lib.$(aext) \
|
||||
|
|
|
@ -115,7 +115,7 @@ AUTOMAKE_OPTIONS = cygnus
|
|||
|
||||
# The order of SUBDIRS is important for the integrated documentation.
|
||||
# Do not change the order without considering the doc impact.
|
||||
SUBDIRS = stdlib ctype stdio string $(SIGNAL_SUBDIR) time locale sys reent \
|
||||
SUBDIRS = argz stdlib ctype stdio string $(SIGNAL_SUBDIR) time locale sys reent \
|
||||
$(extra_dir) errno misc machine $(UNIX_SUBDIR) $(POSIX_SUBDIR) $(SYSCALLS_SUBDIR) .
|
||||
|
||||
|
||||
|
@ -123,6 +123,7 @@ noinst_DATA = $(CRT0)
|
|||
|
||||
@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libc.la
|
||||
@USE_LIBTOOL_TRUE@SUBLIBS = @USE_LIBTOOL_TRUE@\
|
||||
@USE_LIBTOOL_TRUE@ argz/libargz.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@ stdlib/libstdlib.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@ ctype/libctype.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@ stdio/libstdio.$(aext) \
|
||||
|
@ -140,6 +141,7 @@ noinst_DATA = $(CRT0)
|
|||
@USE_LIBTOOL_TRUE@ $(LIBC_POSIX_LIB) \
|
||||
@USE_LIBTOOL_TRUE@ $(LIBC_SYSCALL_LIB)
|
||||
@USE_LIBTOOL_FALSE@SUBLIBS = @USE_LIBTOOL_FALSE@\
|
||||
@USE_LIBTOOL_FALSE@ argz/lib.$(aext) \
|
||||
@USE_LIBTOOL_FALSE@ stdlib/lib.$(aext) \
|
||||
@USE_LIBTOOL_FALSE@ ctype/lib.$(aext) \
|
||||
@USE_LIBTOOL_FALSE@ stdio/lib.$(aext) \
|
||||
|
@ -202,11 +204,12 @@ libc_a_SOURCES = libc.a.c
|
|||
libc_a_OBJECTS = libc.a.$(OBJEXT)
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
|
||||
@USE_LIBTOOL_TRUE@libc_la_DEPENDENCIES = stdlib/libstdlib.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@ctype/libctype.$(aext) stdio/libstdio.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@string/libstring.$(aext) time/libtime.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@locale/liblocale.$(aext) reent/libreent.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@errno/liberrno.$(aext) misc/libmisc.$(aext)
|
||||
@USE_LIBTOOL_TRUE@libc_la_DEPENDENCIES = argz/libargz.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@stdlib/libstdlib.$(aext) ctype/libctype.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@stdio/libstdio.$(aext) string/libstring.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@time/libtime.$(aext) locale/liblocale.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@reent/libreent.$(aext) errno/liberrno.$(aext) \
|
||||
@USE_LIBTOOL_TRUE@misc/libmisc.$(aext)
|
||||
@USE_LIBTOOL_TRUE@libc_la_OBJECTS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
|
@ -227,8 +230,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
|||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
DIST_SUBDIRS = stdlib ctype stdio string signal time locale sys reent \
|
||||
@extra_dir@ errno misc machine unix posix syscalls .
|
||||
DIST_SUBDIRS = argz stdlib ctype stdio string signal time locale sys \
|
||||
reent @extra_dir@ errno misc machine unix posix syscalls .
|
||||
SOURCES = libc.a.c $(libc_la_SOURCES)
|
||||
OBJECTS = libc.a.$(OBJEXT) $(libc_la_OBJECTS)
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
## Process this file with automake to generate Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
|
||||
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||
|
||||
LIB_SOURCES = \
|
||||
argz_add.c \
|
||||
argz_add_sep.c \
|
||||
argz_append.c \
|
||||
argz_count.c \
|
||||
argz_create.c \
|
||||
argz_create_sep.c \
|
||||
argz_delete.c \
|
||||
argz_extract.c \
|
||||
argz_insert.c \
|
||||
argz_next.c \
|
||||
argz_replace.c \
|
||||
argz_stringify.c \
|
||||
buf_findstr.c \
|
||||
envz_entry.c \
|
||||
envz_get.c \
|
||||
envz_add.c \
|
||||
envz_remove.c \
|
||||
envz_merge.c \
|
||||
envz_strip.c
|
||||
|
||||
libargz_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
|
||||
if USE_LIBTOOL
|
||||
noinst_LTLIBRARIES = libargz.la
|
||||
libargz_la_SOURCES = $(LIB_SOURCES)
|
||||
noinst_DATA = objectlist.awk.in
|
||||
else
|
||||
noinst_LIBRARIES = lib.a
|
||||
lib_a_SOURCES = $(LIB_SOURCES)
|
||||
noinst_DATA =
|
||||
endif # USE_LIBTOOL
|
||||
|
||||
include $(srcdir)/../../Makefile.shared
|
|
@ -0,0 +1,402 @@
|
|||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_alias = @build_alias@
|
||||
build_triplet = @build@
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
target_alias = @target_alias@
|
||||
target_triplet = @target@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CRT0 = @CRT0@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT = @EXEEXT@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBC_EXTRA_DEF = @LIBC_EXTRA_DEF@
|
||||
LIBC_EXTRA_LIB = @LIBC_EXTRA_LIB@
|
||||
LIBC_MACHINE_LIB = @LIBC_MACHINE_LIB@
|
||||
LIBC_POSIX_LIB = @LIBC_POSIX_LIB@
|
||||
LIBC_SIGNAL_DEF = @LIBC_SIGNAL_DEF@
|
||||
LIBC_SIGNAL_LIB = @LIBC_SIGNAL_LIB@
|
||||
LIBC_SYSCALL_LIB = @LIBC_SYSCALL_LIB@
|
||||
LIBC_SYS_LIB = @LIBC_SYS_LIB@
|
||||
LIBC_UNIX_LIB = @LIBC_UNIX_LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
aext = @aext@
|
||||
extra_dir = @extra_dir@
|
||||
libm_machine_dir = @libm_machine_dir@
|
||||
machine_dir = @machine_dir@
|
||||
newlib_basedir = @newlib_basedir@
|
||||
oext = @oext@
|
||||
sys_dir = @sys_dir@
|
||||
|
||||
AUTOMAKE_OPTIONS = cygnus
|
||||
|
||||
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||
|
||||
LIB_SOURCES = \
|
||||
argz_add.c \
|
||||
argz_add_sep.c \
|
||||
argz_append.c \
|
||||
argz_count.c \
|
||||
argz_create.c \
|
||||
argz_create_sep.c \
|
||||
argz_delete.c \
|
||||
argz_extract.c \
|
||||
argz_insert.c \
|
||||
argz_next.c \
|
||||
argz_replace.c \
|
||||
argz_stringify.c \
|
||||
buf_findstr.c \
|
||||
envz_entry.c \
|
||||
envz_get.c \
|
||||
envz_add.c \
|
||||
envz_remove.c \
|
||||
envz_merge.c \
|
||||
envz_strip.c
|
||||
|
||||
|
||||
libargz_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
|
||||
@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libargz.la
|
||||
@USE_LIBTOOL_TRUE@libargz_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES)
|
||||
@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in
|
||||
@USE_LIBTOOL_FALSE@noinst_DATA =
|
||||
@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a
|
||||
@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LIBS = @LIBS@
|
||||
lib_a_LIBADD =
|
||||
@USE_LIBTOOL_FALSE@lib_a_OBJECTS = argz_add.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@argz_add_sep.$(OBJEXT) argz_append.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@argz_count.$(OBJEXT) argz_create.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@argz_create_sep.$(OBJEXT) argz_delete.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@argz_extract.$(OBJEXT) argz_insert.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@argz_next.$(OBJEXT) argz_replace.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@argz_stringify.$(OBJEXT) buf_findstr.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@envz_entry.$(OBJEXT) envz_get.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@envz_add.$(OBJEXT) envz_remove.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@envz_merge.$(OBJEXT) envz_strip.$(OBJEXT)
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
|
||||
libargz_la_LIBADD =
|
||||
@USE_LIBTOOL_TRUE@libargz_la_OBJECTS = argz_add.lo argz_add_sep.lo \
|
||||
@USE_LIBTOOL_TRUE@argz_append.lo argz_count.lo argz_create.lo \
|
||||
@USE_LIBTOOL_TRUE@argz_create_sep.lo argz_delete.lo argz_extract.lo \
|
||||
@USE_LIBTOOL_TRUE@argz_insert.lo argz_next.lo argz_replace.lo \
|
||||
@USE_LIBTOOL_TRUE@argz_stringify.lo buf_findstr.lo envz_entry.lo \
|
||||
@USE_LIBTOOL_TRUE@envz_get.lo envz_add.lo envz_remove.lo envz_merge.lo \
|
||||
@USE_LIBTOOL_TRUE@envz_strip.lo
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DATA = $(noinst_DATA)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
SOURCES = $(lib_a_SOURCES) $(libargz_la_SOURCES)
|
||||
OBJECTS = $(lib_a_OBJECTS) $(libargz_la_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .obj .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../Makefile.shared
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --cygnus argz/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-noinstLIBRARIES:
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
|
||||
distclean-noinstLIBRARIES:
|
||||
|
||||
maintainer-clean-noinstLIBRARIES:
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
# FIXME: We should only use cygpath when building on Windows,
|
||||
# and only if it is available.
|
||||
.c.obj:
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
|
||||
-rm -f lib.a
|
||||
$(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
|
||||
$(RANLIB) lib.a
|
||||
|
||||
mostlyclean-noinstLTLIBRARIES:
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
|
||||
distclean-noinstLTLIBRARIES:
|
||||
|
||||
maintainer-clean-noinstLTLIBRARIES:
|
||||
|
||||
libargz.la: $(libargz_la_OBJECTS) $(libargz_la_DEPENDENCIES)
|
||||
$(LINK) $(libargz_la_LDFLAGS) $(libargz_la_OBJECTS) $(libargz_la_LIBADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = argz
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am:
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-info-am:
|
||||
install-info: install-info-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am:
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \
|
||||
mostlyclean-tags mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \
|
||||
clean-noinstLTLIBRARIES clean-tags clean-generic \
|
||||
mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-noinstLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-noinstLTLIBRARIES \
|
||||
distclean-tags distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-noinstLTLIBRARIES \
|
||||
maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
|
||||
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
|
||||
clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \
|
||||
distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \
|
||||
maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
|
||||
check-am installcheck-am installcheck install-info-am install-info \
|
||||
install-exec-am install-exec install-data-am install-data install-am \
|
||||
install uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
objectlist.awk.in: $(noinst_LTLIBRARIES)
|
||||
-rm -f objectlist.awk.in
|
||||
for i in `ls *.lo` ; \
|
||||
do \
|
||||
echo $$i `pwd`/$$i >> objectlist.awk.in ; \
|
||||
done
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,29 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
error_t
|
||||
argz_add (char **argz, size_t *argz_len, const char *str)
|
||||
{
|
||||
int len_to_add = 0;
|
||||
size_t last = *argz_len;
|
||||
|
||||
if (str == NULL)
|
||||
return 0;
|
||||
|
||||
len_to_add = strlen(str) + 1;
|
||||
*argz_len += len_to_add;
|
||||
|
||||
if(!(*argz = (char *)realloc(*argz, *argz_len)))
|
||||
return ENOMEM;
|
||||
|
||||
memcpy(*argz + last, str, len_to_add);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <argz.h>
|
||||
|
||||
error_t
|
||||
argz_add_sep (char **argz, size_t *argz_len, const char *str, int sep)
|
||||
{
|
||||
char *str_argz = 0;
|
||||
size_t str_argz_len = 0;
|
||||
size_t last = *argz_len;
|
||||
|
||||
argz_create_sep (str, sep, &str_argz, &str_argz_len);
|
||||
|
||||
*argz_len += str_argz_len;
|
||||
|
||||
if(!(*argz = (char *)realloc(*argz, *argz_len)))
|
||||
return ENOMEM;
|
||||
|
||||
memcpy(*argz + last, str_argz, str_argz_len);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
error_t
|
||||
argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len)
|
||||
{
|
||||
size_t last = *argz_len;
|
||||
|
||||
*argz_len += buf_len;
|
||||
|
||||
if(!(*argz = (char *)realloc(*argz, *argz_len)))
|
||||
return ENOMEM;
|
||||
|
||||
memcpy(*argz + last, buf, buf_len);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
size_t
|
||||
argz_count (const char *argz, size_t argz_len)
|
||||
{
|
||||
int i;
|
||||
size_t count = 0;
|
||||
|
||||
for (i = 0; i < argz_len; i++)
|
||||
{
|
||||
if (argz[i] == '\0')
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
error_t
|
||||
argz_create (char *const argv[], char **argz, size_t *argz_len)
|
||||
{
|
||||
int argc = 0;
|
||||
int i = 0;
|
||||
int len = 0;
|
||||
char *iter;
|
||||
|
||||
*argz_len = 0;
|
||||
|
||||
if (*argv == NULL)
|
||||
{
|
||||
*argz = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (argv[argc])
|
||||
{
|
||||
*argz_len += (strlen(argv[argc]) + 1);
|
||||
argc++;
|
||||
}
|
||||
|
||||
/* There are argc strings to copy into argz. */
|
||||
if(!(*argz = (char *)malloc(*argz_len)))
|
||||
return ENOMEM;
|
||||
|
||||
iter = *argz;
|
||||
for(i = 0; i < argc; i++)
|
||||
{
|
||||
len = strlen(argv[i]) + 1;
|
||||
memcpy(iter, argv[i], len);
|
||||
iter += len;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
error_t
|
||||
argz_create_sep (const char *string, int sep, char **argz, size_t *argz_len)
|
||||
{
|
||||
int len = 0;
|
||||
int i = 0;
|
||||
int num_strings = 0;
|
||||
char delim[2];
|
||||
char *running = 0;
|
||||
char *old_running = 0;
|
||||
char *token = 0;
|
||||
char *iter = 0;
|
||||
|
||||
delim[0] = sep;
|
||||
delim[1] = '\0';
|
||||
|
||||
running = strdup(string);
|
||||
old_running = running;
|
||||
|
||||
while ((token = strsep(&running, delim)))
|
||||
{
|
||||
len = strlen(token);
|
||||
*argz_len += (len + 1);
|
||||
num_strings++;
|
||||
}
|
||||
|
||||
if(!(*argz = (char *)malloc(*argz_len)))
|
||||
return ENOMEM;
|
||||
|
||||
free(old_running);
|
||||
|
||||
running = strdup(string);
|
||||
old_running = running;
|
||||
|
||||
iter = *argz;
|
||||
for (i = 0; i < num_strings; i++)
|
||||
{
|
||||
token = strsep(&running, delim);
|
||||
len = strlen(token) + 1;
|
||||
memcpy(iter, token, len);
|
||||
iter += len;
|
||||
}
|
||||
|
||||
free(old_running);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
error_t
|
||||
argz_delete (char **argz, size_t *argz_len, char *entry)
|
||||
{
|
||||
int len = 0;
|
||||
char *moveto = entry;
|
||||
|
||||
if (entry)
|
||||
{
|
||||
len = strlen(entry) + 1;
|
||||
entry += len;
|
||||
|
||||
memmove(moveto, entry, *argz + *argz_len - entry);
|
||||
|
||||
*argz_len -= len;
|
||||
|
||||
if(!(*argz = (char *)realloc(*argz, *argz_len)))
|
||||
return ENOMEM;
|
||||
|
||||
if (*argz_len <= 0)
|
||||
{
|
||||
free(*argz);
|
||||
*argz = NULL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <argz.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
void
|
||||
argz_extract (char *argz, size_t argz_len, char **argv)
|
||||
{
|
||||
size_t i = 0;
|
||||
int j = 0;
|
||||
const size_t count = argz_count(argz, argz_len);
|
||||
|
||||
for (i = argz_len - 2; i > 0; i--)
|
||||
{
|
||||
if (argz[i] == '\0')
|
||||
{
|
||||
j++;
|
||||
argv[count - j] = &argz[i + 1];
|
||||
}
|
||||
}
|
||||
argv[0] = &argz[0];
|
||||
argv[count] = NULL;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <argz.h>
|
||||
|
||||
error_t
|
||||
argz_insert (char **argz, size_t *argz_len, char *before, const char *entry)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
if (before == NULL)
|
||||
argz_add(argz, argz_len, entry);
|
||||
|
||||
if (before < *argz || before >= *argz + *argz_len)
|
||||
return EINVAL;
|
||||
|
||||
while (before != *argz && before[-1])
|
||||
before--;
|
||||
|
||||
len = strlen(entry) + 1;
|
||||
|
||||
if(!(*argz = (char *)realloc(*argz, *argz_len + len)))
|
||||
return ENOMEM;
|
||||
|
||||
memmove(before + len, before, *argz + *argz_len - before);
|
||||
memcpy(before, entry, len);
|
||||
|
||||
*argz_len += len;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char *
|
||||
argz_next (char *argz, size_t argz_len, const char *entry)
|
||||
{
|
||||
if (entry)
|
||||
{
|
||||
while(*entry != '\0')
|
||||
entry++;
|
||||
entry++;
|
||||
|
||||
if (entry >= argz + argz_len)
|
||||
return NULL;
|
||||
else
|
||||
return (char *) entry;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (argz_len > 0)
|
||||
return (char *) argz;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <argz.h>
|
||||
|
||||
extern int buf_findstr(const char *str, char **buf, size_t *buf_len);
|
||||
|
||||
error_t
|
||||
argz_replace (char **argz, size_t *argz_len, const char *str, const char *with, unsigned *replace_count)
|
||||
{
|
||||
const int str_len = strlen(str);
|
||||
const int with_len = strlen(with);
|
||||
const int len_diff = with_len - str_len;
|
||||
|
||||
char *buf_iter = *argz;
|
||||
size_t buf_len = *argz_len;
|
||||
char *last_iter = NULL;
|
||||
char *new_argz = NULL;
|
||||
size_t new_argz_len = 0;
|
||||
char *new_argz_iter = NULL;
|
||||
|
||||
*replace_count = 0;
|
||||
new_argz_len = *argz_len;
|
||||
|
||||
while(buf_len)
|
||||
{
|
||||
if(buf_findstr(str, &buf_iter, &buf_len))
|
||||
{
|
||||
*replace_count += 1;
|
||||
new_argz_len += len_diff;
|
||||
}
|
||||
}
|
||||
|
||||
if (*replace_count)
|
||||
{
|
||||
new_argz = (char *)malloc(new_argz_len);
|
||||
|
||||
buf_iter = *argz;
|
||||
buf_len = *argz_len;
|
||||
last_iter = buf_iter;
|
||||
new_argz_iter = new_argz;
|
||||
|
||||
while(buf_len)
|
||||
{
|
||||
if (buf_findstr(str, &buf_iter, &buf_len))
|
||||
{
|
||||
/* copy everything up to, but not including str, from old argz to
|
||||
new argz. */
|
||||
memcpy(new_argz_iter, last_iter, buf_iter - last_iter - str_len);
|
||||
new_argz_iter += (buf_iter - last_iter - str_len);
|
||||
/* copy replacement string. */
|
||||
memcpy(new_argz_iter, with, with_len);
|
||||
new_argz_iter += with_len;
|
||||
last_iter = buf_iter;
|
||||
}
|
||||
}
|
||||
/* copy everything after last occurrence of str. */
|
||||
memcpy(new_argz_iter, last_iter, *argz + *argz_len - last_iter);
|
||||
|
||||
/* reallocate argz, and copy over the new value. */
|
||||
if(!(*argz = (char *)realloc(*argz, new_argz_len)))
|
||||
return ENOMEM;
|
||||
|
||||
memcpy(*argz, new_argz, new_argz_len);
|
||||
*argz_len = new_argz_len;
|
||||
|
||||
if (*argz_len == 0)
|
||||
{
|
||||
free(*argz);
|
||||
*argz = NULL;
|
||||
}
|
||||
free(new_argz);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
void
|
||||
argz_stringify (char *argz, size_t argz_len, int sep)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
/* len includes trailing \0, which we don't want to replace. */
|
||||
for (i = 0; i < argz_len - 1; i++)
|
||||
{
|
||||
if (argz[i] == '\0')
|
||||
argz[i] = sep;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Find string str in buffer buf of length buf_len. Point buf to character after string,
|
||||
or set it to NULL if end of buffer is reached. Return 1 if found, 0 if not. */
|
||||
int
|
||||
buf_findstr(const char *str, const char **buf, size_t *buf_len)
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
for (i = 0; i < *buf_len; i++)
|
||||
{
|
||||
if (str[0] == (*buf)[i])
|
||||
{
|
||||
j = i;
|
||||
while (str[j - i] && (str[j - i] == (*buf)[j])) j++;
|
||||
if(str[j - i] == '\0')
|
||||
{
|
||||
*buf += j;
|
||||
*buf_len -= j;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == *buf_len)
|
||||
{
|
||||
*buf += *buf_len;
|
||||
*buf_len = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <argz.h>
|
||||
#include <envz.h>
|
||||
|
||||
error_t
|
||||
envz_add (char **envz, size_t *envz_len, const char *name, const char *value)
|
||||
{
|
||||
char *concat = NULL;
|
||||
int name_len = 0;
|
||||
int val_len = 0;
|
||||
int retval = 0;
|
||||
|
||||
envz_remove(envz, envz_len, name);
|
||||
|
||||
if (value)
|
||||
{
|
||||
name_len = strlen(name);
|
||||
val_len = strlen(value);
|
||||
if(!(concat = (char *) malloc(name_len + val_len + 2)))
|
||||
return ENOMEM;
|
||||
|
||||
memcpy(concat, name, name_len);
|
||||
concat[name_len] = '=';
|
||||
memcpy(concat + name_len + 1, value, val_len + 1);
|
||||
|
||||
retval = argz_add(envz, envz_len, concat);
|
||||
free(concat);
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = argz_add(envz, envz_len, name);
|
||||
}
|
||||
return retval;
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <envz.h>
|
||||
|
||||
extern int buf_findstr(const char *str, char **buf, size_t *buf_len);
|
||||
|
||||
char *
|
||||
envz_entry (const char *envz, size_t envz_len, const char *name)
|
||||
{
|
||||
const char *buf_ptr = envz;
|
||||
size_t buf_len = envz_len;
|
||||
|
||||
while(buf_len)
|
||||
{
|
||||
if (buf_findstr(name, &buf_ptr, &buf_len))
|
||||
{
|
||||
if (buf_ptr)
|
||||
{
|
||||
if (*buf_ptr == '=' || *buf_ptr == '\0')
|
||||
{
|
||||
buf_ptr--;
|
||||
|
||||
/* Move buf_ptr back to start of entry. */
|
||||
while(*buf_ptr != '\0' && buf_ptr != envz) buf_ptr--;
|
||||
|
||||
if(*buf_ptr == '\0')
|
||||
buf_ptr++;
|
||||
|
||||
return buf_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <envz.h>
|
||||
|
||||
extern int buf_findstr(const char *str, char **buf, size_t *buf_len);
|
||||
|
||||
char *
|
||||
envz_get (const char *envz, size_t envz_len, const char *name)
|
||||
{
|
||||
const char *buf_ptr = envz;
|
||||
size_t buf_len = envz_len;
|
||||
|
||||
while(buf_len)
|
||||
{
|
||||
if (buf_findstr(name, &buf_ptr, &buf_len))
|
||||
{
|
||||
if (*buf_ptr == '=')
|
||||
{
|
||||
buf_ptr++;
|
||||
return buf_ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*buf_ptr == '\0')
|
||||
/* NULL entry. */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* No matching entries found. */
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <argz.h>
|
||||
#include <envz.h>
|
||||
|
||||
error_t
|
||||
envz_merge (char **envz, size_t *envz_len, const char *envz2, size_t envz2_len, int override)
|
||||
{
|
||||
char *entry = NULL;
|
||||
char *name_str = NULL;
|
||||
char *val_str = NULL;
|
||||
char *name_iter = NULL;
|
||||
int retval = 0;
|
||||
|
||||
while((entry = argz_next(envz2, envz2_len, entry)) && !retval)
|
||||
{
|
||||
if (!override)
|
||||
{
|
||||
name_str = strdup (entry);
|
||||
name_iter = strchr(name_str, '=');
|
||||
if(name_iter)
|
||||
*name_iter = '\0';
|
||||
|
||||
if(!envz_entry(*envz, *envz_len, name_str))
|
||||
{
|
||||
retval = argz_add(envz, envz_len, entry);
|
||||
}
|
||||
free(name_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
name_str = strdup (entry);
|
||||
name_iter = strchr(name_str, '=');
|
||||
if(name_iter)
|
||||
{
|
||||
*name_iter = '\0';
|
||||
val_str = name_iter + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
val_str = NULL;
|
||||
}
|
||||
|
||||
retval = envz_add(envz, envz_len, name_str, val_str);
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <argz.h>
|
||||
#include <envz.h>
|
||||
|
||||
void
|
||||
envz_remove(char **envz, size_t *envz_len, const char *name)
|
||||
{
|
||||
char *entry = NULL;
|
||||
int len = 0;
|
||||
entry = envz_entry (*envz, *envz_len, name);
|
||||
|
||||
if (entry)
|
||||
{
|
||||
len = strlen(entry) + 1;
|
||||
|
||||
/* Not the last entry. */
|
||||
if (*envz + *envz_len != entry + len - 1)
|
||||
{
|
||||
memmove(entry, entry + len, *envz + *envz_len - entry - len);
|
||||
}
|
||||
|
||||
*envz = (char *)realloc(*envz, *envz_len - len);
|
||||
*envz_len -= len;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <argz.h>
|
||||
#include <envz.h>
|
||||
|
||||
void
|
||||
envz_strip (char **envz, size_t *envz_len)
|
||||
{
|
||||
char *entry = 0;
|
||||
int len = 0;
|
||||
int null_found = 0;
|
||||
|
||||
while((entry = argz_next(*envz, *envz_len, entry)))
|
||||
{
|
||||
if(!strchr(entry, '='))
|
||||
{
|
||||
null_found = 1;
|
||||
len = strlen(entry) + 1;
|
||||
/* Make sure this is not the last entry in envz. If it is, it
|
||||
will be chopped off by the realloc anyway.*/
|
||||
if(*envz + *envz_len != entry + len - 1)
|
||||
{
|
||||
memmove(entry, entry + len, *envz + *envz_len - entry - len);
|
||||
}
|
||||
*envz_len -= len;
|
||||
}
|
||||
}
|
||||
if(null_found)
|
||||
{
|
||||
*envz = (char *)realloc(*envz, *envz_len);
|
||||
}
|
||||
}
|
|
@ -3143,7 +3143,7 @@ done
|
|||
ac_given_srcdir=$srcdir
|
||||
ac_given_INSTALL="$INSTALL"
|
||||
|
||||
trap 'rm -fr `echo "Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile stdio/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
trap 'rm -fr `echo "Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile stdio/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
|
@ -3285,7 +3285,7 @@ EOF
|
|||
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile stdio/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile"}
|
||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile stdio/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile"}
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
||||
|
|
|
@ -110,4 +110,4 @@ fi
|
|||
AC_SUBST(LIBC_MACHINE_LIB)
|
||||
AC_SUBST(machine_dir)
|
||||
|
||||
AC_OUTPUT(Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile stdio/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile)
|
||||
AC_OUTPUT(Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile stdio/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile)
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* The newlib implementation of these functions assumes that sizeof(char) == 1. */
|
||||
error_t argz_create (char *const argv[], char **argz, size_t *argz_len);
|
||||
error_t argz_create_sep (const char *string, int sep, char **argz, size_t *argz_len);
|
||||
size_t argz_count (const char *argz, size_t argz_len);
|
||||
void argz_extract (char *argz, size_t argz_len, char **argv);
|
||||
void argz_stringify (char *argz, size_t argz_len, int sep);
|
||||
error_t argz_add (char **argz, size_t *argz_len, const char *str);
|
||||
error_t argz_add_sep (char **argz, size_t *argz_len, const char *str, int sep);
|
||||
error_t argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len);
|
||||
error_t argz_delete (char **argz, size_t *argz_len, char *entry);
|
||||
error_t argz_insert (char **argz, size_t *argz_len, char *before, const char *entry);
|
||||
char * argz_next (char *argz, size_t argz_len, const char *entry);
|
||||
error_t argz_replace (char **argz, size_t *argz_len, const char *str, const char *with, unsigned *replace_count);
|
|
@ -0,0 +1,16 @@
|
|||
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* The newlib implementation of these functions assumes that sizeof(char) == 1. */
|
||||
char * envz_entry (const char *envz, size_t envz_len, const char *name);
|
||||
char * envz_get (const char *envz, size_t envz_len, const char *name);
|
||||
error_t envz_add (char **envz, size_t *envz_len, const char *name, const char *value);
|
||||
error_t envz_merge (char **envz, size_t *envz_len, const char *envz2, size_t envz2_len, int override);
|
||||
void envz_remove(char **envz, size_t *envz_len, const char *name);
|
||||
void envz_strip (char **envz, size_t *envz_len);
|
|
@ -1 +1,3 @@
|
|||
typedef int error_t;
|
||||
|
||||
#include <sys/errno.h>
|
||||
|
|
Loading…
Reference in New Issue