Mercurial > hg > xemacs-beta
changeset 5406:061f4f90f874
Convert lib-src/ to GPLv3.
author | Mike Sperber <sperber@deinprogramm.de> |
---|---|
date | Mon, 18 Oct 2010 14:02:19 +0200 |
parents | 2aa9cd456ae7 |
children | 7ba892d101ce |
files | lib-src/ad2c lib-src/b2m.c lib-src/cvtmail.c lib-src/digest-doc.c lib-src/etags.c lib-src/fakemail.c lib-src/getopt.c lib-src/getopt.h lib-src/getopt1.c lib-src/gnuattach lib-src/gnudoit lib-src/gnuserv.c lib-src/gnuslib.c lib-src/hexl.c lib-src/make-path.c lib-src/ootags.c lib-src/profile.c lib-src/qsort.c lib-src/rcs2log lib-src/sorted-doc.c lib-src/tcp.c lib-src/vcdiff |
diffstat | 22 files changed, 475 insertions(+), 317 deletions(-) [+] |
line wrap: on
line diff
--- a/lib-src/ad2c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/ad2c Mon Oct 18 14:02:19 2010 +0200 @@ -13,21 +13,19 @@ # Escape quotes after escaping backslashes. # # This file is part of XEmacs. -# -# XEmacs is free software; you can redistribute it and/or modify it +# +# 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 2, or (at your option) any -# later version. -# +# 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; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, -# Boston, MA 02110-1301, USA. */ +# along with XEmacs. If not, see <http://www.gnu.org/licenses/>. # # Synched up with: Not in FSF.
--- a/lib-src/b2m.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/b2m.c Mon Oct 18 14:02:19 2010 +0200 @@ -1,12 +1,13 @@ /* * b2m - a filter for Babyl -> Unix mail files + * The copyright on this file has been disclaimed. * * usage: b2m < babyl > mailbox * * I find this useful whenever I have to use a * system which - shock horror! - doesn't run - * Gnu emacs. At least now I can read all my - * Gnumacs Babyl format mail files! + * GNU Emacs. At least now I can read all my + * GNU Emacs Babyl format mail files! * * it's not much but it's free! * @@ -30,7 +31,8 @@ #include <string.h> #include <time.h> #include <sys/types.h> -#ifdef WIN32_NATIVE +#include <getopt.h> +#ifdef MSDOS #include <fcntl.h> #endif @@ -39,20 +41,20 @@ #undef FALSE #define FALSE 0 -/* Exit codes for success and failure. */ -#ifdef VMS -#define GOOD 1 -#define BAD 0 -#else -#define GOOD 0 -#define BAD 1 -#endif - #define streq(s,t) (strcmp (s, t) == 0) #define strneq(s,t,n) (strncmp (s, t, n) == 0) typedef int logical; +#define TM_YEAR_BASE 1900 + +/* Nonzero if TM_YEAR is a struct tm's tm_year value that causes + asctime to have well-defined behavior. */ +#ifndef TM_YEAR_IN_ASCTIME_RANGE +# define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \ + (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) +#endif + /* * A `struct linebuffer' is a structure which holds a line of text. * `readline' reads a line from a stream into a linebuffer and works @@ -64,12 +66,10 @@ char *buffer; }; - -static long *xmalloc (unsigned int); -static long *xrealloc (void *, unsigned int); -static char *concat (char *s1, char *s2, char *s3); -static long readline (struct linebuffer *, FILE *); -static void fatal (char *); +long *xmalloc (unsigned int), *xrealloc (char *, unsigned int); +char *concat (char *, char *, char *); +long readline (struct linebuffer *, register FILE *); +void fatal (char *); /* * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type); @@ -80,31 +80,73 @@ char *progname; -int -main (int argc, char *argv[]) +struct option longopts[] = { - logical labels_saved, printing, header; + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { 0 } +}; + +extern int optind; + +int +main (int argc, char **argv) +{ + logical labels_saved, printing, header, first, last_was_blank_line; time_t ltoday; - char *labels = NULL, *p, *today; + struct tm *tm; + char *labels, *p, *today; struct linebuffer data; -#ifdef WIN32_NATIVE +#ifdef MSDOS _fmode = O_BINARY; /* all of files are treated as binary files */ +#if __DJGPP__ > 1 if (!isatty (fileno (stdout))) setmode (fileno (stdout), O_BINARY); if (!isatty (fileno (stdin))) setmode (fileno (stdin), O_BINARY); +#else /* not __DJGPP__ > 1 */ + (stdout)->_flag &= ~_IOTEXT; + (stdin)->_flag &= ~_IOTEXT; +#endif /* not __DJGPP__ > 1 */ #endif progname = argv[0]; - if (argc != 1) + while (1) + { + int opt = getopt_long (argc, argv, "hV", longopts, 0); + if (opt == EOF) + break; + + switch (opt) + { + case 'V': + printf ("%s (XEmacs %s)\n", "b2m", EMACS_VERSION); + puts ("b2m is in the public domain."); + exit (EXIT_SUCCESS); + + case 'h': + fprintf (stderr, "Usage: %s <babylmailbox >unixmailbox\n", progname); + exit (EXIT_SUCCESS); + } + } + + if (optind != argc) { fprintf (stderr, "Usage: %s <babylmailbox >unixmailbox\n", progname); - exit (GOOD); + exit (EXIT_SUCCESS); } - labels_saved = printing = header = FALSE; + + labels_saved = printing = header = last_was_blank_line = FALSE; + first = TRUE; ltoday = time (0); - today = ctime (<oday); + /* Convert to a string, checking for out-of-range time stamps. + Don't use 'ctime', as that might dump core if the hardware clock + is set to a bizarre value. */ + tm = localtime (<oday); + if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) + && (today = asctime (tm)))) + fatal ("current time is out of range"); data.size = 200; data.buffer = xnew (200, char); @@ -127,6 +169,10 @@ continue; else if (data.buffer[1] == '\f') { + if (first) + first = FALSE; + else if (! last_was_blank_line) + puts(""); /* Save labels. */ readline (&data, stdin); p = strtok (data.buffer, " ,\r\n\t"); @@ -152,9 +198,16 @@ } if (printing) - puts (data.buffer); + { + puts (data.buffer); + if (data.buffer[0] == '\0') + last_was_blank_line = TRUE; + else + last_was_blank_line = FALSE; + } } - return 0; + + return EXIT_SUCCESS; } @@ -163,7 +216,7 @@ * Return a newly-allocated string whose contents * concatenate those of s1, s2, s3. */ -static char * +char * concat (char *s1, char *s2, char *s3) { int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); @@ -182,8 +235,9 @@ * Return the number of characters read from `stream', * which is the length of the line including the newline, if any. */ -static long -readline (struct linebuffer *linebuffer, FILE *stream) +long +readline (struct linebuffer *linebuffer, register FILE *stream) + { char *buffer = linebuffer->buffer; register char *p = linebuffer->buffer; @@ -205,12 +259,13 @@ } if (c == EOF) { + *p = '\0'; chars_deleted = 0; break; } if (c == '\n') { - if (p[-1] == '\r' && p > buffer) + if (p > buffer && p[-1] == '\r') { *--p = '\0'; chars_deleted = 2; @@ -231,7 +286,7 @@ /* * Like malloc but get fatal error if memory is exhausted. */ -static long * +long * xmalloc (unsigned int size) { long *result = (long *) malloc (size); @@ -240,8 +295,8 @@ return result; } -static long * -xrealloc (void *ptr, unsigned int size) +long * +xrealloc (char *ptr, unsigned int size) { long *result = (long *) realloc (ptr, size); if (result == NULL) @@ -249,10 +304,11 @@ return result; } -static void +void fatal (char *message) { fprintf (stderr, "%s: %s\n", progname, message); - exit (BAD); + exit (EXIT_FAILURE); } +/* b2m.c ends here */
--- a/lib-src/cvtmail.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/cvtmail.c Mon Oct 18 14:02:19 2010 +0200 @@ -1,20 +1,18 @@ /* Copyright (C) 1985, 1993, 1994 Free Software Foundation 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 2, or (at your option) -any later version. +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. +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; see the file COPYING. If not, write to -the Free the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ /* Synched up with: FSF 19.28. */
--- a/lib-src/digest-doc.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/digest-doc.c Mon Oct 18 14:02:19 2010 +0200 @@ -1,21 +1,47 @@ -/* 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. -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +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. */ + #include <stdio.h> +#ifdef DOS_NT +#include <fcntl.h> /* for O_BINARY */ +#include <io.h> /* for setmode */ +#endif + int -main (int argc, char **argv) +main () { register int ch; register int notfirst = 0; +#ifdef DOS_NT + /* 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");
--- a/lib-src/etags.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/etags.c Mon Oct 18 14:02:19 2010 +0200 @@ -34,19 +34,18 @@ This file is not considered part of GNU Emacs. -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 2 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. +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, write to the Free Software Foundation, -Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* NB To comply with the above BSD license, copyright information is
--- a/lib-src/fakemail.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/fakemail.c Mon Oct 18 14:02:19 2010 +0200 @@ -3,20 +3,18 @@ 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 2, or (at your option) -any later version. +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. +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; see the file COPYING. If not, write to -the Free the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ /* Synched up with: FSF 19.28. */
--- a/lib-src/getopt.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/getopt.c Mon Oct 18 14:02:19 2010 +0200 @@ -9,20 +9,18 @@ NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. -This program is free software; you can redistribute it and/or modify it +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 2, or (at your option) any -later version. +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. +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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -USA. */ +along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. Ditto for AIX 3.2 and <stdlib.h>. */
--- a/lib-src/getopt.h Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/getopt.h Mon Oct 18 14:02:19 2010 +0200 @@ -4,20 +4,18 @@ NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. -This program is free software; you can redistribute it and/or modify it +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 2, or (at your option) any -later version. +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. +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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -USA. */ +along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GETOPT_H #define _GETOPT_H 1
--- a/lib-src/getopt1.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/getopt1.c Mon Oct 18 14:02:19 2010 +0200 @@ -4,20 +4,18 @@ NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. -This program is free software; you can redistribute it and/or modify it +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 2, or (at your option) any -later version. +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. +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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -USA. */ +along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H #include <config.h>
--- a/lib-src/gnuattach Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/gnuattach Mon Oct 18 14:02:19 2010 +0200 @@ -4,20 +4,18 @@ # Copyright (C) 1997 Free Software Foundation, Inc. -# XEmacs is free software; you can redistribute it and/or modify it +# 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 2, or (at your option) any -# later version. - +# 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; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. +# along with XEmacs. If not, see <http://www.gnu.org/licenses/>. echo "$0: Please use \`gnuclient -nw' instead." >&2 exit 1
--- a/lib-src/gnudoit Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/gnudoit Mon Oct 18 14:02:19 2010 +0200 @@ -4,20 +4,18 @@ # Copyright (C) 1997 Free Software Foundation, Inc. -# XEmacs is free software; you can redistribute it and/or modify it +# 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 2, or (at your option) any -# later version. - +# 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; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. +# along with XEmacs. If not, see <http://www.gnu.org/licenses/>. if [ x"$1" = x-q ] then
--- a/lib-src/gnuserv.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/gnuserv.c Mon Oct 18 14:02:19 2010 +0200 @@ -2,10 +2,20 @@ Server code for handling requests from clients and forwarding them on to the XEmacs process. - This file is part of XEmacs. + 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. - Copying is permitted under those conditions described by the GNU - General Public License. + 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/>. Copyright (C) 1989 Free Software Foundation, Inc.
--- a/lib-src/gnuslib.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/gnuslib.c Mon Oct 18 14:02:19 2010 +0200 @@ -3,8 +3,18 @@ This file is part of XEmacs. - Copying is permitted under those conditions described by the GNU - General Public License. + 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/>. Copyright (C) 1989 Free Software Foundation, Inc.
--- a/lib-src/hexl.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/hexl.c Mon Oct 18 14:02:19 2010 +0200 @@ -1,20 +1,42 @@ -/* 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. + +Author: Keith Gabryelski +(according to authors.el) + +This file is not considered part of GNU Emacs. +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/>. */ + + +#ifdef HAVE_CONFIG_H #include <config.h> +#endif #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <ctype.h> -#ifdef WIN32_NATIVE +#ifdef DOS_NT +#include <fcntl.h> +#if __DJGPP__ >= 2 #include <io.h> -#include <fcntl.h> #endif - -#if __STDC__ || defined(STDC_HEADERS) -#include <stdlib.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> #endif -#include <string.h> +#ifdef WINDOWSNT +#include <io.h> #endif #define DEFAULT_GROUPING 0x01 @@ -29,7 +51,7 @@ int group_by = DEFAULT_GROUPING; char *progname; -void usage (void); +void usage(void); int main (int argc, char *argv[]) @@ -37,25 +59,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 +139,7 @@ } else { - (void) fprintf (stderr, "%s: invalid switch: \"%s\".\n", progname, + fprintf (stderr, "%s: invalid switch: \"%s\".\n", progname, *argv); usage (); } @@ -144,8 +166,14 @@ { char buf[18]; -#ifdef WIN32_NATIVE - _setmode (_fileno (stdout), O_BINARY); +#ifdef DOS_NT +#if (__DJGPP__ >= 2) || (defined WINDOWSNT) + if (!isatty (fileno (stdout))) + setmode (fileno (stdout), O_BINARY); +#else + (stdout)->_flag &= ~_IOTEXT; /* print binary */ + _setmode (fileno (stdout), O_BINARY); +#endif #endif for (;;) { @@ -187,8 +215,14 @@ } else { -#ifdef WIN32_NATIVE - _setmode (_fileno (fp), O_BINARY); +#ifdef DOS_NT +#if (__DJGPP__ >= 2) || (defined WINDOWSNT) + if (!isatty (fileno (fp))) + setmode (fileno (fp), O_BINARY); +#else + (fp)->_flag &= ~_IOTEXT; /* read binary */ + _setmode (fileno (fp), O_BINARY); +#endif #endif address = 0; string[0] = ' '; @@ -210,7 +244,7 @@ else { if (!i) - (void) printf ("%08lx: ", address); + printf ("%08lx: ", address); if (iso_flag) string[i+1] = @@ -218,7 +252,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 +271,17 @@ } 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); + fprintf (stderr, "usage: %s [-de] [-iso]\n", progname); + exit (EXIT_FAILURE); } + +/* hexl.c ends here */
--- a/lib-src/make-path.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/make-path.c Mon Oct 18 14:02:19 2010 +0200 @@ -3,20 +3,18 @@ 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 2, or (at your option) -any later version. +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. +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; see the file COPYING. If not, write to -the Free the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ /* Synched up with: FSF 19.28. */
--- a/lib-src/ootags.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/ootags.c Mon Oct 18 14:02:19 2010 +0200 @@ -4,19 +4,18 @@ This file is not considered part of GNU Emacs. -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 2 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. +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, write to the Free Software Foundation, -Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Authors:
--- a/lib-src/profile.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/profile.c Mon Oct 18 14:02:19 2010 +0200 @@ -4,22 +4,20 @@ Author: Boaz Ben-Zvi <boaz@lcs.mit.edu> - This file is part of XEmacs. + 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 2, or (at your option) - any later version. + 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. + 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; see the file COPYING. If not, write to - the Free the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ /* Synched up with: FSF 19.28. */ /* #### Not sure if this is needed for XEmacs. */
--- a/lib-src/qsort.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/qsort.c Mon Oct 18 14:02:19 2010 +0200 @@ -4,20 +4,18 @@ This file is part of GNU CC. -GNU QSORT 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 2, or (at your option) -any later version. +GNU QSORT 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. -GNU QSORT 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. +GNU QSORT 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 QSORT; see the file COPYING. If not, write to -the Free the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +along with GNU QSORT. If not, see <http://www.gnu.org/licenses/>. */ /* Synched up with: FSF 19.28. */
--- a/lib-src/rcs2log Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/rcs2log Mon Oct 18 14:02:19 2010 +0200 @@ -34,20 +34,18 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002 # 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 -# the Free Software Foundation; either version 2, 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. -# +# 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; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. +# along with this program. If not, see <http://www.gnu.org/licenses/>. Copyright='Copyright (C) 2002 Free Software Foundation, Inc. This program comes with NO WARRANTY, to the extent permitted by law.
--- a/lib-src/sorted-doc.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/sorted-doc.c Mon Oct 18 14:02:19 2010 +0200 @@ -1,28 +1,48 @@ -/* 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 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. -/* Synched up with: FSF 19.28. */ +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/>. */ + + +/* This version sorts the output by function name. */ + +#ifdef HAVE_CONFIG_H #include <config.h> +#endif #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <ctype.h> -#include <stdlib.h> /* for qsort() and malloc() */ -#include <string.h> -static void *xmalloc (size_t); +#ifdef DOS_NT +#include <fcntl.h> /* for O_BINARY */ +#include <io.h> /* for setmode */ +#endif #define NUL '\0' #define MARKER '\037' #define DEBUG 0 -typedef struct LINE LINE; +typedef struct line LINE; -struct LINE +struct line { LINE *next; /* ptr to next or NULL */ char *line; /* text of the line */ @@ -38,10 +58,18 @@ char type; /* 'F' for function, 'V' for variable */ }; +void error (char *s1, char *s2); +void fatal (char *s1, char *s2); +char *xmalloc (int size); +char *xstrdup (char *str); +int cmpdoc (DOCSTR **a, DOCSTR **b); + +typedef int (*sort_function_t)(const void *, const void *); + /* Print error message. `s1' is printf control string, `s2' is arg for it. */ -static void +void error (char *s1, char *s2) { fprintf (stderr, "sorted-doc: "); @@ -51,35 +79,35 @@ /* Print error message and exit. */ -static void +void fatal (char *s1, char *s2) { error (s1, s2); - exit (1); + exit (EXIT_FAILURE); } /* Like malloc but get fatal error if memory is exhausted. */ -static void * -xmalloc (size_t size) +char * +xmalloc (int size) { - void *result = malloc (size); + char *result = malloc ((unsigned)size); if (result == NULL) fatal ("%s", "virtual memory exhausted"); return result; } -static char * -strsav (char *str) +char * +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. */ -static int +int cmpdoc (DOCSTR **a, DOCSTR **b) { register int val = strcmp ((*a)->name, (*b)->name); @@ -93,24 +121,31 @@ WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET }; -const char *states[] = +char *states[] = { "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET" }; - + int -main (int argc, char **argv) +main (void) { 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 char *bp; /* ptr inside line buffer */ 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 +193,7 @@ bp = buf; state = DESC_GET; } - + /* process gets */ if (state == NAME_GET || state == DESC_GET) @@ -170,7 +205,7 @@ else /* saving and changing state */ { *bp = NUL; - bp = strsav (buf); + bp = xstrdup (buf); if (state == NAME_GET) dp->name = bp; @@ -197,19 +232,19 @@ /* sort the array by name; within each name, by type */ - qsort ((char*)array, cnt, sizeof (DOCSTR*), - (int (*)(const void *, const void *)) cmpdoc); + qsort ((char*)array, cnt, sizeof (DOCSTR*), (sort_function_t)cmpdoc); /* write the output header */ 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"); - printf ("@global@let@ITEM=@item\n"); + printf ("@global@let@ITEM@item\n"); printf ("@def@item{@filbreak@vskip5pt@ITEM}\n"); printf ("@font@tensy cmsy10 scaled @magstephalf\n"); printf ("@font@teni cmmi10 scaled @magstephalf\n"); @@ -246,12 +281,17 @@ 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; } + +/* sorted-doc.c ends here */
--- a/lib-src/tcp.c Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/tcp.c Mon Oct 18 14:02:19 2010 +0200 @@ -7,20 +7,18 @@ 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 2, or (at your option) -any later version. +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. +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; see the file COPYING. If not, write to -the Free the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. +along with XEmacs. If not, see <http://www.gnu.org/licenses/>. * * Yasunari, Itoh at PFU limited contributed for Fujitsu UTS and SX/A.
--- a/lib-src/vcdiff Fri Oct 15 16:35:24 2010 +0200 +++ b/lib-src/vcdiff Mon Oct 18 14:02:19 2010 +0200 @@ -1,23 +1,37 @@ -#!/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 ! -# -# 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. -# + +# 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/>. + 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 +45,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 +81,24 @@ 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 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 +111,4 @@ then status=$s fi done +