List of known bugs (certainly very incomplete)
----------------------------------------------
-Time-stamp: <1997-11-02T15:10:48+0100 drepper>
+Time-stamp: <1997-11-05T16:59:11+0100 drepper>
This following list contains those bugs which I'm aware of. Please
make sure that bugs you report are not listed here. If you can fix one
[ *] The rcmd() functions (more concrete: the handling of .rhosts) does
not support netgroups and wildcards (+).
-[ *] The first alias definition in locale.alias is ignored.
- [PR libc/205]
-
[ *] When assembling a locale definition, that uses the "copy"
directive, with localedef, not only the copied category is
checked for errors, but the whole file containing the same
+1997-11-06 00:06 Ulrich Drepper <drepper@cygnus.com>
+
+ * argp/argp-help.c: Optimize a bit by using mempcpy.
+ * elf/dl-load.c: Likewise.
+ * elf/dl-lookup.c: Likewise.
+ * inet/rcmd.c: Likewise.
+ * io/ftw.c: Likewise.
+ * libio/fileops.c: Likewise.
+ * libio/genops.c: Likewise.
+ * libio/obprintf.c: Likewise.
+ * nss/nsswitch.c: Likewise.
+ * posix/execvp.c: Likewise.
+ * posix/getopt.c: Likewise.
+ * posix/glob.c: Likewise.
+ * posix/wordexp.c: Likewise.
+ * stdio-common/vfprintf.c: Likewise.
+ * stdlib/canonicalize.c: Likewise.
+ * stdlib/msort.c: Likewise.
+ * string/argz-replace.c: Likewise.
+ * sysdeps/generic/putenv.c: Likewise.
+ * sysdeps/generic/setenv.c: Likewise.
+ * sysdeps/posix/getcwd.c: Likewise.
+ * sysdeps/posix/ttyname.c: Likewise.
+ * sysdeps/posix/writev.c: Likewise.
+ * time/strftime.c: Likewise.
+ * time/tzfile.c: Likewise.
+
+ * login/utmp_daemon.c: Use memcpy instead of strcpy where possible.
+ * sunrpc/svcauth_des.c: Likewise.
+ * sysdeps/unix/sysv/linux/gethostname.c: Likewise.
+
+ * misc/tsearch.c: Use memcpy return value if possible.
+ * posix/regex.c: Likewise.
+ * sysdeps/unix/readdir_r.c: Likewise.
+ * wcsmbc/wcsdup.c: Likewise.
+
+ * nss/digits_dots.c: Little optimization.
+
+ * inet/ruserpass.c (ruserpass): Optimize by using stpcpy.
+ (struct toktab): Make tokstr field a const char *.
+
+ * elf/dl-profile.c: Fix typo.
+
+ * inet/ether_ntoh.c: Don't use relative #include path.
+ * inet/gethstbynm.c: Likewise.
+ * resolv/inet_pton.c: Likewise.
+ * shadow/sgetspent_r.c: Likewise.
+
+ * libio/oldfileops.c (_IO_old_file_jumps): Use correct sync and write
+ callbacks. Patch by NIIBE Yutaka <gniibe@mri.co.jp>.
+
+ * posix/confstr.c: Correct string for _CS_LFS_CFLAGS.
+ Handle _CS_XBS5_* constants.
+ * posix/unistd.h: Add comment describing _XBS5_* constants.
+ * sysdeps/generic/bits/confname.h: Add _CS_XBS5_* constants.
+
+ * posix/regex.c: Indent preprocessor code.
+
+ * posix/wordexp.c: Using _itoa_word instead of sprintf.
+
+ * stdlib/canonicalize.c: Avoid unnecessary copying. Handle NULL
+ and "" arguments correctly according to SUS.
+ * stdlib/test-canon.c: Test "" and NULL argument handling.
+
+ * sysdeps/posix/writev.c: Correct condition to leave the loop.
+
+1997-11-05 18:13 Ulrich Drepper <drepper@cygnus.com>
+
+ * nss/getXXbyYY.c: Set buffer to NULL if realloc fails so that possible
+ next call starts with malloc again.
+ Proposed by Joe Keane <jgk@jgk.org>.
+
+1997-11-04 23:57 Ulrich Drepper <drepper@cygnus.com>
+
+ * configure.in: Correct gcc -pipe test.
+ Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
+
+ * posix/glob.c: Cleanups. Patch by H.J. Lu <hjl@lucon.org>.
+
+1997-11-04 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * manual/creature.texi (Feature Test Macros): Add _POSIX_C_SOURCE
+ definition.
+
1997-11-04 Ulrich Drepper <drepper@cygnus.com>
* manual/filesys.texi: Correct description of return value for
more->num_entries = 0; /* Mark MORE's fields as invalid. */
}
else
- /* append the entries in MORE to those in HOL, taking care to only add
+ /* Append the entries in MORE to those in HOL, taking care to only add
non-shadowed SHORT_OPTIONS values. */
{
unsigned left;
char *short_options =
malloc (hol_so_len + strlen (more->short_options) + 1);
- memcpy (entries, hol->entries,
- hol->num_entries * sizeof (struct hol_entry));
- memcpy (entries + hol->num_entries, more->entries,
- more->num_entries * sizeof (struct hol_entry));
+ __mempcpy (__mempcpy (entries, hol->entries,
+ hol->num_entries * sizeof (struct hol_entry)),
+ more->entries,
+ more->num_entries * sizeof (struct hol_entry));
- memcpy (short_options, hol->short_options, hol_so_len);
+ __mempcpy (short_options, hol->short_options, hol_so_len);
/* Fix up the short options pointers from HOL. */
for (e = entries, left = hol->num_entries; left > 0; e++, left--)
#define _SC_NL_TEXTMAX _SC_NL_TEXTMAX
};
-#if (defined __USE_POSIX2 || defined __USE_FILE_OFFSET64 \
- || defined __USE_LARGEFILE64 || defined __USE_LARGEFILE)
+#if (defined __USE_POSIX2 || defined __USE_UNIX98 \
+ || defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \
+ || defined __USE_LARGEFILE)
/* Values for the NAME argument to `confstr'. */
enum
{
# define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS
_CS_LFS64_LIBS,
# define _CS_LFS64_LIBS _CS_LFS64_LIBS
- _CS_LFS64_LINTFLAGS
+ _CS_LFS64_LINTFLAGS,
# define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS
#endif
+
+#ifdef __USE_UNIX98
+ _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
+# define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS
+ _CS_XBS5_ILP32_OFF32_LDFLAGS,
+# define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS
+ _CS_XBS5_ILP32_OFF32_LIBS,
+# define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS
+ _CS_XBS5_ILP32_OFF32_LINTFLAGS,
+# define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS
+ _CS_XBS5_ILP32_OFFBIG_CFLAGS,
+# define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS
+ _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
+# define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS
+ _CS_XBS5_ILP32_OFFBIG_LIBS,
+# define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS
+ _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
+# define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
+ _CS_XBS5_LP64_OFF64_CFLAGS,
+# define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS
+ _CS_XBS5_LP64_OFF64_LDFLAGS,
+# define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS
+ _CS_XBS5_LP64_OFF64_LIBS,
+# define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS
+ _CS_XBS5_LP64_OFF64_LINTFLAGS,
+# define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
+# define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
+# define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_LIBS,
+# define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS
+ _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
+# define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
+#endif
};
#endif
if eval "test \"`echo '$''{'libc_cv_gcc_pipe_bug'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- cat >conftest.s <<EOF
-foo:
+ cp /dev/null conftest.s
+ cat >conftest1.s <<EOF
+.nosuchdirective
EOF
- if ${CC-cc} -pipe -c conftest.s <conftest.s 2>/dev/null; then
+ if ${CC-cc} -pipe -c conftest.s <conftest1.s 2>/dev/null; then
libc_cv_gcc_pipe_bug=no
else
libc_cv_gcc_pipe_bug=yes
fi
echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:1854: checking for assembler global-symbol directive" >&5
+echo "configure:1855: checking for assembler global-symbol directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1884: checking for .set assembler directive" >&5
+echo "configure:1885: checking for .set assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:1918: checking for .symver assembler directive" >&5
+echo "configure:1919: checking for .symver assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6
echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6
-echo "configure:1937: checking for ld --version-script" >&5
+echo "configure:1938: checking for ld --version-script" >&5
if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if { ac_try='${CC-cc} $CFLAGS -shared -o conftest.so conftest.o
-nostartfiles -nostdlib
-Wl,--version-script,conftest.map
- 1>&5'; { (eval echo configure:1956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+ 1>&5'; { (eval echo configure:1957: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
then
libc_cv_ld_version_script_option=yes
else
if test $elf = yes; then
echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:1987: checking for .previous assembler directive" >&5
+echo "configure:1988: checking for .previous assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
.section foo_section
.previous
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1995: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_previous_directive=yes
else
libc_cv_asm_previous_directive=no
else
echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:2011: checking for .popsection assembler directive" >&5
+echo "configure:2012: checking for .popsection assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
.pushsection foo_section
.popsection
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2019: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_popsection_directive=yes
else
libc_cv_asm_popsection_directive=no
if test $elf != yes; then
echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:2039: checking for .init and .fini sections" >&5
+echo "configure:2040: checking for .init and .fini sections" >&5
if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2044 "configure"
+#line 2045 "configure"
#include "confdefs.h"
int main() {
asm (".text");
; return 0; }
EOF
-if { (eval echo configure:2053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_have_initfini=yes
else
else
if test $ac_cv_prog_cc_works = yes; then
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:2081: checking for _ prefix on C symbol names" >&5
+echo "configure:2082: checking for _ prefix on C symbol names" >&5
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2086 "configure"
+#line 2087 "configure"
#include "confdefs.h"
asm ("_glibc_foobar:");
int main() {
glibc_foobar ();
; return 0; }
EOF
-if { (eval echo configure:2093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
libc_cv_asm_underscores=yes
else
echo "$ac_t""$libc_cv_asm_underscores" 1>&6
else
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:2108: checking for _ prefix on C symbol names" >&5
+echo "configure:2109: checking for _ prefix on C symbol names" >&5
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2113 "configure"
+#line 2114 "configure"
#include "confdefs.h"
void underscore_test(void) {
return; }
EOF
-if { (eval echo configure:2118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if grep _underscore_test conftest* >/dev/null; then
rm -f conftest*
libc_cv_asm_underscores=yes
libc_cv_asm_weakext_directive=no
else
echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:2151: checking for assembler .weak directive" >&5
+echo "configure:2152: checking for assembler .weak directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test $libc_cv_asm_weak_directive = no; then
echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:2174: checking for assembler .weakext directive" >&5
+echo "configure:2175: checking for assembler .weakext directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:2211: checking for ld --no-whole-archive" >&5
+echo "configure:2212: checking for ld --no-whole-archive" >&5
if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -Wl,--no-whole-archive
- -o conftest conftest.c 1>&5'; { (eval echo configure:2222: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c 1>&5'; { (eval echo configure:2223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_ld_no_whole_archive=yes
else
libc_cv_ld_no_whole_archive=no
echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:2233: checking for gcc -fno-exceptions" >&5
+echo "configure:2234: checking for gcc -fno-exceptions" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -fno-exceptions
- -o conftest conftest.c 1>&5'; { (eval echo configure:2244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c 1>&5'; { (eval echo configure:2245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_no_exceptions=yes
else
libc_cv_gcc_no_exceptions=no
echo "$ac_t""$libc_cv_gcc_no_exceptions" 1>&6
echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6
-echo "configure:2255: checking for DWARF2 unwind info support" >&5
+echo "configure:2256: checking for DWARF2 unwind info support" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_dwarf2_unwind_info'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
-#line 2260 "configure"
+#line 2261 "configure"
static char __EH_FRAME_BEGIN__;
_start ()
{
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles
- -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2281: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_dwarf2_unwind_info=yes
else
libc_cv_gcc_dwarf2_unwind_info=no
fi
echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:2339: checking OS release for uname" >&5
+echo "configure:2340: checking OS release for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
uname_release="$libc_cv_uname_release"
echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:2361: checking OS version for uname" >&5
+echo "configure:2362: checking OS version for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:2383: checking stdio selection" >&5
+echo "configure:2384: checking stdio selection" >&5
case $stdio in
libio) cat >> confdefs.h <<\EOF
echo "$ac_t""$stdio" 1>&6
echo $ac_n "checking ldap selection""... $ac_c" 1>&6
-echo "configure:2395: checking ldap selection" >&5
+echo "configure:2396: checking ldap selection" >&5
case $add_ons in
*ldap*)
# We must check this even if -pipe is not given here, because the user
# might do `make CFLAGS=-pipe'.
AC_CACHE_CHECK(for gcc 2.7.x -pipe bug, libc_cv_gcc_pipe_bug, [dnl
- cat >conftest.s <<EOF
-foo:
+ cp /dev/null conftest.s
+ cat >conftest1.s <<EOF
+.nosuchdirective
EOF
- if ${CC-cc} -pipe -c conftest.s <conftest.s 2>/dev/null; then
+ if ${CC-cc} -pipe -c conftest.s <conftest1.s 2>/dev/null; then
libc_cv_gcc_pipe_bug=no
else
libc_cv_gcc_pipe_bug=yes
if (tmp == NULL)
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
- memcpy (tmp, cp, len);
- memcpy (tmp + len, _dl_platform, _dl_platformlen);
- tmp[len + _dl_platformlen] = '/';
- tmp[len + _dl_platformlen + 1] = '\0';
-
dirp->dirname = tmp;
+ tmp = __mempcpy (tmp, cp, len);
+ tmp = __mempcpy (tmp, _dl_platform, _dl_platformlen);
+ *tmp++ = '/';
+ *tmp = '\0';
+
dirp->machdirstatus = dirp->dirstatus;
if (max_dirnamelen < dirp->machdirnamelen)
if (tmp == NULL)
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
- memcpy (tmp, cp, len);
- tmp[len] = '\0';
+ dirp->dirname = tmp;
+ *((char *) __mempcpy (tmp, cp, len)) = '\0';
if (max_dirnamelen < dirp->dirnamelen)
max_dirnamelen = dirp->dirnamelen;
-
- dirp->dirname = tmp;
}
dirp->next = all_dirs;
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
- memcpy (tmp, relem->dirname, relem->dirnamelen);
- memcpy (tmp + relem->dirnamelen, _dl_platform, _dl_platformlen);
- tmp[relem->dirnamelen + _dl_platformlen] = '/';
- tmp[relem->dirnamelen + _dl_platformlen + 1] = '\0';
-
relem->dirname = tmp;
+ tmp = __mempcpy (tmp, relem->dirname, relem->dirnamelen);
+ tmp = __mempcpy (tmp, _dl_platform, _dl_platformlen);
+ *tmp++ = '/';
+ *tmp = '\0';
relem->machdirstatus = unknown;
if (this_dir->machdirstatus != nonexisting)
{
/* Construct the pathname to try. */
- (void) memcpy (buf, this_dir->dirname, this_dir->machdirnamelen);
- (void) memcpy (buf + this_dir->machdirnamelen, name, namelen);
- buflen = this_dir->machdirnamelen + namelen;
+ buflen = ((char *) __mempcpy (__mempcpy (buf, this_dir->dirname,
+ this_dir->machdirnamelen),
+ name, namelen)
+ - buf);
fd = __open (buf, O_RDONLY);
if (this_dir->machdirstatus == unknown)
if (fd == -1 && this_dir->dirstatus != nonexisting)
{
/* Construct the pathname to try. */
- (void) memcpy (buf, this_dir->dirname, this_dir->dirnamelen);
- (void) memcpy (buf + this_dir->dirnamelen, name, namelen);
- buflen = this_dir->dirnamelen + namelen;
+ buflen = ((char *) __mempcpy (__mempcpy (buf, this_dir->dirname,
+ this_dir->dirnamelen),
+ name, namelen)
+ - buf);
fd = __open (buf, O_RDONLY);
if (this_dir->dirstatus == unknown)
/* We could find no value for a strong reference. */
const size_t len = strlen (undef_name);
char buf[sizeof undefined_msg + len];
- memcpy (buf, undefined_msg, sizeof undefined_msg - 1);
- memcpy (&buf[sizeof undefined_msg - 1], undef_name, len + 1);
+ __mempcpy (__mempcpy (buf, undefined_msg, sizeof undefined_msg - 1),
+ undef_name, len + 1);
_dl_signal_error (0, reference_name, buf);
}
fd = __open (filename, O_RDWR | O_CREAT, 0666);
if (fd == -1)
{
- /* We cannot write the profiling data so don't do anthing. */
+ /* We cannot write the profiling data so don't do anything. */
char buf[400];
_dl_sysdep_message (filename, ": cannot open file: ",
_strerror_internal (errno, buf, sizeof buf),
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
#include <netinet/if_ether.h>
#include <string.h>
-#include "../nss/nsswitch.h"
+#include <nss/nsswitch.h>
/* Because the `ethers' lookup does not fit so well in the scheme so
we define a dummy struct here which helps us to use the available
#define HANDLE_DIGITS_DOTS 1
-#include "../nss/getXXbyYY.c"
+#include <nss/getXXbyYY.c>
dirlen = strlen (pwd->pw_dir);
pbuf = alloca (dirlen + sizeof "/.rhosts");
- memcpy (pbuf, pwd->pw_dir, dirlen);
- memcpy (pbuf + dirlen, "/.rhosts", sizeof "/.rhosts");
+ __mempcpy (__mempcpy (pbuf, pwd->pw_dir, dirlen),
+ "/.rhosts", sizeof "/.rhosts");
/*
* Change effective uid while opening .rhosts. If root and
static char tokval[100];
static struct toktab {
- char *tokstr;
+ const char *tokstr;
int tval;
} toktab[]= {
{ "default", DEFAULT },
buf = alloca (strlen (hdir) + 8);
- (void) sprintf(buf, "%s/.netrc", hdir);
+ __stpcpy (__stpcpy (buf, hdir), "/.netrc");
cfile = fopen(buf, "r");
if (cfile == NULL) {
if (errno != ENOENT)
buf = newp;
}
- memcpy (buf + actsize, d->d_name, this_len);
- actsize += this_len;
- buf[actsize++] = '\0';
+ *((char *) __mempcpy (buf + actsize, d->d_name, this_len))
+ = '\0';
+ actsize += this_len + 1;
}
/* Terminate the list with an additional NUL byte. */
data->dirbuf = newp;
}
- memcpy (data->dirbuf + data->ftw.base, name, namlen);
- data->dirbuf[data->ftw.base + namlen] = '\0';
+ *((char *) __mempcpy (data->dirbuf + data->ftw.base, name, namlen)) = '\0';
if (((data->flags & FTW_PHYS)
? LXSTAT (_STAT_VER, data->dirbuf, &st)
count = to_do;
if (count > 20)
{
+#ifdef _LIBC
+ f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
+#else
memcpy (f->_IO_write_ptr, s, count);
+ f->_IO_write_ptr += count;
+#endif
s += count;
}
else
register int i = (int) count;
while (--i >= 0)
*p++ = *s++;
+ f->_IO_write_ptr = p;
}
- f->_IO_write_ptr += count;
to_do -= count;
}
if (to_do + must_flush > 0)
count = more;
if (count > 20)
{
+#ifdef _LIBC
+ s = __mempcpy (s, fp->_IO_read_ptr, count);
+#else
memcpy (s, fp->_IO_read_ptr, count);
s += count;
+#endif
fp->_IO_read_ptr += count;
}
else if (count <= 0)
return EOF; /* FIXME */
if (least_mark < 0)
{
+#ifdef _LIBC
+ __mempcpy (__mempcpy (new_buffer + avail,
+ fp->_IO_save_end + least_mark,
+ -least_mark),
+ fp->_IO_read_base,
+ fp->_IO_read_end - fp->_IO_read_base);
+#else
memcpy (new_buffer + avail,
fp->_IO_save_end + least_mark,
-least_mark);
memcpy (new_buffer + avail - least_mark,
fp->_IO_read_base,
fp->_IO_read_end - fp->_IO_read_base);
+#endif
}
else
memcpy (new_buffer + avail,
count = more;
if (count > 20)
{
+#ifdef _LIBC
+ f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
+#else
memcpy (f->_IO_write_ptr, s, count);
- s += count;
f->_IO_write_ptr += count;
+#endif
+ s += count;
}
else if (count <= 0)
count = 0;
count = more;
if (count > 20)
{
+#ifdef _LIBC
+ s = __mempcpy (s, fp->_IO_read_ptr, count);
+#else
memcpy (s, fp->_IO_read_ptr, count);
s += count;
+#endif
fp->_IO_read_ptr += count;
}
else if (count <= 0)
obstack_blank_fast (obstack, fp->_IO_write_end - fp->_IO_write_ptr);
}
else
- {
- memcpy (fp->_IO_write_ptr, data, n);
- fp->_IO_write_ptr += n;
- }
+ fp->_IO_write_ptr = __mempcpy (fp->_IO_write_ptr, data, n);
return n;
}
JUMP_INIT(seekoff, _IO_old_file_seekoff),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, _IO_old_file_setbuf),
- JUMP_INIT(sync, _IO_file_sync),
+ JUMP_INIT(sync, _IO_old_file_sync),
JUMP_INIT(doallocate, _IO_file_doallocate),
JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_file_write),
+ JUMP_INIT(write, _IO_old_file_write),
JUMP_INIT(seek, _IO_file_seek),
JUMP_INIT(close, _IO_file_close),
JUMP_INIT(stat, _IO_file_stat)
setutent_request *request;
setutent_reply reply;
size_t size;
+ size_t name_len;
- size = sizeof (setutent_request) + strlen (__libc_utmp_file_name) + 1;
+ name_len = strlen (__libc_utmp_file_name) + 1;
+ size = sizeof (setutent_request) + name_len;
request = malloc (size);
if (request == NULL)
request->header.version = UTMPD_VERSION;
request->header.size = size;
request->header.type = UTMPD_REQ_SETUTENT;
- strcpy (request->file, __libc_utmp_file_name);
+ memcpy (request->file, __libc_utmp_file_name, name_len);
reply.header.version = UTMPD_VERSION;
reply.header.size = sizeof (setutent_reply);
updwtmp_request *request;
updwtmp_reply reply;
size_t size;
+ size_t file_len;
- size = sizeof (updwtmp_request) + strlen (file) + 1;
+ file_len = strlen (file) + 1;
+ size = sizeof (updwtmp_request) + file_len;
request = malloc (size);
if (request == NULL)
request->header.size = size;
request->header.type = UTMPD_REQ_UPDWTMP;
memcpy (&request->utmp, utmp, sizeof (struct utmp));
- strcpy (request->file, file);
+ memcpy (request->file, file, file_len);
reply.header.version = UTMPD_VERSION;
reply.header.size = sizeof (updwtmp_reply);
@comment (none)
@comment POSIX.2
+@defvr Macro _POSIX_C_SOURCE
Define this macro to a positive integer to control which POSIX
functionality is made available. The greater the value of this macro,
the more functionality is made available.
node **newstack;
stacksize += 20;
newstack = alloca (sizeof (node *) * stacksize);
- memcpy (newstack, nodestack, sp * sizeof (node *));
- nodestack = newstack;
+ nodestack = memcpy (newstack, nodestack, sp * sizeof (node *));
}
nodestack[sp++] = rootp;
node **newstack;
stacksize += 20;
newstack = alloca (sizeof (node *) * stacksize);
- memcpy (newstack, nodestack, sp * sizeof (node *));
- nodestack = newstack;
+ nodestack = memcpy (newstack, nodestack, sp * sizeof (node *));
}
nodestack[sp++] = parent;
parent = up;
goto done;
}
- strcpy (hostname, name);
- resbuf.h_name = hostname;
+ resbuf.h_name = strcpy (hostname, name);
resbuf.h_aliases = *host_aliases;
(*host_aliases)[0] = NULL;
(*h_addr_ptrs)[0] = (char *) host_addr;
process gets a chance for a normal termination. */
save = errno;
free (buffer);
+ buffer = NULL;
__set_errno (save);
}
buffer = new_buf;
free (new_service);
return result;
}
- memcpy (source, name, line - name);
- source[line - name] = '\0';
+ *((char *) __mempcpy (source, name, line - name)) = '\0';
new_service->name = source;
}
case _CS_LFS_CFLAGS:
/* Signal that we want the new ABI. */
{
- static const char file_offset[] = "-D_FILE_OFFSET_SIZE=64";
+ static const char file_offset[] = "-D_FILE_OFFSET_BITS=64";
string = file_offset;
string_len = sizeof (file_offset);
}
case _CS_LFS64_LINTFLAGS:
case _CS_LFS64_LDFLAGS:
case _CS_LFS64_LIBS:
+
+ case _CS_XBS5_ILP32_OFF32_CFLAGS:
+ case _CS_XBS5_ILP32_OFF32_LDFLAGS:
+ case _CS_XBS5_ILP32_OFF32_LIBS:
+ case _CS_XBS5_ILP32_OFF32_LINTFLAGS:
+ case _CS_XBS5_ILP32_OFFBIG_CFLAGS:
+ case _CS_XBS5_ILP32_OFFBIG_LDFLAGS:
+ case _CS_XBS5_ILP32_OFFBIG_LIBS:
+ case _CS_XBS5_ILP32_OFFBIG_LINTFLAGS:
+ case _CS_XBS5_LP64_OFF64_CFLAGS:
+ case _CS_XBS5_LP64_OFF64_LDFLAGS:
+ case _CS_XBS5_LP64_OFF64_LIBS:
+ case _CS_XBS5_LP64_OFF64_LINTFLAGS:
+ case _CS_XBS5_LPBIG_OFFBIG_CFLAGS:
+ case _CS_XBS5_LPBIG_OFFBIG_LDFLAGS:
+ case _CS_XBS5_LPBIG_OFFBIG_LIBS:
+ case _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS:
/* GNU libc does not require special actions to use LFS functions. */
string = "";
string_len = 1;
else
{
/* Construct the pathname to try. */
- (void) memcpy (name, path, p - path);
- name[p - path] = '/';
- (void) memcpy (&name[(p - path) + 1], file, len);
+ char *tmp = __mempcpy (name, path, p - path);
+ *tmp++ = '/';
+ (void) __mempcpy (tmp, file, len);
}
/* Try to execute this name. If it works, execv will not return. */
nonoption_flags_len = nonoption_flags_max_len = 0;
else
{
- memcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len);
- memset (&new_str[nonoption_flags_max_len], '\0',
- top + 1 - nonoption_flags_max_len);
+ memset (__mempcpy (new_str, __getopt_nonoption_flags,
+ nonoption_flags_max_len),
+ '\0', top + 1 - nonoption_flags_max_len);
nonoption_flags_max_len = top + 1;
__getopt_nonoption_flags = new_str;
}
if (__getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
- {
- memcpy (__getopt_nonoption_flags, orig_str, len);
- memset (&__getopt_nonoption_flags[len], '\0',
- nonoption_flags_max_len - len);
- }
+ memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+ '\0', nonoption_flags_max_len - len);
}
}
nonoption_flags_len = nonoption_flags_max_len;
#endif
/* We know the prefix for all sub-patterns. */
+#ifdef HAVE_MEMPCPY
+ alt_start = mempcpy (onealt, pattern, begin - pattern);
+#else
memcpy (onealt, pattern, begin - pattern);
alt_start = &onealt[begin - pattern];
+#endif
/* Find the first sub-pattern and at the same time find the
rest after the closing brace. */
char *name;
};
struct globlink *names = NULL;
- size_t nfound = 0;
-
- if (!__glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE)))
+ size_t nfound;
+ int meta;
+ int save;
+
+ stream = ((flags & GLOB_ALTDIRFUNC) ?
+ (*pglob->gl_opendir) (directory) :
+ (__ptr_t) opendir (directory));
+ if (stream == NULL)
{
- /* We must check whether the file in this directory exists. */
- stream = ((flags & GLOB_ALTDIRFUNC) ?
- (*pglob->gl_opendir) (directory) :
- (__ptr_t) opendir (directory));
- if (stream == NULL)
- {
- if ((errfunc != NULL && (*errfunc) (directory, errno)) ||
- (flags & GLOB_ERR))
- return GLOB_ABORTED;
- }
- else if (pattern[0] == '\0')
- {
- /* This is a special case for matching directories like in
- "*a/". */
- names = (struct globlink *) __alloca (sizeof (struct globlink));
- names->name = (char *) malloc (1);
- if (names->name == NULL)
- goto memory_error;
- names->name[0] = '\0';
- names->next = NULL;
- nfound = 1;
- }
- else
- while (1)
- {
- struct dirent *d = ((flags & GLOB_ALTDIRFUNC) ?
- (*pglob->gl_readdir) (stream) :
- readdir ((DIR *) stream));
- if (d == NULL)
- break;
- if (! REAL_DIR_ENTRY (d))
- continue;
-
-#ifdef HAVE_D_TYPE
- /* If we shall match only directories use the information
- provided by the dirent if possible. */
- if ((flags & GLOB_ONLYDIR)
- && d->d_type != DT_UNKNOWN && d->d_type != DT_DIR)
- continue;
-#endif
-
- if (strcmp (pattern, d->d_name) == 0)
- {
- size_t len = NAMLEN (d);
- names =
- (struct globlink *) __alloca (sizeof (struct globlink));
- names->name = (char *) malloc (len + 1);
- if (names->name == NULL)
- goto memory_error;
-#ifdef HAVE_MEMPCPY
- *((char *) mempcpy ((__ptr_t) names->name, pattern, len))
- = '\0';
-#else
- memcpy ((__ptr_t) names->name, pattern, len);
- names->name[len] = '\0';
-#endif
- names->next = NULL;
- nfound = 1;
- break;
- }
- }
+ if ((errfunc != NULL && (*errfunc) (directory, errno)) ||
+ (flags & GLOB_ERR))
+ return GLOB_ABORTED;
+ nfound = 0;
+ meta = 0;
+ }
+ else if (pattern[0] == '\0')
+ {
+ /* This is a special case for matching directories like in
+ "*a/". */
+ names = (struct globlink *) __alloca (sizeof (struct globlink));
+ names->name = (char *) malloc (1);
+ if (names->name == NULL)
+ goto memory_error;
+ names->name[0] = '\0';
+ names->next = NULL;
+ nfound = 1;
+ meta = 0;
}
else
{
- flags |= GLOB_MAGCHAR;
+ nfound = 0;
+ meta = __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE));
+ if(meta)
+ flags |= GLOB_MAGCHAR;
- stream = ((flags & GLOB_ALTDIRFUNC) ?
- (*pglob->gl_opendir) (directory) :
- (__ptr_t) opendir (directory));
- if (stream == NULL)
+ while (1)
{
- if ((errfunc != NULL && (*errfunc) (directory, errno)) ||
- (flags & GLOB_ERR))
- return GLOB_ABORTED;
- }
- else
- while (1)
- {
- const char *name;
- size_t len;
- struct dirent *d = ((flags & GLOB_ALTDIRFUNC) ?
- (*pglob->gl_readdir) (stream) :
- readdir ((DIR *) stream));
- if (d == NULL)
- break;
- if (! REAL_DIR_ENTRY (d))
- continue;
-
- name = d->d_name;
+ const char *name;
+ size_t len;
+ struct dirent *d = ((flags & GLOB_ALTDIRFUNC) ?
+ (*pglob->gl_readdir) (stream) :
+ readdir ((DIR *) stream));
+ if (d == NULL)
+ break;
+ if (! REAL_DIR_ENTRY (d))
+ continue;
#ifdef HAVE_D_TYPE
- /* If we shall match only directories use the information
- provided by the dirent if possible. */
- if ((flags & GLOB_ONLYDIR)
- && d->d_type != DT_UNKNOWN && d->d_type != DT_DIR)
- continue;
+ /* If we shall match only directories use the information
+ provided by the dirent call if possible. */
+ if ((flags & GLOB_ONLYDIR)
+ && d->d_type != DT_UNKNOWN && d->d_type != DT_DIR)
+ continue;
#endif
- if (fnmatch (pattern, name,
- (!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) |
- ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
+ name = d->d_name;
+
+ if ((!meta && strcmp (pattern, name) == 0)
+ || fnmatch (pattern, name,
+ (!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) |
+ ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
#ifdef _AMIGA
- | FNM_CASEFOLD
+ | FNM_CASEFOLD
#endif
) == 0)
- {
- struct globlink *new
- = (struct globlink *) __alloca (sizeof (struct globlink));
- len = NAMLEN (d);
- new->name
- = (char *) malloc (len + 1);
- if (new->name == NULL)
- goto memory_error;
+ {
+ struct globlink *new
+ = (struct globlink *) __alloca (sizeof (struct globlink));
+ len = NAMLEN (d);
+ new->name = (char *) malloc (len + 1);
+ if (new->name == NULL)
+ goto memory_error;
#ifdef HAVE_MEMPCPY
- *((char *) mempcpy ((__ptr_t) new->name, name, len)) = '\0';
+ *((char *) mempcpy ((__ptr_t) new->name, name, len)) = '\0';
#else
- memcpy ((__ptr_t) new->name, name, len);
- new->name[len] = '\0';
+ memcpy ((__ptr_t) new->name, name, len);
+ new->name[len] = '\0';
#endif
- new->next = names;
- names = new;
- ++nfound;
- }
- }
+ new->next = names;
+ names = new;
+ ++nfound;
+ if (!meta)
+ break;
+ }
+ }
}
- if (nfound == 0 && (flags & GLOB_NOMAGIC) &&
- ! __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE)))
+ if (nfound == 0 && (flags & GLOB_NOMAGIC) && !meta)
flags |= GLOB_NOCHECK;
if (nfound == 0 && (flags & GLOB_NOCHECK))
pglob->gl_flags = flags;
}
- if (stream != NULL)
- {
- int save = errno;
- if (flags & GLOB_ALTDIRFUNC)
- (*pglob->gl_closedir) (stream);
- else
- closedir ((DIR *) stream);
- __set_errno (save);
- }
+ save = errno;
+ if (flags & GLOB_ALTDIRFUNC)
+ (*pglob->gl_closedir) (stream);
+ else
+ closedir ((DIR *) stream);
+ __set_errno (save);
+
return nfound == 0 ? GLOB_NOMATCH : 0;
memory_error:
version 0.12.
(Implements POSIX draft P1003.2/D11.2, except for some of the
internationalization features.)
-
Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library. Its master source is NOT part of
- the C library, however. The master source lives in /gd/gnu/lib.
-
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
Boston, MA 02111-1307, USA. */
/* AIX requires this to be the first thing in the file. */
-#if defined (_AIX) && !defined (REGEX_MALLOC)
+#if defined _AIX && !defined REGEX_MALLOC
#pragma alloca
#endif
#define _GNU_SOURCE
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
-#if defined(STDC_HEADERS) && !defined(emacs)
-#include <stddef.h>
+#if defined STDC_HEADERS && !defined emacs
+# include <stddef.h>
#else
/* We need this for `regex.h', and perhaps for the Emacs include files. */
-#include <sys/types.h>
+# include <sys/types.h>
#endif
/* For platform which support the ISO C amendement 1 functionality we
#endif
/* This is for other GNU distributions with internationalized messages. */
-#if HAVE_LIBINTL_H || defined (_LIBC)
+#if HAVE_LIBINTL_H || defined _LIBC
# include <libintl.h>
#else
# define gettext(msgid) (msgid)
#ifndef gettext_noop
/* This define is so xgettext can find the internationalizable
strings. */
-#define gettext_noop(String) String
+# define gettext_noop(String) String
#endif
/* The `emacs' switch turns on certain matching commands
that make sense only in Emacs. */
#ifdef emacs
-#include "lisp.h"
-#include "buffer.h"
-#include "syntax.h"
+# include "lisp.h"
+# include "buffer.h"
+# include "syntax.h"
#else /* not emacs */
/* If we are not linking with Emacs proper,
we can't use the relocating allocator
even if config.h says that we can. */
-#undef REL_ALLOC
+# undef REL_ALLOC
-#if defined (STDC_HEADERS) || defined (_LIBC)
-#include <stdlib.h>
-#else
+# if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+# else
char *malloc ();
char *realloc ();
-#endif
+# endif
/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
If nothing else has been done, use the method below. */
-#ifdef INHIBIT_STRING_HEADER
-#if !(defined (HAVE_BZERO) && defined (HAVE_BCOPY))
-#if !defined (bzero) && !defined (bcopy)
-#undef INHIBIT_STRING_HEADER
-#endif
-#endif
-#endif
+# ifdef INHIBIT_STRING_HEADER
+# if !(defined HAVE_BZERO && defined HAVE_BCOPY)
+# if !defined bzero && !defined bcopy
+# undef INHIBIT_STRING_HEADER
+# endif
+# endif
+# endif
/* This is the normal way of making sure we have a bcopy and a bzero.
This is used in most programs--a few other programs avoid this
by defining INHIBIT_STRING_HEADER. */
-#ifndef INHIBIT_STRING_HEADER
-#if defined (HAVE_STRING_H) || defined (STDC_HEADERS) || defined (_LIBC)
-#include <string.h>
-#ifndef bcmp
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#endif
-#ifndef bcopy
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-#ifndef bzero
-#define bzero(s, n) memset ((s), 0, (n))
-#endif
-#else
-#include <strings.h>
-#endif
-#endif
+# ifndef INHIBIT_STRING_HEADER
+# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
+# include <string.h>
+# if !defined bzero && !defined _LIBC
+# define bzero(s, n) (memset (s, '\0', n), (s))
+# endif
+# else
+# include <strings.h>
+# ifndef memcmp
+# define memcmp(s1, s2, n) bcmp (s1, s2, n)
+# endif
+# ifndef memcpy
+# define memcpy(d, s, n) (bcopy (s, d, n), (d))
+# endif
+# endif
+# endif
/* Define the syntax stuff for \<, \>, etc. */
/* This must be nonzero for the wordchar and notwordchar pattern
commands in re_match_2. */
-#ifndef Sword
-#define Sword 1
-#endif
+# ifndef Sword
+# define Sword 1
+# endif
-#ifdef SWITCH_ENUM_BUG
-#define SWITCH_ENUM_CAST(x) ((int)(x))
-#else
-#define SWITCH_ENUM_CAST(x) (x)
-#endif
+# ifdef SWITCH_ENUM_BUG
+# define SWITCH_ENUM_CAST(x) ((int)(x))
+# else
+# define SWITCH_ENUM_CAST(x) (x)
+# endif
/* How many characters in the character set. */
-#define CHAR_SET_SIZE 256
+# define CHAR_SET_SIZE 256
-#ifdef SYNTAX_TABLE
+# ifdef SYNTAX_TABLE
extern char *re_syntax_table;
-#else /* not SYNTAX_TABLE */
+# else /* not SYNTAX_TABLE */
static char re_syntax_table[CHAR_SET_SIZE];
done = 1;
}
-#endif /* not SYNTAX_TABLE */
+# endif /* not SYNTAX_TABLE */
-#define SYNTAX(c) re_syntax_table[c]
+# define SYNTAX(c) re_syntax_table[c]
#endif /* not emacs */
\f
Defining isascii to 1 should let any compiler worth its salt
eliminate the && through constant folding." */
-#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
-#define ISASCII(c) 1
+#if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
+# define ISASCII(c) 1
#else
-#define ISASCII(c) isascii(c)
+# define ISASCII(c) isascii(c)
#endif
#ifdef isblank
-#define ISBLANK(c) (ISASCII (c) && isblank (c))
+# define ISBLANK(c) (ISASCII (c) && isblank (c))
#else
-#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
+# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
-#define ISGRAPH(c) (ISASCII (c) && isgraph (c))
+# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
#else
-#define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
+# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
#endif
#define ISPRINT(c) (ISASCII (c) && isprint (c))
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
#ifndef NULL
-#define NULL (void *)0
+# define NULL (void *)0
#endif
/* We remove any previous definition of `SIGN_EXTEND_CHAR',
(Per Bothner suggested the basic approach.) */
#undef SIGN_EXTEND_CHAR
#if __STDC__
-#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
+# define SIGN_EXTEND_CHAR(c) ((signed char) (c))
#else /* not __STDC__ */
/* As in Harbison and Steele. */
-#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
+# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
#endif
\f
/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
#ifdef REGEX_MALLOC
-#define REGEX_ALLOCATE malloc
-#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
-#define REGEX_FREE free
+# define REGEX_ALLOCATE malloc
+# define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
+# define REGEX_FREE free
#else /* not REGEX_MALLOC */
/* Emacs already defines alloca, sometimes. */
-#ifndef alloca
+# ifndef alloca
/* Make alloca work the best possible way. */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not __GNUC__ */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* not __GNUC__ or HAVE_ALLOCA_H */
-#if 0 /* It is a bad idea to declare alloca. We always cast the result. */
-#ifndef _AIX /* Already did AIX, up at the top. */
-char *alloca ();
-#endif /* not _AIX */
-#endif
-#endif /* not HAVE_ALLOCA_H */
-#endif /* not __GNUC__ */
+# ifdef __GNUC__
+# define alloca __builtin_alloca
+# else /* not __GNUC__ */
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# endif /* HAVE_ALLOCA_H */
+# endif /* not __GNUC__ */
-#endif /* not alloca */
+# endif /* not alloca */
-#define REGEX_ALLOCATE alloca
+# define REGEX_ALLOCATE alloca
/* Assumes a `char *destination' variable. */
-#define REGEX_REALLOCATE(source, osize, nsize) \
+# define REGEX_REALLOCATE(source, osize, nsize) \
(destination = (char *) alloca (nsize), \
- bcopy (source, destination, osize), \
- destination)
+ memcpy (destination, source, osize))
/* No need to do anything to free, after alloca. */
-#define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
+# define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
#endif /* not REGEX_MALLOC */
/* Define how to allocate the failure stack. */
-#if defined (REL_ALLOC) && defined (REGEX_MALLOC)
+#if defined REL_ALLOC && defined REGEX_MALLOC
-#define REGEX_ALLOCATE_STACK(size) \
+# define REGEX_ALLOCATE_STACK(size) \
r_alloc (&failure_stack_ptr, (size))
-#define REGEX_REALLOCATE_STACK(source, osize, nsize) \
+# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
r_re_alloc (&failure_stack_ptr, (nsize))
-#define REGEX_FREE_STACK(ptr) \
+# define REGEX_FREE_STACK(ptr) \
r_alloc_free (&failure_stack_ptr)
#else /* not using relocating allocator */
-#ifdef REGEX_MALLOC
+# ifdef REGEX_MALLOC
-#define REGEX_ALLOCATE_STACK malloc
-#define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
-#define REGEX_FREE_STACK free
+# define REGEX_ALLOCATE_STACK malloc
+# define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
+# define REGEX_FREE_STACK free
-#else /* not REGEX_MALLOC */
+# else /* not REGEX_MALLOC */
-#define REGEX_ALLOCATE_STACK alloca
+# define REGEX_ALLOCATE_STACK alloca
-#define REGEX_REALLOCATE_STACK(source, osize, nsize) \
+# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
REGEX_REALLOCATE (source, osize, nsize)
/* No need to explicitly free anything. */
-#define REGEX_FREE_STACK(arg)
+# define REGEX_FREE_STACK(arg)
-#endif /* not REGEX_MALLOC */
+# endif /* not REGEX_MALLOC */
#endif /* not using relocating allocator */
*dest += temp << 8;
}
-#ifndef EXTRACT_MACROS /* To debug the macros. */
-#undef EXTRACT_NUMBER
-#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
-#endif /* not EXTRACT_MACROS */
+# ifndef EXTRACT_MACROS /* To debug the macros. */
+# undef EXTRACT_NUMBER
+# define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
+# endif /* not EXTRACT_MACROS */
#endif /* DEBUG */
*source += 2;
}
-#ifndef EXTRACT_MACROS
-#undef EXTRACT_NUMBER_AND_INCR
-#define EXTRACT_NUMBER_AND_INCR(dest, src) \
+# ifndef EXTRACT_MACROS
+# undef EXTRACT_NUMBER_AND_INCR
+# define EXTRACT_NUMBER_AND_INCR(dest, src) \
extract_number_and_incr (&dest, &src)
-#endif /* not EXTRACT_MACROS */
+# endif /* not EXTRACT_MACROS */
#endif /* DEBUG */
\f
#ifdef DEBUG
/* We use standard I/O for debugging. */
-#include <stdio.h>
+# include <stdio.h>
/* It is useful to test things that ``must'' be true when debugging. */
-#include <assert.h>
+# include <assert.h>
static int debug = 0;
-#define DEBUG_STATEMENT(e) e
-#define DEBUG_PRINT1(x) if (debug) printf (x)
-#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
+# define DEBUG_STATEMENT(e) e
+# define DEBUG_PRINT1(x) if (debug) printf (x)
+# define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
+# define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
+# define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
+# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
if (debug) print_partial_compiled_pattern (s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
+# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
if (debug) print_double_string (w, s1, sz1, s2, sz2)
case wordend:
printf ("/wordend");
-#ifdef emacs
+# ifdef emacs
case before_dot:
printf ("/before_dot");
break;
mcnt = *p++;
printf ("/%d", mcnt);
break;
-#endif /* emacs */
+# endif /* emacs */
case wordchar:
printf ("/wordchar");
#else /* not DEBUG */
-#undef assert
-#define assert(e)
+# undef assert
+# define assert(e)
-#define DEBUG_STATEMENT(e)
-#define DEBUG_PRINT1(x)
-#define DEBUG_PRINT2(x1, x2)
-#define DEBUG_PRINT3(x1, x2, x3)
-#define DEBUG_PRINT4(x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
-#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
+# define DEBUG_STATEMENT(e)
+# define DEBUG_PRINT1(x)
+# define DEBUG_PRINT2(x1, x2)
+# define DEBUG_PRINT3(x1, x2, x3)
+# define DEBUG_PRINT4(x1, x2, x3, x4)
+# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
+# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
#endif /* not DEBUG */
\f
/* When using GNU C, we are not REALLY using the C alloca, no matter
what config.h may say. So don't take precautions for it. */
#ifdef __GNUC__
-#undef C_ALLOCA
+# undef C_ALLOCA
#endif
/* The match routines may not allocate if (1) they would do it with malloc
Note that if REL_ALLOC is defined, matching would not use malloc for the
failure stack, but we would still use it for the register vectors;
so REL_ALLOC should not affect this. */
-#if (defined (C_ALLOCA) || defined (REGEX_MALLOC)) && defined (emacs)
-#undef MATCH_MAY_ALLOCATE
+#if (defined C_ALLOCA || defined REGEX_MALLOC) && defined emacs
+# undef MATCH_MAY_ALLOCATE
#endif
\f
when matching. If this number is exceeded, we allocate more
space, so it is not a hard limit. */
#ifndef INIT_FAILURE_ALLOC
-#define INIT_FAILURE_ALLOC 5
+# define INIT_FAILURE_ALLOC 5
#endif
/* Roughly the maximum number of failure points on the stack. Would be
#ifdef INT_IS_16BIT
-#if defined (MATCH_MAY_ALLOCATE)
+# if defined MATCH_MAY_ALLOCATE
/* 4400 was enough to cause a crash on Alpha OSF/1,
whose default stack limit is 2mb. */
long int re_max_failures = 4000;
-#else
+# else
long int re_max_failures = 2000;
-#endif
+# endif
union fail_stack_elt
{
#else /* not INT_IS_16BIT */
-#if defined (MATCH_MAY_ALLOCATE)
+# if defined MATCH_MAY_ALLOCATE
/* 4400 was enough to cause a crash on Alpha OSF/1,
whose default stack limit is 2mb. */
int re_max_failures = 20000;
-#else
+# else
int re_max_failures = 2000;
-#endif
+# endif
union fail_stack_elt
{
Do `return -2' if the alloc fails. */
#ifdef MATCH_MAY_ALLOCATE
-#define INIT_FAIL_STACK() \
+# define INIT_FAIL_STACK() \
do { \
fail_stack.stack = (fail_stack_elt_t *) \
- REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
+ REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
\
if (fail_stack.stack == NULL) \
return -2; \
fail_stack.avail = 0; \
} while (0)
-#define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
+# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
#else
-#define INIT_FAIL_STACK() \
+# define INIT_FAIL_STACK() \
do { \
fail_stack.avail = 0; \
} while (0)
-#define RESET_FAIL_STACK()
+# define RESET_FAIL_STACK()
#endif
/* Used to omit pushing failure point id's when we're not debugging. */
#ifdef DEBUG
-#define DEBUG_PUSH PUSH_FAILURE_INT
-#define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
+# define DEBUG_PUSH PUSH_FAILURE_INT
+# define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
#else
-#define DEBUG_PUSH(item)
-#define DEBUG_POP(item_addr)
+# define DEBUG_PUSH(item)
+# define DEBUG_POP(item_addr)
#endif
/* Individual items aside from the registers. */
#ifdef DEBUG
-#define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
+# define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
#else
-#define NUM_NONREG_ITEMS 4
+# define NUM_NONREG_ITEMS 4
#endif
/* We push at most this many items on the stack. */
string passed to us by the user to an unsigned char that we can use
as an array index (in, e.g., `translate'). */
#ifndef PATFETCH
-#define PATFETCH(c) \
+# define PATFETCH(c) \
do {if (p == pend) return REG_EEND; \
c = (unsigned char) *p++; \
if (translate) c = (unsigned char) translate[c]; \
`char *', to avoid warnings when a string constant is passed. But
when we use a character as a subscript we must make it unsigned. */
#ifndef TRANSLATE
-#define TRANSLATE(d) \
+# define TRANSLATE(d) \
(translate ? (char) translate[(unsigned char) (d)] : (d))
#endif
MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
reallocating to 0 bytes. Such thing is not going to work too well.
You have been warned!! */
-#if defined(_MSC_VER) && !defined(WIN32)
+#if defined _MSC_VER && !defined WIN32
/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
The REALLOC define eliminates a flurry of conversion warnings,
but is not required. */
-#define MAX_BUF_SIZE 65500L
-#define REALLOC(p,s) realloc ((p), (size_t) (s))
+# define MAX_BUF_SIZE 65500L
+# define REALLOC(p,s) realloc ((p), (size_t) (s))
#else
-#define MAX_BUF_SIZE (1L << 16)
-#define REALLOC(p,s) realloc ((p), (s))
+# define MAX_BUF_SIZE (1L << 16)
+# define REALLOC(p,s) realloc ((p), (s))
#endif
/* Extend the buffer by twice its current size via realloc and
/* Always count groups, whether or not bufp->no_sub is set. */
bufp->re_nsub = 0;
-#if !defined (emacs) && !defined (SYNTAX_TABLE)
+#if !defined emacs && !defined SYNTAX_TABLE
/* Initialize the syntax table. */
init_syntax_once ();
#endif
{
fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS);
-#ifdef emacs
+# ifdef emacs
if (! fail_stack.stack)
fail_stack.stack
= (fail_stack_elt_t *) xmalloc (fail_stack.size
= (fail_stack_elt_t *) xrealloc (fail_stack.stack,
(fail_stack.size
* sizeof (fail_stack_elt_t)));
-#else /* not emacs */
+# else /* not emacs */
if (! fail_stack.stack)
fail_stack.stack
= (fail_stack_elt_t *) malloc (fail_stack.size
= (fail_stack_elt_t *) realloc (fail_stack.stack,
(fail_stack.size
* sizeof (fail_stack_elt_t)));
-#endif /* not emacs */
+# endif /* not emacs */
}
regex_grow_registers (num_regs);
val = re_match_2_internal (bufp, string1, size1, string2, size2,
startpos, regs, stop);
#ifndef REGEX_MALLOC
-#ifdef C_ALLOCA
+# ifdef C_ALLOCA
alloca (0);
-#endif
+# endif
#endif
if (val >= 0)
/* Free everything we malloc. */
#ifdef MATCH_MAY_ALLOCATE
-#define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
-#define FREE_VARIABLES() \
+# define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
+# define FREE_VARIABLES() \
do { \
REGEX_FREE_STACK (fail_stack.stack); \
FREE_VAR (regstart); \
FREE_VAR (reg_info_dummy); \
} while (0)
#else
-#define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
+# define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
#endif /* not MATCH_MAY_ALLOCATE */
/* These values must meet several constraints. They must not be valid
{
int result = re_match_2_internal (bufp, NULL, 0, string, size,
pos, regs, size);
-#ifndef REGEX_MALLOC
-#ifdef C_ALLOCA
+# ifndef REGEX_MALLOC
+# ifdef C_ALLOCA
alloca (0);
-#endif
-#endif
+# endif
+# endif
return result;
}
#endif /* not emacs */
int result = re_match_2_internal (bufp, string1, size1, string2, size2,
pos, regs, stop);
#ifndef REGEX_MALLOC
-#ifdef C_ALLOCA
+# ifdef C_ALLOCA
alloca (0);
-#endif
+# endif
#endif
return result;
}
past them. */
if (translate
? bcmp_translate (d, d2, mcnt, translate)
- : bcmp (d, d2, mcnt))
+ : memcmp (d, d2, mcnt))
goto fail;
d += mcnt, d2 += mcnt;
/* Entry points compatible with 4.2 BSD regex library. We don't define
them unless specifically requested. */
-#if defined (_REGEX_RE_COMP) || defined (_LIBC)
+#if defined _REGEX_RE_COMP || defined _LIBC
/* BSD has one and only one pattern buffer. */
static struct re_pattern_buffer re_comp_buf;
{
if (msg_size > errbuf_size)
{
- strncpy (errbuf, msg, errbuf_size - 1);
+#if defined HAVE_MEMPCPY || defined _LIBC
+ *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
+#else
+ memcpy (errbuf, msg, errbuf_size - 1);
errbuf[errbuf_size - 1] = 0;
+#endif
}
else
- strcpy (errbuf, msg);
+ memcpy (errbuf, msg, msg_size);
}
return msg_size;
_XOPEN_SHM Shared memory interface according to XPG4.2.
+ _XBS5_ILP32_OFF32 Implementation provides environment with 32-bit
+ int, long, pointer, and off_t types.
+ _XBS5_ILP32_OFFBIG Implementation provides environment with 32-bit
+ int, long, and pointer and off_t with at least
+ 64 bits.
+ _XBS5_LP64_OFF64 Implementation provides environment with 32-bit
+ int, and 64-bit long, pointer, and off_t types.
+ _XBS5_LPBIG_OFFBIG Implementation provides environment with at
+ least 32 bits int and long, pointer, and off_t
+ with at least 64 bits.
+
If any of these symbols is defined as -1, the corresponding option is not
true for any file. If any is defined as other than -1, the corresponding
option is true for all files. If a symbol is not defined at all, the value
#include <stdio.h>
#include <fnmatch.h>
+#include <stdio-common/_itoa.h>
+
/* Undefine the following line for the production version. */
/* #define NDEBUG 1 */
#include <assert.h>
if (buffer != NULL)
{
- memcpy (&buffer[*actlen], str, len);
+ *((char *) __mempcpy (&buffer[*actlen], str, len)) = '\0';
*actlen += len;
- buffer[*actlen] = '\0';
}
return buffer;
return WRDE_SYNTAX;
case '\n':
- (*offset)++;
+ ++(*offset);
break;
default:
if (*word == NULL)
return WRDE_NOSPACE;
- (*offset)++;
+ ++(*offset);
break;
}
if (ifs && !*ifs)
{
/* No field splitting allowed */
- *word_length = strlen (globbuf.gl_pathv[0]);
- *word = realloc (*word, 1 + *word_length);
+ size_t length = strlen (globbuf.gl_pathv[0]);
+ *word = realloc (*word, length + 1);
if (*word == NULL)
goto no_space;
- strcpy (*word, globbuf.gl_pathv[0]);
+ memcpy (*word, globbuf.gl_pathv[0], length + 1);
+ *word_length = length;
for (match = 1; match < globbuf.gl_pathc && *word != NULL; ++match)
{
*word = NULL;
*word_length = 0;
- matching_word = malloc (1 + strlen (globbuf.gl_pathv[0]));
+ matching_word = __strdup (globbuf.gl_pathv[0]);
if (matching_word == NULL)
goto no_space;
- strcpy (matching_word, globbuf.gl_pathv[0]);
if (w_addword (pwordexp, matching_word) == WRDE_NOSPACE)
goto no_space;
case ')':
if (--paren_depth == 0)
{
- char *result;
+ char result[21]; /* 21 = ceil(log10(2^64)) + 1 */
int numresult = 0;
if (bracket || words[1 + *offset] != ')')
eval_expr (expr, &numresult) != 0)
return WRDE_SYNTAX;
- result = __alloca (100);
- __snprintf (result, 100, "%d", numresult);
- *word = w_addstr (*word, word_length, max_length, result);
+ result[20] = '\0';
+ *word = w_addstr (*word, word_length, max_length,
+ _itoa_word (numresult, &result[20], 10, 0));
free (expr);
return *word ? 0 : WRDE_NOSPACE;
}
case ']':
if (bracket && paren_depth == 1)
{
- char *result;
+ char result[21]; /* 21 = ceil(log10(2^64)) + 1 */
int numresult = 0;
/* Go - evaluate. */
if (*expr && eval_expr (expr, &numresult) != 0)
return WRDE_SYNTAX;
- result = __alloca (100);
- __snprintf (result, 100, "%d", numresult);
- *word = w_addstr (*word, word_length, max_length, result);
+ result[20] = '\0';
+ *word = w_addstr (*word, word_length, max_length,
+ _itoa_word (numresult, &result[20], 10, 0));
free (expr);
return *word ? 0 : WRDE_NOSPACE;
}
if (pid == 0)
{
/* Child */
+ const char *args[4] = { _PATH_BSHELL, "-c", comm, NULL };
+
/* Redirect input and output */
dup2 (fildes[1], 1);
if ((flags & WRDE_SHOWERR) == 0)
close (2);
- execl (_PATH_BSHELL, _PATH_BSHELL, "-c", comm, NULL);
+ __execve (_PATH_BSHELL, (char *const *) args, __environ);
- /* Bad. What now? */
- exit (1);
+ /* Bad. What now? */
+ abort ();
}
/* Parent */
{
if ((buflen = read (fildes[0], buffer, bufsize)) < 1)
{
- if (waitpid (pid, NULL, WNOHANG) == 0)
+ if (__waitpid (pid, NULL, WNOHANG) == 0)
continue;
if ((buflen = read (fildes[0], buffer, bufsize)) < 1)
break;
{
if ((buflen = read (fildes[0], buffer, bufsize)) < 1)
{
- if (waitpid (pid, NULL, WNOHANG) == 0)
+ if (__waitpid (pid, NULL, WNOHANG) == 0)
continue;
if ((read (fildes[0], buffer, bufsize)) < 1)
break;
break;
case '(':
- paren_depth++;
+ ++paren_depth;
default:
comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]);
if (comm == NULL)
#include <arpa/nameser.h>
#include <string.h>
#include <errno.h>
-#include "../conf/portability.h"
+#include <conf/portability.h>
/*
* WARNING: Don't even consider trying to compile this on a system where
#define FALSE(arg) 0
-#include "../nss/nss_files/files-parse.c"
+#include <nss/nss_files/files-parse.c>
LINE_PARSER
(,
STRING_FIELD (result->sp_namp, ISCOLON, 0);
/* Copy existing string so that nothing gets overwritten. */
src = (char *) alloca (rear_ptr - w);
- memcpy (src, w + 1, rear_ptr - w);
- s = &src[rear_ptr - w - 1];
+ s = (char *) __mempcpy (src, w + 1, rear_ptr - w) - 1;
w = rear_ptr;
/* Process all characters in the string. */
long int path_max;
int num_links = 0;
+ if (name == NULL || resolved == NULL)
+ {
+ /* As per Single Unix Specification V2 we must return an error if
+ either parameter is a null pointer. */
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ if (name[0] == '\0')
+ {
+ /* As per Single Unix Specification V2 we must return an error if
+ the name argument points to an empty string. */
+ __set_errno (ENOENT);
+ return NULL;
+ }
+
#ifdef PATH_MAX
path_max = PATH_MAX;
#else
struct stat st;
int n;
- /* skip sequence of multiple path-separators: */
+ /* Skip sequence of multiple path-separators. */
while (*start == '/') ++start;
- /* find end of path component: */
+ /* Find end of path component. */
for (end = start; *end && *end != '/'; ++end);
if (end - start == 0)
break;
else if (strncmp (start, ".", end - start) == 0)
/* nothing */;
- else if (strncmp (start, "..", end - start) == 0) {
- /* back up to previous component, ignore if at root already: */
- if (dest > rpath + 1)
- while ((--dest)[-1] != '/');
- } else
+ else if (strncmp (start, "..", end - start) == 0)
+ {
+ /* Back up to previous component, ignore if at root already. */
+ if (dest > rpath + 1)
+ while ((--dest)[-1] != '/');
+ }
+ else
{
size_t new_size;
return NULL;
}
- memcpy (dest, start, end - start);
- dest += end - start;
+ dest = __mempcpy (dest, start, end - start);
*dest = '\0';
if (__lstat (rpath, &st) < 0)
}
/* Careful here, end may be a pointer into extra_buf... */
- memcpy (&buf[n], end, len + 1);
- strcpy (extra_buf, buf);
+ memmove (&extra_buf[n], end, len + 1);
+ memcpy (extra_buf, buf, n);
name = end = extra_buf;
if (buf[0] == '/')
{
if ((*cmp) (b1, b2) <= 0)
{
- memcpy (tmp, b1, s);
+ tmp = (char *) __mempcpy (tmp, b1, s);
b1 += s;
--n1;
}
else
{
- memcpy (tmp, b2, s);
+ tmp = (char *) __mempcpy (tmp, b2, s);
b2 += s;
--n2;
}
- tmp += s;
}
if (n1 > 0)
memcpy (tmp, b1, n1 * s);
getcwd (cwd, sizeof(buf));
cwd_len = strlen (cwd);
+ errno = 0;
+ if (realpath (NULL, buf) != NULL || errno != EINVAL)
+ {
+ printf ("%s: expected return value NULL and errno set to EINVAL"
+ " for realpath(NULL,...)\n", argv[0]);
+ ++errors;
+ }
+
+ errno = 0;
+ if (realpath ("/", NULL) != NULL || errno != EINVAL)
+ {
+ printf ("%s: expected return value NULL and errno set to EINVAL"
+ " for realpath(...,NULL)\n", argv[0]);
+ ++errors;
+ }
+
+ errno = 0;
+ if (realpath ("", buf) != NULL || errno != ENOENT)
+ {
+ printf ("%s: expected return value NULL and set errno to ENOENT",
+ " for realpath(\"\",...)\n", argv[0]);
+ ++errors;
+ }
+
for (i = 0; i < (int) (sizeof (symlinks) / sizeof (symlinks[0])); ++i)
symlink (symlinks[i].value, symlinks[i].name);
Boston, MA 02111-1307, USA. */
#include <stdlib.h>
+#include <string.h>
#include <argz.h>
/* Append BUF, of length BUF_LEN to *TO, of length *TO_LEN, reallocating and
if (new_to)
{
- memcpy (new_to + *to_len, buf, buf_len);
- new_to[new_len] = '\0';
+ *((char *) __mempcpy (new_to + *to_len, buf, buf_len)) = '\0';
*to = new_to;
*to_len = new_len;
}
cache_ref (sid);
if (cred->adc_namekind == ADN_FULLNAME)
{
+ size_t full_len;
+
cred->adc_fullname.window = window;
cred->adc_nickname = (u_long) sid; /* save nickname */
if (entry->rname != NULL)
{
mem_free (entry->rname, strlen (entry->rname) + 1);
}
- entry->rname = mem_alloc ((u_int) strlen (cred->adc_fullname.name)
- + 1);
+ full_len = strlen (cred->adc_fullname.name) + 1;
+ entry->rname = mem_alloc ((u_int) full_len);
if (entry->rname != NULL)
{
- strcpy (entry->rname, cred->adc_fullname.name);
+ memcpy (entry->rname, cred->adc_fullname.name, full_len);
}
else
{
#define _SC_NL_TEXTMAX _SC_NL_TEXTMAX
};
-#if (defined __USE_POSIX2 || defined __USE_FILE_OFFSET64 \
- || defined __USE_LARGEFILE64 || defined __USE_LARGEFILE)
+#if (defined __USE_POSIX2 || defined __USE_UNIX98 \
+ || defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \
+ || defined __USE_LARGEFILE)
/* Values for the NAME argument to `confstr'. */
enum
{
# define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS
_CS_LFS64_LIBS,
# define _CS_LFS64_LIBS _CS_LFS64_LIBS
- _CS_LFS64_LINTFLAGS
+ _CS_LFS64_LINTFLAGS,
# define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS
#endif
+
+#ifdef __USE_UNIX98
+ _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
+# define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS
+ _CS_XBS5_ILP32_OFF32_LDFLAGS,
+# define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS
+ _CS_XBS5_ILP32_OFF32_LIBS,
+# define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS
+ _CS_XBS5_ILP32_OFF32_LINTFLAGS,
+# define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS
+ _CS_XBS5_ILP32_OFFBIG_CFLAGS,
+# define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS
+ _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
+# define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS
+ _CS_XBS5_ILP32_OFFBIG_LIBS,
+# define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS
+ _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
+# define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
+ _CS_XBS5_LP64_OFF64_CFLAGS,
+# define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS
+ _CS_XBS5_LP64_OFF64_LDFLAGS,
+# define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS
+ _CS_XBS5_LP64_OFF64_LIBS,
+# define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS
+ _CS_XBS5_LP64_OFF64_LINTFLAGS,
+# define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
+# define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
+# define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_LIBS,
+# define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS
+ _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
+# define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
+#endif
};
#endif
-/* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1994, 1995, 1996, 1997 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
{
const char *const name_end = strchr (string, '=');
- if (name_end)
+ if (name_end != NULL)
{
char *name = alloca (name_end - string + 1);
+#ifdef _LIBC
+ *((char *) __mempcpy (name, string, name_end - string)) = '\0';
+#else
memcpy (name, string, name_end - string);
name[name_end - string] = '\0';
+#endif
return setenv (name, name_end + 1, 1);
}
if (__environ == NULL || *ep == NULL)
{
char **new_environ;
+ char *tmp;
+
if (__environ == last_environ && __environ != NULL)
/* We allocated this space; we can extend it. */
new_environ = (char **) realloc (last_environ,
memcpy ((char *) new_environ, (char *) __environ,
size * sizeof (char *));
+#ifdef _LIBC
+ tmp = __mempcpy (new_environ[size], name, namelen);
+ *tmp++ = '=';
+ __mempcpy (tmp, value, vallen);
+#else
memcpy (new_environ[size], name, namelen);
new_environ[size][namelen] = '=';
memcpy (&new_environ[size][namelen + 1], value, vallen);
+#endif
new_environ[size + 1] = NULL;
return -1;
}
*ep = new;
+#ifdef _LIBC
+ *((char *) __mempcpy (*ep, name, namelen)) = '=';
+#else
memcpy (*ep, name, namelen);
(*ep)[namelen] = '=';
+#endif
}
memcpy (&(*ep)[namelen + 1], value, vallen);
}
*/
/* AIX requires this to be the first thing in the file. */
-#if defined (_AIX) && !defined (__GNUC__)
+#if defined _AIX && !defined __GNUC__
#pragma alloca
#endif
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#include <errno.h>
#include <sys/stat.h>
#ifdef STDC_HEADERS
-#include <stddef.h>
+# include <stddef.h>
#endif
-#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
+#if !defined __GNU_LIBRARY__ && !defined STDC_HEADERS
extern int errno;
#endif
#ifndef __set_errno
-#define __set_errno(val) errno = (val)
+# define __set_errno(val) errno = (val)
#endif
#ifndef NULL
-#define NULL 0
+# define NULL 0
#endif
-#if defined (USGr3) && !defined (DIRENT)
-#define DIRENT
+#if defined USGr3 && !defined DIRENT
+# define DIRENT
#endif /* USGr3 */
-#if defined (Xenix) && !defined (SYSNDIR)
-#define SYSNDIR
+#if defined Xenix && !defined SYSNDIR
+# define SYSNDIR
#endif /* Xenix */
-#if defined (POSIX) || defined (DIRENT) || defined (__GNU_LIBRARY__)
-#include <dirent.h>
-#ifndef __GNU_LIBRARY__
-#define D_NAMLEN(d) strlen((d)->d_name)
-#else
-#define HAVE_D_NAMLEN
-#define D_NAMLEN(d) ((d)->d_namlen)
-#endif
+#if defined POSIX || defined DIRENT || defined __GNU_LIBRARY__
+# include <dirent.h>
+# ifndef __GNU_LIBRARY__
+# define D_NAMLEN(d) strlen((d)->d_name)
+# else
+# define HAVE_D_NAMLEN
+# define D_NAMLEN(d) ((d)->d_namlen)
+# endif
#else /* not POSIX or DIRENT */
-#define dirent direct
-#define D_NAMLEN(d) ((d)->d_namlen)
-#define HAVE_D_NAMLEN
-#if defined (USG) && !defined (sgi)
-#if defined (SYSNDIR)
-#include <sys/ndir.h>
-#else /* Not SYSNDIR */
-#include "ndir.h"
-#endif /* SYSNDIR */
-#else /* not USG */
-#include <sys/dir.h>
-#endif /* USG */
+# define dirent direct
+# define D_NAMLEN(d) ((d)->d_namlen)
+# define HAVE_D_NAMLEN
+# if defined USG && !defined sgi
+# if defined SYSNDIR
+# include <sys/ndir.h>
+# else /* Not SYSNDIR */
+# include "ndir.h"
+# endif /* SYSNDIR */
+# else /* not USG */
+# include <sys/dir.h>
+# endif /* USG */
#endif /* POSIX or DIRENT or __GNU_LIBRARY__ */
-#if defined (HAVE_UNISTD_H) || defined (__GNU_LIBRARY__)
-#include <unistd.h>
+#if defined HAVE_UNISTD_H || defined __GNU_LIBRARY__
+# include <unistd.h>
#endif
-#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__) \
- || defined (POSIX))
-#include <stdlib.h>
-#include <string.h>
-#define ANSI_STRING
+#if defined STDC_HEADERS || defined __GNU_LIBRARY__ || defined POSIX
+# include <stdlib.h>
+# include <string.h>
+# define ANSI_STRING
#else /* No standard headers. */
-#ifdef USG
+# ifdef USG
-#include <string.h>
-#ifdef NEED_MEMORY_H
-#include <memory.h>
-#endif
-#define ANSI_STRING
+# include <string.h>
+# ifdef NEED_MEMORY_H
+# include <memory.h>
+# endif
+# define ANSI_STRING
-#else /* Not USG. */
+# else /* Not USG. */
-#ifdef NeXT
+# ifdef NeXT
-#include <string.h>
+# include <string.h>
-#else /* Not NeXT. */
+# else /* Not NeXT. */
-#include <strings.h>
+# include <strings.h>
-#ifndef bcmp
+# ifndef bcmp
extern int bcmp ();
-#endif
-#ifndef bzero
+# endif
+# ifndef bzero
extern void bzero ();
-#endif
-#ifndef bcopy
+# endif
+# ifndef bcopy
extern void bcopy ();
-#endif
+# endif
-#endif /* NeXT. */
+# endif /* NeXT. */
-#endif /* USG. */
+# endif /* USG. */
extern char *malloc (), *realloc ();
extern void free ();
#endif /* Standard headers. */
#ifndef ANSI_STRING
-#define memcpy(d, s, n) bcopy((s), (d), (n))
-#define memmove memcpy
+# define memcpy(d, s, n) bcopy((s), (d), (n))
+# define memmove memcpy
#endif /* Not ANSI_STRING. */
-#if !defined(__alloca) && !defined(__GNU_LIBRARY__)
+#if !defined __alloca && !defined __GNU_LIBRARY__
-#ifdef __GNUC__
-#undef alloca
-#define alloca(n) __builtin_alloca (n)
-#else /* Not GCC. */
-#if defined (sparc) || defined (HAVE_ALLOCA_H)
-#include <alloca.h>
-#else /* Not sparc or HAVE_ALLOCA_H. */
-#ifndef _AIX
+# ifdef __GNUC__
+# undef alloca
+# define alloca(n) __builtin_alloca (n)
+# else /* Not GCC. */
+# if defined sparc || defined HAVE_ALLOCA_H
+# include <alloca.h>
+# else /* Not sparc or HAVE_ALLOCA_H. */
+# ifndef _AIX
extern char *alloca ();
-#endif /* Not _AIX. */
-#endif /* sparc or HAVE_ALLOCA_H. */
-#endif /* GCC. */
+# endif /* Not _AIX. */
+# endif /* sparc or HAVE_ALLOCA_H. */
+# endif /* GCC. */
-#define __alloca alloca
+# define __alloca alloca
#endif
-#if (defined (HAVE_LIMITS_H) || defined (STDC_HEADERS) || \
- defined (__GNU_LIBRARY__))
-#include <limits.h>
+#if defined HAVE_LIMITS_H || defined STDC_HEADERS || defined __GNU_LIBRARY__
+# include <limits.h>
#else
-#include <sys/param.h>
+# include <sys/param.h>
#endif
#ifndef PATH_MAX
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
+# ifdef MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+# else
+# define PATH_MAX 1024
+# endif
#endif
-#if !defined (STDC_HEADERS) && !defined (__GNU_LIBRARY__)
-#undef size_t
-#define size_t unsigned int
+#if !defined STDC_HEADERS && !defined __GNU_LIBRARY__
+# undef size_t
+# define size_t unsigned int
#endif
-#if !__STDC__ && !defined (const)
-#define const
+#if !__STDC__ && !defined const
+# define const
#endif
#ifndef __GNU_LIBRARY__
-#define __lstat stat
+# define __lstat stat
#endif
\f
#ifndef _LIBC
-#define __getcwd getcwd
+# define __getcwd getcwd
#endif
/* Get the pathname of the current working directory, and put it in SIZE
new = malloc (dotsize * 2 + 1);
if (new == NULL)
return NULL;
+#ifdef HAVE_MEMPCPY
+ dotp = mempcpy (new, dots, dotsize);
+#else
memcpy (new, dots, dotsize);
+ dotp = &new[dotsize];
+#endif
}
else
{
new = realloc ((__ptr_t) dotlist, dotsize * 2 + 1);
if (new == NULL)
goto lose;
+ dotp = &new[dotsize];
}
- memcpy (&new[dotsize], new, dotsize);
- dotp = &new[dotsize];
+#ifdef HAVE_MEMPCPY
+ *((char *) mempcpy (dotp, new, dotsize)) = '\0';
+ dotsize *= 2;
+#else
+ memcpy (dotp, new, dotsize);
dotsize *= 2;
new[dotsize] = '\0';
+#endif
dotlist = new;
}
if (mount_point || (ino_t) d->d_ino == thisino)
{
char name[dotlist + dotsize - dotp + 1 + _D_ALLOC_NAMLEN (d)];
+#ifdef HAVE_MEMPCPY
+ char *tmp = mempcpy (name, dotp, dotlist + dotsize - dotp);
+ *tmp++ = '/';
+ strcpy (tmp, d->d_name);
+#else
memcpy (name, dotp, dotlist + dotsize - dotp);
name[dotlist + dotsize - dotp] = '/';
strcpy (&name[dotlist + dotsize - dotp + 1], d->d_name);
+#endif
if (__lstat (name, &st) < 0)
{
int save = errno;
-/* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1993, 1996, 1997 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
(void) closedir (dirstream);
return NULL;
}
- (void) memcpy (name, dev, sizeof (dev) - 1);
- name[sizeof (dev) - 1] = '/';
+ *((char *) __mempcpy (name, dev, sizeof (dev) - 1)) = '/';
}
- (void) memcpy (&name[sizeof (dev)], d->d_name, dlen);
+ (void) __mempcpy (&name[sizeof (dev)], d->d_name, dlen);
if (stat (name, &st) == 0 && st.st_dev == mydev)
{
(void) closedir (dirstream);
#define min(a, b) ((a) > (b) ? (b) : (a))
size_t copy = min (vector[i].iov_len, to_copy);
- (void) memcpy ((void *) bp, (void *) vector[i].iov_base, copy);
+ bp = __mempcpy ((void *) bp, (void *) vector[i].iov_base, copy);
- bp += copy;
to_copy -= copy;
- if (bytes == 0)
+ if (to_copy == 0)
break;
}
} while (dp->d_ino == 0);
if (dp != NULL)
- {
- memcpy (entry, dp, reclen);
- *result = entry;
- }
+ *result = memcpy (entry, dp, reclen);
__libc_lock_unlock (dirp->lock);
size_t len;
{
struct utsname buf;
+ size_t node_len;
if (name == NULL)
{
if (uname (&buf))
return -1;
- if (strlen (buf.nodename) + 1 > len)
+ node_len = strlen (buf.nodename) + 1;
+ if (node_len > len)
{
__set_errno (EINVAL);
return -1;
}
- strcpy (name, buf.nodename);
+ memcpy (name, buf.nodename, node_len);
return 0;
}
# endif
#endif
+#ifdef _LIBC
+# define MEMPCPY(d, s, n) __mempcpy (d, s, n)
+#else
+# ifndef HAVE_MEMPCPY
+# define MEMPCPY(d, s, n) ((void *) ((char *) memcpy (d, s, n) + (n)))
+# endif
+#endif
+
#ifndef __P
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
# define __P(args) args
do \
{ \
int _this = _len > 16 ? 16 : _len; \
- memcpy ((P), spaces, _this); \
- (P) += _this; \
+ (P) = mempcpy ((P), spaces, _this); \
_len -= _this; \
} \
while (_len > 0); \
do \
{ \
int _this = _len > 16 ? 16 : _len; \
- memcpy ((P), zeroes, _this); \
- (P) += _this; \
+ (P) = mempcpy ((P), zeroes, _this); \
_len -= _this; \
} \
while (_len > 0); \
{
const char *tzdir;
unsigned int len, tzdir_len;
- char *new;
+ char *new, *tmp;
tzdir = __secure_getenv ("TZDIR");
if (tzdir == NULL || *tzdir == '\0')
tzdir_len = strlen (tzdir);
len = strlen (file) + 1;
new = (char *) __alloca (tzdir_len + 1 + len);
- memcpy (new, tzdir, tzdir_len);
- new[tzdir_len] = '/';
- memcpy (&new[tzdir_len + 1], file, len);
+ tmp = __mempcpy (new, tzdir, tzdir_len);
+ *tmp++ = '/';
+ __mempcpy (tmp, file, len);
file = new;
}
__use_tzfile = 0;
return;
}
- memcpy (zone_names, std, stdlen);
- memcpy (&zone_names[stdlen], dst, dstlen);
+ __mempcpy (__mempcpy (zone_names, std, stdlen), dst, dstlen);
/* Find the standard and daylight time offsets used by the rule file.
We choose the offsets in the types of each flavor that are
if (new == NULL)
return NULL;
- memcpy (new, (void *) s, len);
-
- return (wchar_t *) new;
+ return (wchar_t *) memcpy (new, (void *) s, len);
}