Playing with autoscan.

* src/reader.c (get_merge_function): Use xstrdup, not strdup.
* src/files.c (skeleton_find): Remove, unused.
* m4/memcmp.m4: New, from the Coreutils 4.5.1.
* m4/prereq.m4 (jm_PREREQ_QUOTEARG): Run jm_FUNC_MEMCMP.
This commit is contained in:
Akim Demaille
2002-09-13 16:12:21 +00:00
parent bd7018115a
commit b906441c95
7 changed files with 29 additions and 63 deletions

View File

@@ -1,3 +1,12 @@
2002-09-13 Akim Demaille <akim@epita.fr>
Playing with autoscan.
* src/reader.c (get_merge_function): Use xstrdup, not strdup.
* src/files.c (skeleton_find): Remove, unused.
* m4/memcmp.m4: New, from the Coreutils 4.5.1.
* m4/prereq.m4 (jm_PREREQ_QUOTEARG): Run jm_FUNC_MEMCMP.
2002-09-13 Akim Demaille <akim@epita.fr> 2002-09-13 Akim Demaille <akim@epita.fr>
* configure.ac (AM_INIT_AUTOMAKE): Require Automake 1.6.3. * configure.ac (AM_INIT_AUTOMAKE): Require Automake 1.6.3.

View File

@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*- ## Process this file with automake to produce Makefile.in -*-Makefile-*-
EXTRA_DIST = \ EXTRA_DIST = \
dmalloc.m4 error.m4 \ dmalloc.m4 error.m4 \
m4.m4 mbrtowc.m4 mkstemp.m4 \ m4.m4 mbrtowc.m4 memcmp.m4 mkstemp.m4 \
prereq.m4 strerror_r.m4 timevar.m4 warning.m4 \ prereq.m4 strerror_r.m4 timevar.m4 warning.m4 \
gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4

9
m4/memcmp.m4 Normal file
View File

@@ -0,0 +1,9 @@
#serial 7
AC_DEFUN([jm_FUNC_MEMCMP],
[AC_REQUIRE([AC_FUNC_MEMCMP])dnl
if test $ac_cv_func_memcmp_working = no; then
AC_DEFINE(memcmp, rpl_memcmp,
[Define to rpl_memcmp if the replacement function should be used.])
fi
])

View File

@@ -1,7 +1,10 @@
#serial 26 #serial 27
dnl These are the prerequisite macros for files in the lib/ dnl We use jm_ for non Autoconf macros.
dnl directories of the fileutils, sh-utils, and textutils packages. m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
# These are the prerequisite macros for files in the lib/
# directories of the coreutils package.
AC_DEFUN([jm_PREREQ], AC_DEFUN([jm_PREREQ],
[ [
@@ -114,6 +117,7 @@ AC_DEFUN([jm_PREREQ_QUOTEARG],
[ [
AC_CHECK_FUNCS(isascii iswprint) AC_CHECK_FUNCS(isascii iswprint)
jm_FUNC_MBRTOWC jm_FUNC_MBRTOWC
jm_FUNC_MEMCMP
AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h) AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
AC_HEADER_STDC AC_HEADER_STDC
AC_C_BACKSLASH_A AC_C_BACKSLASH_A

View File

@@ -134,59 +134,6 @@ xfclose (FILE *ptr)
return result; return result;
} }
/*------------------------------------------------------------------.
| Return the path to the skeleton which locaction might be given in |
| ENVVAR, otherwise return SKELETON_NAME. |
`------------------------------------------------------------------*/
const char *
skeleton_find (const char *envvar, const char *skeleton_name)
{
const char *res = getenv (envvar);
#if defined (MSDOS) || defined (_WIN32)
const char *cp = getenv ("INIT");
if (!res)
{
/* Skeleton file name without path */
const char *skel_name = strrchr (skeleton_name, '/');
if (!skel_name)
skel_name = strrchr (skeleton_name, '\\');
if (!skel_name)
skel_name = skeleton_name;
else
++skel_name;
/* File doesn't exist in current directory; try in INIT directory. */
if (cp)
{
res = XMALLOC (char, strlen (cp) + strlen (skel_name) + 2);
sprintf (res, "%s%c%s", cp, '\\', skel_name);
}
else if (access (skel_name, 4) == 0) /* Look in current dir. */
res = skel_name;
else
{
/* Look in program locations dir. */
extern char *program_name;
cp = strrchr(program_name, '\\');
if (!cp)
return skeleton_name;
else
++cp;
res = XMALLOC (char, cp - program_name + strlen (skel_name) + 1);
strncpy (res, program_name, cp - program_name);
strcpy (res + (cp - program_name), skel_name);
}
}
#endif /* defined (MSDOS) || defined (_WIN32) */
if (!res)
res = skeleton_name;
return res;
}
/*----------------------------------------------------------------. /*----------------------------------------------------------------.

View File

@@ -1,5 +1,5 @@
/* File names and variables for bison, /* File names and variables for bison,
Copyright 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -57,9 +57,6 @@ void compute_output_file_names PARAMS((void));
FILE *xfopen PARAMS ((const char *name, const char *mode)); FILE *xfopen PARAMS ((const char *name, const char *mode));
int xfclose PARAMS ((FILE *ptr)); int xfclose PARAMS ((FILE *ptr));
const char *skeleton_find PARAMS ((const char *envvar,
const char *skeleton_name));
/* Is SUFFIX ending STRING? */ /* Is SUFFIX ending STRING? */
int strsuffix (const char* string, const char* suffix); int strsuffix (const char* string, const char* suffix);

View File

@@ -132,8 +132,8 @@ get_merge_function (const char* name, const char* type,
if (syms->next == NULL) if (syms->next == NULL)
{ {
syms->next = XMALLOC (merger_list, 1); syms->next = XMALLOC (merger_list, 1);
syms->next->name = strdup (name); syms->next->name = xstrdup (name);
syms->next->type = strdup (type); syms->next->type = xstrdup (type);
syms->next->next = NULL; syms->next->next = NULL;
merge_functions = head.next; merge_functions = head.next;
} }