changeset 5491:06dd936cde16

Merge some stuff in lib-src -------------------- ChangeLog entries follow: -------------------- lib-src/ChangeLog addition: 2010-02-19 Ben Wing <ben@xemacs.org> * digest-doc.c: * digest-doc.c (main): * emacs.csh: * hexl.c: * hexl.c (Gabryelski): * hexl.c (main): * hexl.c (usage): * sorted-doc.c: * sorted-doc.c (fatal): * sorted-doc.c (xstrdup): * sorted-doc.c (main): * vcdiff: Merge up to FSF 23.1.92.
author Ben Wing <ben@xemacs.org>
date Fri, 19 Feb 2010 22:13:17 -0600
parents 422b4b4fb2a6
children e82f5b7010fe
files lib-src/ChangeLog lib-src/digest-doc.c lib-src/emacs.csh lib-src/hexl.c lib-src/sorted-doc.c lib-src/vcdiff
diffstat 6 files changed, 250 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Thu Feb 11 19:33:50 2010 -0500
+++ b/lib-src/ChangeLog	Fri Feb 19 22:13:17 2010 -0600
@@ -1,3 +1,19 @@
+2010-02-19  Ben Wing  <ben@xemacs.org>
+
+	* digest-doc.c:
+	* digest-doc.c (main):
+	* emacs.csh:
+	* hexl.c:
+	* hexl.c (Gabryelski):
+	* hexl.c (main):
+	* hexl.c (usage):
+	* sorted-doc.c:
+	* sorted-doc.c (fatal):
+	* sorted-doc.c (xstrdup):
+	* sorted-doc.c (main):
+	* vcdiff:
+	Merge up to FSF 23.1.92.
+
 2010-02-11  Vin Shelton  <acs@xemacs.org>
  
  	* winclient.c: Bump connection retries to 20 because some people
--- a/lib-src/digest-doc.c	Thu Feb 11 19:33:50 2010 -0500
+++ b/lib-src/digest-doc.c	Fri Feb 19 22:13:17 2010 -0600
@@ -1,21 +1,53 @@
-/* Give this program DOCSTR.mm.nn as standard input
-   and it outputs to standard output
-   a file of nroff output containing the doc strings.
+/* Give this program DOC-mm.nn.oo as standard input and it outputs to
+   standard output a file of nroff output containing the doc strings.
+
+Copyright (C) 1987, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of XEmacs.
+
+XEmacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
-   See also sorted-doc.c, which produces similar output
-   but in texinfo format and sorted by function/variable name.  */
+XEmacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with XEmacs.  If not, see <http://www.gnu.org/licenses/>.
+
+
+See also sorted-doc.c, which produces similar output
+but in texinfo format and sorted by function/variable name.  */
+
+/* Synced up with: GNU 23.1.92. */
+/* Synced by: Ben Wing, 2-17-10. */
 
 #ifdef emacs
 #include <config.h>
 #endif
 #include <stdio.h>
 
+#ifdef WIN32_NATIVE
+#include <fcntl.h>		/* for O_BINARY */
+#include <io.h>			/* for setmode */
+#endif
+
 int
 main (int argc, char **argv)
 {
   register int ch;
   register int notfirst = 0;
 
+#ifdef WIN32_NATIVE
+  /* DOC is a binary file.  */
+  if (!isatty (fileno (stdin)))
+    setmode (fileno (stdin), O_BINARY);
+#endif
+
   printf (".TL\n");
   printf ("Command Summary for XEmacs\n");
   printf (".AU\nThe XEmacs Advocacy Group\n");
@@ -50,3 +82,6 @@
     }
   return 0;
 }
+
+/* arch-tag: 2ba2c9b0-4157-4eba-bd9f-967e3677e35f
+   (do not change this comment) */
--- a/lib-src/emacs.csh	Thu Feb 11 19:33:50 2010 -0500
+++ b/lib-src/emacs.csh	Fri Feb 19 22:13:17 2010 -0600
@@ -1,25 +1,34 @@
-# This defines a csh command named `edit' which resumes an
-# existing Emacs or starts a new one if none exists.
-# One way or another, any arguments are passed to Emacs to specify files
-# (provided you have loaded `resume.el').
-# - Michael DeCorte
+### emacs.csh
+
+## Add legal notice if non-trivial amounts of code are added.
+
+## Author: Michael DeCorte
+
+### Commentary:
+
+# Synced up with: GNU 23.1.92.
+# Synced by: Ben Wing, 2-17-10.
 
