This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Cheers, Nicholas
Index: libc/Makefile.am
===================================================================
RCS file: /var/cvs/src-cvs/src/newlib/libc/Makefile.am,v
retrieving revision 1.8
diff -u -p -a -r1.8 Makefile.am
--- libc/Makefile.am 20 Sep 2002 17:11:29 -0000 1.8
+++ libc/Makefile.am 18 Nov 2003 00:36:41 -0000
@@ -25,7 +25,7 @@ endif
# The order of SUBDIRS is important for the integrated documentation.
# Do not change the order without considering the doc impact.
SUBDIRS = argz stdlib ctype search stdio $(STDIO64_SUBDIR) string $(SIGNAL_SUBDIR) time locale sys reent \
- $(extra_dir) errno misc machine $(UNIX_SUBDIR) $(POSIX_SUBDIR) $(SYSCALLS_SUBDIR) .
+ $(extra_dir) errno gen misc machine $(UNIX_SUBDIR) $(POSIX_SUBDIR) $(SYSCALLS_SUBDIR) .
noinst_DATA = $(CRT0)
@@ -46,6 +46,7 @@ SUBLIBS = \
reent/libreent.$(aext) \
$(LIBC_EXTRA_LIB) \
errno/liberrno.$(aext) \
+ gen/libgen.$(aext) \
misc/libmisc.$(aext) \
$(LIBC_MACHINE_LIB) \
$(LIBC_UNIX_LIB) \
@@ -68,6 +69,7 @@ SUBLIBS = \
reent/lib.$(aext) \
$(LIBC_EXTRA_LIB) \
errno/lib.$(aext) \
+ gen/lib.$(aext) \
misc/lib.$(aext) \
$(LIBC_MACHINE_LIB) \
$(LIBC_UNIX_LIB) \
@@ -120,6 +122,7 @@ SUBDEFS = \
locale/stmp-def \
reent/stmp-def \
$(LIBC_EXTRA_DEF) \
+ gen/stmp-def \
misc/stmp-def
libc.info: sigset.texi extra.texi stdio64.texi targetdep.tex $(SUBDEFS)
Index: libc/configure
===================================================================
RCS file: /var/cvs/src-cvs/src/newlib/libc/configure,v
retrieving revision 1.19
diff -u -p -a -r1.19 configure
--- libc/configure 8 Feb 2003 04:30:22 -0000 1.19
+++ libc/configure 18 Nov 2003 00:43:18 -0000
@@ -3265,7 +3265,7 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/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 gen/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/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
@@ -3423,7 +3423,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/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 gen/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/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
Index: libc/configure.in
===================================================================
RCS file: /var/cvs/src-cvs/src/newlib/libc/configure.in,v
retrieving revision 1.7
diff -u -p -a -r1.7 configure.in
--- libc/configure.in 9 Aug 2002 21:12:08 -0000 1.7
+++ libc/configure.in 18 Nov 2003 00:43:06 -0000
@@ -133,4 +133,4 @@ fi
AC_SUBST(LIBC_MACHINE_LIB)
AC_SUBST(machine_dir)
-AC_OUTPUT(Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/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 gen/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile)
Index: libc/libc.texinfo
===================================================================
RCS file: /var/cvs/src-cvs/src/newlib/libc/libc.texinfo,v
retrieving revision 1.7
diff -u -p -a -r1.7 libc.texinfo
--- libc/libc.texinfo 20 Oct 2003 18:46:36 -0000 1.7
+++ libc/libc.texinfo 18 Nov 2003 00:41:34 -0000
@@ -174,6 +174,7 @@ into another language, under the above c
* Locale::
* Syscalls::
+* Gen::
* Misc::
* Arglists::
* Reentrancy::
Index: libc/gen/Makefile.am
===================================================================
RCS file: libc/gen/Makefile.am
diff -N libc/gen/Makefile.am
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libc/gen/Makefile.am 18 Nov 2003 00:39:44 -0000
@@ -0,0 +1,51 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+GENERAL_SOURCES = dummy.c
+
+## The following handles EL/IX level 2 functions
+if ELIX_LEVEL_1
+LIB_OBJS =
+else
+LIB_OBJS = \
+ getprogname.$(oext) \
+ setprogname.$(oext)
+endif
+
+libgen_la_LDFLAGS = -Xcompiler -nostdlib
+
+if USE_LIBTOOL
+noinst_LTLIBRARIES = libgen.la
+libgen_la_SOURCES = $(GENERAL_SOURCES)
+libgen_la_LIBADD = $(LIB_OBJS)
+libgen_la_DEPENDENCIES = $(LIB_OBJS)
+noinst_DATA = objectlist.awk.in
+else
+noinst_LIBRARIES = lib.a
+lib_a_SOURCES = $(GENERAL_SOURCES)
+lib_a_LIBADD = $(LIB_OBJS)
+lib_a_DEPENDENCIES = $(LIB_OBJS)
+noinst_DATA =
+endif # USE_LIBTOOL
+
+include $(srcdir)/../../Makefile.shared
+
+CHEWOUT_FILES = getprogname.def setprogname.def
+
+SUFFIXES = .def
+
+CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str
+
+.c.def:
+ $(CHEW) < $< > $*.def 2> $*.ref
+ touch stmp-def
+
+TARGETDOC = ../tmp.texi
+
+doc: $(CHEWOUT_FILES)
+ cat $(srcdir)/gen.tex >> $(TARGETDOC)
+
+CLEANFILES = $(CHEWOUT_FILES) *.ref
Index: libc/gen/dummy.c
===================================================================
RCS file: libc/gen/dummy.c
diff -N libc/gen/dummy.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libc/gen/dummy.c 3 Nov 2003 21:55:58 -0000
@@ -0,0 +1 @@
+/* empty stub to allow objectlist.awk.in to be created */
Index: libc/gen/gen.tex
===================================================================
RCS file: libc/gen/gen.tex
diff -N libc/gen/gen.tex
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libc/gen/gen.tex 17 Nov 2003 23:35:56 -0000
@@ -0,0 +1,15 @@
+@node Gen
+@chapter General Purpose Macros and Functions
+This chapter groups macros (which are also available as subroutines)
+which do path traversal and pathname manipulation.
+
+@menu
+* getprogname:: Get the name of a program or routine
+* setprogname:: Set the name of a program or routine
+@end menu
+
+@page
+@include gen/getprogname.def
+
+@page
+@include gen/setprogname.def
Index: libc/gen/getprogname.3
===================================================================
RCS file: libc/gen/getprogname.3
diff -N libc/gen/getprogname.3
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libc/gen/getprogname.3 3 Nov 2003 21:34:33 -0000
@@ -0,0 +1,94 @@
+.\"
+.\" Copyright (c) 2001 Christopher G. Demetriou
+.\" 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. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the
+.\" NetBSD Project. See http://www.netbsd.org/ for
+.\" information about NetBSD.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+.\"
+.\" $FreeBSD: src/lib/libc/gen/getprogname.3,v 1.5 2001/10/01 16:08:51 ru Exp $
+.\"
+.Dd October 1, 2001
+.Dt GETPROGNAME 3
+.Os
+.Sh NAME
+.Nm getprogname ,
+.Nm setprogname
+.Nd get or set the program name
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In stdlib.h
+.Ft const char *
+.Fn getprogname "void"
+.Ft void
+.Fn setprogname "const char *progname"
+.Sh DESCRIPTION
+The
+.Fn getprogname
+and
+.Fn setprogname
+functions manipulate the name of the current program.
+They are used by error-reporting routines to produce
+consistent output.
+.Pp
+The
+.Fn getprogname
+function returns the name of the program.
+If the name has not been set yet, it will return
+.Dv NULL .
+.Pp
+The
+.Fn setprogname
+function sets the name of the program to be the last component of the
+.Fa progname
+argument.
+Since a pointer to the given string is kept as the program name,
+it should not be modified for the rest of the program's lifetime.
+.Pp
+In
+.Fx ,
+the name of the program is set by the start-up code that is run before
+.Fn main ;
+thus,
+running
+.Fn setprogname
+is not necessary.
+Programs that desire maximum portability should still call it;
+on another operating system,
+these functions may be implemented in a portability library.
+Calling
+.Fn setprogname
+allows the aforementioned library to learn the program name without
+modifications to the start-up code.
+.Sh SEE ALSO
+.Xr err 3 ,
+.Xr setproctitle 3
+.Sh HISTORY
+These functions first appeared in
+.Nx 1.6 ,
+and made their way into
+.Fx 4.4 .
Index: libc/gen/getprogname.c
===================================================================
RCS file: libc/gen/getprogname.c
diff -N libc/gen/getprogname.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libc/gen/getprogname.c 18 Nov 2003 00:10:21 -0000
@@ -0,0 +1,78 @@
+/*
+FUNCTION
+<<getprogname>>---get the name of a program or routine
+
+INDEX
+ getprogname
+
+ANSI_SYNOPSIS
+ #include <stdlib.h>
+ const char *getprogname(void);
+
+TRAD_SYNOPSIS
+ #include <stdlib.h>
+ const char *getprogname();
+
+DESCRIPTION
+ The <<getprogname>> function is used to find the name of the current
+ program. The <<getprogname>> function is most often used by
+ error-reporting routines to produce consistent error reports. The name
+ of the program is set either through startup routines or by using
+ <<setprogname>>.
+
+RETURNS
+ The <<getprogname>> function returns the name of the program as a
+ character constant. If the name has not been set yet, it will return
+ <<NULL>>.
+
+PORTABILITY
+ The <<getprogname>> function first appeared in NetBSD 1.6, and made
+ its way into FreeBSD 4.4. While BSD in nature, this function was
+ designed to work with system level support and without.
+
+<<getprogname>> requires no supporting OS subroutines. However, on OS's which
+support it, the crt0 startup routine will automatically set the <[__progname]>
+pointer.
+*/
+/*
+ * Copyright (c) 1990, 1993, 1994
+ * 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. 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.
+ *
+ * $FreeBSD: src/lib/libc/gen/getprogname.c,v 1.4 2002/03/29 22:43:41 markm Exp $");
+ */
+static const char
+rcsid[] = "$NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $";
+
+#include <stdlib.h>
+
+extern const char *__progname;
+
+_CONST char *
+_DEFUN_VOID (getprogname)
+{
+ return (__progname);
+}
Index: libc/gen/setprogname.c
===================================================================
RCS file: libc/gen/setprogname.c
diff -N libc/gen/setprogname.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libc/gen/setprogname.c 18 Nov 2003 00:10:59 -0000
@@ -0,0 +1,87 @@
+/*
+FUNCTION
+<<setprogname>>---set the name of a program or routine
+
+INDEX
+ setprogname
+
+ANSI_SYNOPSIS
+ #include <stdlib.h>
+ void setprogname(const char *<[progname]>);
+
+TRAD_SYNOPSIS
+ #include <stdlib.h>
+ void setprogname(<[progname]>)
+ const char *<[progname]>;
+
+DESCRIPTION
+ The <<setprogname>> function manipulates the name of the current program.
+ The <<setprogname>> function sets the name of the program to be the last
+ component of the progname argument. Since a pointer to the given string
+ is kept as the program name, it should not be modified for the rest of
+ the program's lifetime. The <<setprogname>> function is most often used
+ by error-reporting routines to produce consistent error reports.
+
+PORTABILITY
+ The <<setprogname>> function first appeared in NetBSD 1.6, and made its
+ way into FreeBSD 4.4. While BSD in nature, this function was designed
+ to work with low level support and without. In FreeBSD, the name of the
+ program is set by the start-up code that is run before <<main>>; thus,
+ running <<setprogname>> is not necessary. Programs that desire maximum
+ portability should still call it; on another operating system, these
+ functions may be implemented in a portability library. Calling
+ <<setprogname>> allows the aforementioned library to learn the program's
+ name without modifications to the runtime start-up code.
+
+<<setprogname>> requires no supporting OS subroutines.
+*/
+/*
+ * Copyright (c) 1990, 1993, 1994
+ * 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. 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.
+ *
+ * $NetBSD: setprogname.c,v 1.3 2003/07/26 19:24:44 salo Exp $
+ */
+static const char
+rcsid[] = "$FreeBSD: src/lib/libc/gen/setprogname.c,v 1.8 2002/03/29 22:43:41 markm Exp $";
+
+#include <stdlib.h>
+#include <string.h>
+
+extern const char *__progname;
+
+_VOID
+_DEFUN (setprogname, (progname),
+ const char *progname)
+{
+ const char *p;
+
+ p = strrchr(progname, '/');
+ if (p != NULL)
+ __progname = p + 1;
+ else
+ __progname = progname;
+}
Index: libc/include/stdlib.h
===================================================================
RCS file: /var/cvs/src-cvs/src/newlib/libc/include/stdlib.h,v
retrieving revision 1.21
diff -u -p -a -r1.21 stdlib.h
--- libc/include/stdlib.h 17 Nov 2003 17:30:30 -0000 1.21
+++ libc/include/stdlib.h 18 Nov 2003 00:16:15 -0000
@@ -66,9 +66,8 @@ _VOID _EXFUN(exit,(int __status) _ATTRIB
_VOID _EXFUN(free,(_PTR));
char * _EXFUN(getenv,(const char *__string));
char * _EXFUN(_getenv_r,(struct _reent *, const char *__string));
-#ifdef __CYGWIN__
-const char *_EXFUN(getprogname,(void));
-#endif
+_CONST
+char * _EXFUN(getprogname,(_VOID));
char * _EXFUN(_findenv,(_CONST char *, int *));
char * _EXFUN(_findenv_r,(struct _reent *, _CONST char *, int *));
long _EXFUN(labs,(long));
@@ -93,9 +92,7 @@ char * _EXFUN(mktemp,(char *));
_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR)));
int _EXFUN(rand,(_VOID));
_PTR _EXFUN(realloc,(_PTR __r, size_t __size));
-#ifdef __CYGWIN__
-void _EXFUN(setprogname,(const char *));
-#endif
+_VOID _EXFUN(setprogname,(_CONST char *));
_VOID _EXFUN(srand,(unsigned __seed));
double _EXFUN(strtod,(const char *__n, char **__end_PTR));
double _EXFUN(_strtod_r,(struct _reent *,const char *__n, char **__end_PTR));
Attachment:
newlib-add-get-set-progname.patch.bz2
Description: Unix tar archive
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |