/* 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 Free Software Foundation, Inc.
+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.
+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 2, or (at your option)
- any later version.
+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.
- 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.
+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; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+You should have received a copy of the GNU General Public License
+along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
- This version sorts the output by function name. */
+
+/* This version sorts the output by function name. */
#ifdef HAVE_CONFIG_H
#include <config.h>
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
void
-error (s1, s2)
- char *s1, *s2;
+error (const char *s1, const char *s2)
{
fprintf (stderr, "sorted-doc: ");
fprintf (stderr, s1, s2);
/* Print error message and exit. */
void
-fatal (s1, s2)
- char *s1, *s2;
+fatal (const char *s1, const char *s2)
{
error (s1, s2);
exit (EXIT_FAILURE);
/* Like malloc but get fatal error if memory is exhausted. */
char *
-xmalloc (size)
- int size;
+xmalloc (int size)
{
char *result = malloc ((unsigned)size);
if (result == NULL)
}
char *
-xstrdup (str)
- char * str;
+xstrdup (char *str)
{
char *buf = xmalloc (strlen (str) + 1);
(void) strcpy (buf, str);
/* Comparison function for qsort to call. */
int
-cmpdoc (a, b)
- DOCSTR **a;
- DOCSTR **b;
+cmpdoc (const void *va, const void *vb)
{
+ DOCSTR *const *a = va;
+ DOCSTR *const *b = vb;
register int val = strcmp ((*a)->name, (*b)->name);
if (val) return val;
return (*a)->type - (*b)->type;
}
-
enum state
{
WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET
};
-char *states[] =
+const char *states[] =
{
"WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET"
};
int
-main ()
+main (void)
{
register DOCSTR *dp = NULL; /* allocated DOCSTR */
register LINE *lp = NULL; /* allocated line */