-# These are the possible values of $whichjob
-# 1 = new ordinary emacs (the -nw is so that it doesn't try to do X)
-# 2 = resume emacs
-# 3 = new emacs under X (-i is so that you get a reasonable icon)
-# 4 = resume emacs under X
-# 5 = new emacs under suntools
-# 6 = resume emacs under suntools
-# 7 = new emacs under X and suntools - doesn't make any sense, so use X
-# 8 = resume emacs under X and suntools - doesn't make any sense, so use X
+## This file is obsolete.  Use emacsclient -a instead.
+
+## This defines a csh command named `edit' which resumes an
+## existing Emacs or starts a new one if none exists.
+## One way or another, any arguments are passed to Emacs to specify files
+## (provided you have loaded `resume.el').
+
+## These are the possible values of $whichjob
+## 1 = new ordinary emacs (the -nw is so that it doesn't try to do X)
+## 2 = resume emacs
+## 3 = new emacs under X (-i is so that you get a reasonable icon)
+## 4 = resume emacs under X
 set EMACS_PATTERN="^\[[0-9]\]  . Stopped ............ $EMACS"
 
 alias edit 'set emacs_command=("emacs -nw \!*" "fg %emacs" "emacs -i \!* &"\
- "emacsclient \!* &" "emacstool \!* &" "emacsclient \!* &" "emacs -i \!* &"\
  "emacsclient \!* &") ; \
  jobs >! $HOME/.jobs; grep "$EMACS_PATTERN" < $HOME/.jobs >& /dev/null; \
  @ isjob = ! $status; \
  @ whichjob = 1 + $isjob + $?DISPLAY * 2 + $?WINDOW_PARENT * 4; \
  test -S ~/.emacs_server && emacsclient \!* \
  || echo `pwd` \!* >! ~/.emacs_args && eval $emacs_command[$whichjob]'
+
+# arch-tag: 433d58df-15b9-446f-ad37-f0393e3a23d4
--- a/lib-src/hexl.c	Thu Feb 11 19:33:50 2010 -0500
+++ b/lib-src/hexl.c	Fri Feb 19 22:13:17 2010 -0600
@@ -1,6 +1,32 @@
-/* Synched up with: FSF 19.28. */
+/* Convert files for Emacs Hexl mode.
+   Copyright (C) 1989, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+                 2009, 2010  Free Software Foundation, Inc.
+   Copyright (C) 2010 Ben Wing.
+
+Author: Keith Gabryelski
+(according to authors.el)
+
+This file is not considered part of XEmacs.
+
+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
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Synced up with: GNU 23.1.92. */
+/* Synced by: Ben Wing, 2-17-10. */
+
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <stdio.h>
 #include <ctype.h>
@@ -37,25 +63,25 @@
   register long address;
   char string[18];
   FILE *fp;
-  
+
   progname = *argv++; --argc;
