m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: m4.1 on head, remove more obsolete code


From: Eric Blake
Subject: FYI: m4.1 on head, remove more obsolete code
Date: Tue, 13 Jun 2006 01:10:17 +0000

This is a forward port of the patch to 1.4.x to build m4.1 using
an installed help2man rather than distributing (a rather outdated)
helptoman.pl.  I also shrunk configure some by removing references
to obsolete constructs.

2006-06-12  Eric Blake  <address@hidden>

        * m4/output.c [HAVE_MKTEMP]: Gnulib provides mkstemp, so don't
        bother with mktemp.
        * src/m4.h: Don't declare mktemp.
        * m4/input.c (m4__next_token): Avoid bzero.
        * configure.ac (AC_CHECK_FUNCS): Remove obsolete checks.
        * Makefile.am (doc/m4.1): Depend on installed help2man, rather
        than distributing outdated helptoman.pl.
        * doc/helptoman.pl: Delete.

Index: Makefile.am
===================================================================
RCS file: /sources/m4/m4/Makefile.am,v
retrieving revision 1.25
diff -u -p -r1.25 Makefile.am
--- Makefile.am 5 May 2006 13:39:19 -0000       1.25
+++ Makefile.am 13 Jun 2006 00:42:13 -0000
@@ -243,17 +243,19 @@ ltdl/libltdlc.la:
 ## -------------- ##
 
 info_TEXINFOS  = doc/m4.texinfo
-dist_man_MANS  = $(srcdir)/doc/m4.1
+dist_man_MANS  = doc/m4.1
+MAINTAINERCLEANFILES += $(dist_man_MANS)
 
-$(srcdir)/doc/m4.1: doc/helptoman.pl src/m4$(EXEEXT)
+doc/m4.1: $(srcdir)/configure.ac $(srcdir)/src/main.c
        @if test -f src/m4$(EXEEXT); then \
          echo "Updating the \`man' page \`$@'"; \
-         $(PERL) $(srcdir)/doc/helptoman.pl src/m4$(EXEEXT) > address@hidden; \
+         $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run \
+           help2man -o address@hidden src/m4$(EXEEXT); \
          cmp -s address@hidden $@ || cp address@hidden $@; \
          rm -f address@hidden; \
        else \
          echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
-         echo "         Retry once the program executable will be ready."; \
+         echo "         Retry once the program executable is ready."; \
        fi
 
 ## Disabled for now.  Clashes with earlier definition.
Index: configure.ac
===================================================================
RCS file: /sources/m4/m4/configure.ac,v
retrieving revision 1.45
diff -u -p -r1.45 configure.ac
--- configure.ac        10 Jun 2006 21:23:30 -0000      1.45
+++ configure.ac        13 Jun 2006 00:42:13 -0000
@@ -154,7 +154,7 @@ m4_REGEX
 ## ------------------------ ##
 ## Other external programs. ##
 ## ------------------------ ##
-AC_PATH_PROG(PERL, perl)
+AC_PATH_PROG([PERL], [perl])
 
 
 
@@ -170,7 +170,7 @@ AC_CHECK_SIZEOF([long long int])
 ## C headers required by M4. ##
 ## ------------------------- ##
 AC_CHECK_HEADERS([limits.h])
-AC_CHECK_HEADERS([signal.h sys/signal.h], break)
+AC_CHECK_HEADERS([signal.h sys/signal.h], [break])
 
 if test $ac_cv_header_stdbool_h = yes; then
   INCLUDE_STDBOOL_H='#include <stdbool.h>'
@@ -184,7 +184,7 @@ AC_SUBST([INCLUDE_STDBOOL_H])
 ## --------------------------------- ##
 ## Library functions required by M4. ##
 ## --------------------------------- ##
-AC_CHECK_FUNCS([bzero calloc mktemp strerror tmpfile])
+AC_CHECK_FUNCS([calloc strerror tmpfile])
 
 AM_WITH_DMALLOC
 