-  
+
   /*
-  ** -hex		hex dump
-  ** -oct		Octal dump
-  ** -group-by-8-bits
-  ** -group-by-16-bits
-  ** -group-by-32-bits
-  ** -group-by-64-bits
-  ** -iso		iso character set.
-  ** -big-endian	Big Endian
-  ** -little-endian	Little Endian
-  ** -un || -de	from hexl format to binary.
-  ** --		End switch list.
-  ** <filename>	dump filename
-  ** -		(as filename == stdin)
-  */
-    
+   ** -hex		hex dump
+   ** -oct		Octal dump
+   ** -group-by-8-bits
+   ** -group-by-16-bits
+   ** -group-by-32-bits
+   ** -group-by-64-bits
+   ** -iso		iso character set.
+   ** -big-endian	Big Endian
+   ** -little-endian	Little Endian
+   ** -un || -de	from hexl format to binary.
+   ** --		End switch list.
+   ** <filename>	dump filename
+   ** -		(as filename == stdin)
+   */
+
   while (*argv && *argv[0] == '-' && (*argv)[1])
     {
       /* A switch! */
@@ -117,7 +143,7 @@
 	}
       else
 	{
-	  (void) fprintf (stderr, "%s: invalid switch: \"%s\".\n", progname,
+	  fprintf (stderr, "%s: invalid switch: \"%s\".\n", progname,
 		   *argv);
 	  usage ();
 	}
@@ -145,7 +171,8 @@
 	  char buf[18];
 
 #ifdef WIN32_NATIVE
-	  _setmode (_fileno (stdout), O_BINARY);
+          if (!isatty (_fileno (stdout)))
+	    _setmode (_fileno (stdout), O_BINARY);
 #endif
 	  for (;;)
 	    {
@@ -188,7 +215,8 @@
       else
 	{
 #ifdef WIN32_NATIVE
-	  _setmode (_fileno (fp), O_BINARY);
+          if (!isatty (_fileno (stdout)))
+	    _setmode (_fileno (stdout), O_BINARY);
 #endif
 	  address = 0;
 	  string[0] = ' ';
@@ -210,7 +238,7 @@
 		  else
 		    {
 		      if (!i)
-			(void) printf ("%08lx: ", address);
+			printf ("%08lx: ", address);
 
 		      if (iso_flag)
 			string[i+1] =
@@ -218,7 +246,7 @@
 		      else
 			string[i+1] = (c < 0x20 || c >= 0x7F) ? '.' : c;
 
-		      (void) printf ("%02x", c);
+		      printf ("%02x", c);
 		    }
 
 		  if ((i&group_by) == group_by)
@@ -237,15 +265,20 @@
 	}
 
       if (fp != stdin)
-	(void) fclose (fp);
+	fclose (fp);
 
     } while (*argv != NULL);
-  return 0;
+  return EXIT_SUCCESS;
 }
 
 void
 usage (void)
 {
   fprintf (stderr, "Usage: %s [-de] [-iso]\n", progname);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
+
+/* arch-tag: 20e04fb7-926e-4e48-be86-64fe869ecdaa
+   (do not change this comment) */
+
+/* hexl.c ends here */
--- a/lib-src/sorted-doc.c	Thu Feb 11 19:33:50 2010 -0500
+++ b/lib-src/sorted-doc.c	Fri Feb 19 22:13:17 2010 -0600
@@ -1,19 +1,42 @@
-/* Give this program DOCSTR.mm.nn as standard input
-   and it outputs to standard output
-   a file of texinfo input containing the doc strings.
-   
-   This version sorts the output by function name.
-   */
+/* Give this program DOC-mm.nn.oo as standard input and it outputs to
+   standard output a file of texinfo input containing the doc strings.
+
+Copyright (C) 1989, 1992, 1994, 1996, 1999, 2000, 2001, 2002, 2003,
+              2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
-/* Synched up with: FSF 19.28. */
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* Synced up with: GNU 23.1.92. */
+/* Synced by: Ben Wing, 2-17-10. */
+
+/* This version sorts the output by function name.  */
+
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <stdio.h>
 #include <ctype.h>
 #include <stdlib.h> /* for qsort() and malloc() */
 #include <string.h>
 static void *xmalloc (size_t);
+#ifdef WIN32_NATIVE
+#include <fcntl.h>		/* for O_BINARY */
+#include <io.h>			/* for setmode */
+#endif
 
 #define NUL	'\0'
 #define MARKER '\037'
@@ -55,7 +78,7 @@
 fatal (char *s1, char *s2)
 {
   error (s1, s2);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 /* Like malloc but get fatal error if memory is exhausted.  */
@@ -70,11 +93,11 @@
 }
 
 static char *
-strsav (char *str)
+xstrdup (char *str)
 {
-  char *buf = (char *) xmalloc (strlen (str) + 1);
-  strcpy (buf, str);
-  return buf;
+  char *buf = xmalloc (strlen (str) + 1);
+  (void) strcpy (buf, str);
+  return (buf);
 }
 
 /* Comparison function for qsort to call.  */
@@ -104,13 +127,20 @@
   register DOCSTR *dp = NULL;	/* allocated DOCSTR */
   register LINE *lp = NULL;	/* allocated line */
   register char *bp = 0;	/* ptr inside line buffer */
-  /* int notfirst = 0;		/ * set after read something */
   register enum state state = WAITING; /* state at start */
   int cnt = 0;			/* number of DOCSTRs read */
 
-  DOCSTR *docs = 0;		/* chain of allocated DOCSTRS */
+  DOCSTR *docs = NULL;          /* chain of allocated DOCSTRS */
   char buf[512];		/* line buffer */
-    
+
+#ifdef DOS_NT
+  /* DOC is a binary file.  */
+  if (!isatty (fileno (stdin)))
+    setmode (fileno (stdin), O_BINARY);
+#endif
+
+  bp = buf;
+
   while (1)			/* process one char at a time */
     {
       /* this char from the DOCSTR file */
@@ -158,7 +188,7 @@
 	  bp = buf;
 	  state = DESC_GET;
 	}
-	
+
       /* process gets */
 
       if (state == NAME_GET || state == DESC_GET)
@@ -170,7 +200,7 @@
 	  else			/* saving and changing state */
 	    {
 	      *bp = NUL;
-	      bp = strsav (buf);
+	      bp = xstrdup (buf);
 
 	      if (state == NAME_GET)
 		dp->name = bp;
@@ -205,10 +235,13 @@
     printf ("\\input texinfo  @c -*-texinfo-*-\n");
     printf ("@setfilename ../info/summary\n");
     printf ("@settitle Command Summary for XEmacs\n");
+    printf ("@finalout\n");
     printf ("@unnumbered Command Summary for XEmacs\n");
     printf ("@table @asis\n");
     printf ("\n");
     printf ("@iftex\n");
+    /* #### XEmacs note: FSF 23.1.92 is missing the = sign below.
+       Which is correct? */
     printf ("@global@let@ITEM=@item\n");
     printf ("@def@item{@filbreak@vskip5pt@ITEM}\n");
     printf ("@font@tensy cmsy10 scaled @magstephalf\n");
@@ -246,12 +279,20 @@
 	    putchar ('\n');
 	  }
 	printf("@end display\n");
-	if ( i%200 == 0 && i != 0 ) printf("@end table\n\n@table @asis\n");
+	/* Try to avoid a save size overflow in the TeX output
+           routine.  */
+	if (i%100 == 0 && i > 0 && i != cnt)
+	  printf("\n@end table\n@table @asis\n");
       }
 
     printf ("@end table\n");
     printf ("@bye\n");
   }
 
-  return 0;
+  return EXIT_SUCCESS;
 }
+
+/* arch-tag: ce28f204-1e70-4b34-8210-3d54a5662071
+   (do not change this comment) */
+
+/* sorted-doc.c ends here */
--- a/lib-src/vcdiff	Thu Feb 11 19:33:50 2010 -0500
+++ b/lib-src/vcdiff	Fri Feb 19 22:13:17 2010 -0600
@@ -1,23 +1,43 @@
-#!/bin/sh
-#
+#! /bin/sh
+
 # Enhanced sccs diff utility for use with vc mode.
 # This version is more compatible with rcsdiff(1).
-#
-#	!Id: vcdiff,v 1.4 1993/12/03 09:29:18 eggert Exp !
-#
+
+# Copyright (C) 1992, 1993, 1995, 1997, 2001, 2002, 2003, 2004, 2005,
+#   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+# Author: Paul Eggert
+# (according to authors.el)
+
+# This file is part of XEmacs.
+
+# XEmacs is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# XEmacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with XEmacs.  If not, see <http://www.gnu.org/licenses/>.
+
 # Modified by: vladimir@Eng.Sun.COM on 95-06-07
 # * Made sure that file arguments are specifed as s.<filename>.
-# * Switched the assignments to $f inside the 3rd and 4th case statements of
-#   the first for-loop
-# * Removed the incorrect initialization of sid1 before the first for-loop.
-#
+
+# Synced up with: GNU 23.1.92.
+# Synced by: Ben Wing, 2-17-10.
+
 
 DIFF="diff"
 usage="$0: Usage: vcdiff [--brief] [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..."
 
-PATH=$PATH:/usr/ccs/bin:/usr/sccs # common SCCS hangouts
+# Now that we use `sccs get' rather than just `get', we don't need this.
+# PATH=$PATH:/usr/ccs/bin:/usr/sccs:/usr/xpg4/bin # common SCCS hangouts
 
-echo=
+echo="echo"
 sid1= sid2=
 
 for f
@@ -31,14 +51,14 @@
 			echo=:;;
 		-r?*)
 			case $sid1 in
-			-r*)
-				sid2=$f
+			'')
+				sid1=$f
 				;;
 			*) 
 				case $sid2 in
-				  ?*) echo "$usage" >&2; exit 2 ;;
+				?*) echo "$usage" >&2; exit 2 ;;
 				esac
-				sid1=$f
+				sid2=$f
 				;;
 			esac
 			;;
@@ -67,31 +87,32 @@
 
 for f
 do
-  s=2
-
-  # For files under SCCS control, fixup the file name to be the s. filename
-  if [ -d SCCS ]; then
-    if [ $f = `echo $f | sed -e 's|SCCS/s.||'` ]; then
-      f="SCCS/s.$f"
-    fi
-  fi 
+	s=2
+	
+	# For files under SCCS control, fixup the file name to be the
+	# s. filename
+	if [ -d SCCS ]; then
+		if [ $f = `echo $f | sed -e 's|SCCS/s.||'` ]; then
+			f="SCCS/s.$f"
+		fi
+	fi 
 
 	case $f in
 	s.* | */s.*)
 		if
-			rev1=/tmp/geta$$
-			get -s -p -k $sid1 "$f" > $rev1 &&
+			rev1=`mktemp /tmp/geta.XXXXXXXX`
+			sccs get -s -p -k $sid1 "$f" > $rev1 &&
 			case $sid2 in
 			'')
 				workfile=`expr " /$f" : '.*/s.\(.*\)'`
 				;;
 			*)
-				rev2=/tmp/getb$$
-				get -s -p -k $sid2 "$f" > $rev2
+				rev2=`mktemp /tmp/getb.XXXXXXXX`
+				sccs get -s -p -k $sid2 "$f" > $rev2
 				workfile=$rev2
 			esac
 		then
-			$echo $DIFF $options $sid1 $sid2 $workfile >&2
+			$echo $DIFF $options $rev1 $workfile >&2
 			$DIFF $options $rev1 $workfile
 			s=$?
 		fi
@@ -104,3 +125,5 @@
 	then status=$s
 	fi
 done
+
+# arch-tag: 4344ba3a-bcbe-4f77-971c-f43c1606953a