Index: m4/input.c
===================================================================
RCS file: /sources/m4/m4/m4/input.c,v
retrieving revision 1.38
diff -u -p -r1.38 input.c
--- m4/input.c  1 May 2005 11:10:05 -0000       1.38
+++ m4/input.c  13 Jun 2006 00:42:13 -0000
@@ -1,5 +1,6 @@
 /* GNU m4 -- A simple macro processor
-   Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -940,7 +941,7 @@ m4__next_token (m4 *context, m4_symbol_v
 
   obstack_1grow (&token_stack, '\0');
 
-  bzero (token, sizeof (m4_symbol_value));
+  memset (token, '\0', sizeof (m4_symbol_value));
 
   m4_set_symbol_value_text (token, obstack_finish (&token_stack));
   VALUE_MAX_ARGS (token)       = -1;
Index: m4/output.c
===================================================================
RCS file: /sources/m4/m4/m4/output.c,v
retrieving revision 1.22
diff -u -p -r1.22 output.c
--- m4/output.c 10 Jun 2006 21:23:30 -0000      1.22
+++ m4/output.c 13 Jun 2006 00:42:13 -0000
@@ -126,87 +126,6 @@ m4_output_exit (void)
   DELETE (diversion_table);
 }
 
-
-#ifdef HAVE_MKTEMP
-#ifndef HAVE_MKSTEMP
-
-/* This implementation of mkstemp(3) does not avoid any races, but its
-   there.  */
-
-#include <fcntl.h>
-
-static int
-mkstemp (const char *tmpl)
-{
-  mktemp (tmpl);
-  return open (tmpl, O_RDWR | O_TRUNC | O_CREAT, 0600);
-}
-
-#endif /* not HAVE_MKSTEMP */
-
-#else /* not HAVE_MKTEMP */
-
-/*
- * Here's a quick implementation of mkstemp() for systems that don't
- * have mktemp() such as QNX 4. Also included is a mktemp() impl. It's
- * vulnerable to races, just like the real thing.
- */
-#include <fcntl.h>
-
-int
-mkstemp (char *tmpl)
-{
-  char *xes;
-  pid_t pid;
-  char uniq;
-  int fd;
-
-  if ((xes = strstr (tmpl, "XXXXXX")) == NULL) {
-    errno = EINVAL;   /* no Xes found */
-    return -1;
-  }
-
-  pid = getpid(); if (pid > 99999) { pid = pid % 100000; }
-  uniq = 'a';
-
-  while (1) {
-    sprintf (xes, "%05ld%d", (long) pid, uniq);
-    fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, 0600);
-    if (fd >= 0) {
-      return fd;      /* got it */
-    }
-
-    /* this will ensure we cover a-zA-Z0-9 before giving up */
-    if (uniq == 'z') {
-      uniq = 'A';
-    } else if (uniq == 'Z') {
-      uniq = '0';
-    } else if (uniq == '9') {
-      errno = EEXIST; /* couldn't find one */
-      return -1;
-    } else {
-      uniq++;
-    }
-  }
-}
-
-char *
-mktemp (char *tmpl)
-{
-  int fd;
-
-  fd = mkstemp (tmpl);
-  if (fd > 0) {
-    close (fd);
-    unlink (tmpl);
-    return tmpl;
-  } else {
-    return NULL;
-  }
-}
-
-#endif /* not HAVE_MKTEMP */
-
 #ifndef HAVE_TMPFILE
 
 /* Implement tmpfile(3) for non-USG systems.  */
Index: src/m4.h
===================================================================
RCS file: /sources/m4/m4/src/m4.h,v
retrieving revision 1.18
diff -u -p -r1.18 m4.h
--- src/m4.h    10 Jun 2006 21:23:30 -0000      1.18
+++ src/m4.h    13 Jun 2006 00:42:13 -0000
@@ -1,5 +1,6 @@
 /* GNU m4 -- A simple macro processor
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 06 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -83,8 +84,6 @@ extern int errno;
 # include <unistd.h>
 #endif
 
-char *mktemp ();
-
 #if HAVE_LOCALE_H
 # include <locale.h>
 #else

reply via email to

[Prev in Thread] Current Thread [Next in Thread]