Commit 1c24ba2d authored by Niels Möller's avatar Niels Möller

Moved in the CVS tree, and converted from automake to plain autoconf.

Rev: argp/.bootstrap:1.1
Rev: argp/.c-style:1.1
Rev: argp/.cvsignore:1.1
Rev: argp/COPYING.LIB:1.1
Rev: argp/ChangeLog:1.1
Rev: argp/Makefile.in:1.1
Rev: argp/TODO:1.1
Rev: argp/Versions:1.1
Rev: argp/argp-ba.c:1.1
Rev: argp/argp-eexst.c:1.1
Rev: argp/argp-fmtstream.c:1.1
Rev: argp/argp-fmtstream.h:1.1
Rev: argp/argp-fs-xinl.c:1.1
Rev: argp/argp-help.c:1.1
Rev: argp/argp-namefrob.h:1.1
Rev: argp/argp-parse.c:1.1
Rev: argp/argp-pv.c:1.1
Rev: argp/argp-pvh.c:1.1
Rev: argp/argp-test.c:1.1
Rev: argp/argp-xinl.c:1.1
Rev: argp/argp.h:1.1
Rev: argp/config.make.in:1.1
Rev: argp/configure.ac:1.1
Rev: argp/mempcpy.c:1.1
Rev: argp/strcasecmp.c:1.1
Rev: argp/strchrnul.c:1.1
Rev: argp/strndup.c:1.1
Rev: argp/testsuite/.c-style:1.1
Rev: argp/testsuite/.cvsignore:1.1
Rev: argp/testsuite/Makefile.in:1.1
Rev: argp/testsuite/ex1-test:1.1
Rev: argp/testsuite/ex1.c:1.1
Rev: argp/testsuite/ex3.c:1.1
Rev: argp/testsuite/ex4.c:1.1
Rev: argp/testsuite/permute-test:1.1
parent e6faa237
#! /bin/sh
autoconf && autoheader
*.d
*.tar.gz
Makefile
argp-test
autom4te.cache
config.cache
config.h
config.h.in
config.log
config.make
config.status
configure
stamp-h
stamp-h.in
/*.d
/*.tar.gz
/Makefile
/argp-test
/autom4te.cache
/config.cache
/config.h
/config.h.in
/config.log
/config.make
/config.status
/configure
/stamp-h
/stamp-h.in
This diff is collapsed.
This diff is collapsed.
# Argp Makefile
@SET_MAKE@
srcdir = @srcdir@
VPATH = @srcdir@
LIBOBJS = @LIBOBJS@
SUBDIRS = testsuite
PRE_CPPFLAGS = -I. -I$(srcdir)
include config.make
# argp-test needs random(), which is not available on windows.
TARGETS = libargp.a argp-test
# No installation
install uninstall:
true
all check:
$(MAKE) $@-here
set -e; for d in $(SUBDIRS); do \
echo "Making $@ in $$d" ; (cd $$d && $(MAKE) $@); done
clean distclean mostlyclean maintainer-clean tags:
set -e; for d in $(SUBDIRS); do \
echo "Making $@ in $$d" ; (cd $$d && $(MAKE) $@); done
$(MAKE) $@-here
check-here:
true
all-here: $(TARGETS)
argp_SOURCES = argp-ba.c argp-eexst.c argp-fmtstream.c \
argp-help.c argp-parse.c argp-pv.c \
argp-pvh.c
SOURCES = $(argp_SOURCES) argp-test.c
.c.$(OBJEXT):
$(COMPILE) -c $< \
&& $(DEP_PROCESS)
# Rules for libargp.a
argp_OBJS = $(argp_SOURCES:.c=.$(OBJEXT)) $(LIBOBJS)
libargp.a: $(argp_OBJS)
-rm -f $@
$(AR) $(ARFLAGS) $@ $(argp_OBJS)
$(RANLIB) $@
# Rules for argp-test
argp-test$(EXEEXT): argp-test.$(OBJEXT) libargp.a
$(LINK) argp-test.$(OBJEXT) libargp.a -o $@
# Configure-related rules, mostly copied from the autoconf manual. No
# $(srcdir) prefixes on the targets, though.
configure: configure.ac aclocal.m4
cd $(srcdir) && $(AUTOCONF)
# autoheader might not change config.h.in, so touch a stamp file.
config.h.in: stamp-h.in
stamp-h.in: configure.ac aclocal.m4
cd $(srcdir) && autoheader
echo timestamp > $(srcdir)/stamp-h.in
config.status: configure
./config.status --recheck
config.h: stamp-h
stamp-h: config.h.in config.status
./config.status config.h
echo timestamp > stamp-h
Makefile: Makefile.in config.status
./config.status $@
config.make: config.make.in config.status
./config.status $@
config.m4: config.m4.in config.status
./config.status $@
# Distribution
distdir = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
top_distdir = $(distdir)
DISTFILES = $(SOURCES) .bootstrap aclocal.m4 configure.ac \
configure stamp-h.in \
install-sh config.h.in config.make.in Makefile.in \
COPYING.LIB TODO ChangeLog Versions \
mempcpy.c strcasecmp.c strchrnul.c strndup.c vsnprintf.c
# NOTE: Depending on the automake version in the parent dir,
# we must handle both absolute and relative $destdir.
distdir: $(DISTFILES)
rm -rf "$(distdir)"
mkdir "$(distdir)"
set -e; for f in $(DISTFILES) ; do \
if [ -f "$$f" ] ; then cp "$$f" "$(distdir)" ; \
else cp "$(srcdir)/$$f" "$(distdir)" ; \
fi ; \
done
set -e; for d in $(SUBDIRS); do \
sd="$(distdir)/$$d" ; \
mkdir "$$sd" && $(MAKE) -C $$d distdir="`cd $$sd && pwd`" $@ ; \
done
dist: distdir
tar cf - $(distdir) | gzip -c >$(distdir).tar.gz
rm -rf $(distdir)
rm_distcheck = test ! -d distcheck-tmp \
|| { find distcheck-tmp -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr distcheck-tmp; };
distcheck: dist
$(rm_distcheck)
mkdir distcheck-tmp
gzip -d < $(distdir).tar.gz \
| { cd distcheck-tmp && tar xf - && chmod -R a-w $(distdir) ; }
mkdir distcheck-tmp/build
mkdir distcheck-tmp/install
cd distcheck-tmp/build && ../$(distdir)/configure --prefix="`cd ../install && pwd`"
cd distcheck-tmp/build && $(MAKE)
cd distcheck-tmp/build && $(MAKE) check
cd distcheck-tmp/build && $(MAKE) install
cd distcheck-tmp/build && $(MAKE) uninstall
cd distcheck-tmp && find install -type f -print > leftover-install-files
@test `cat distcheck-tmp/leftover-install-files | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
cat distcheck-tmp/leftover-install-files ; \
exit 1; }
chmod -R a-w distcheck-tmp/install
mkdir distcheck-tmp/destdir
destdir="`cd distcheck-tmp/destdir && pwd`" \
&& cd distcheck-tmp/build \
&& $(MAKE) install DESTDIR="$$destdir" \
&& $(MAKE) uninstall DESTDIR="$$destdir"
cd distcheck-tmp && find destdir -type f -print > leftover-destdir-files
@test `cat distcheck-tmp/leftover-destdir-files | wc -l` -le 1 \
|| { echo "ERROR: destdir files left after uninstall:" ; \
cat distcheck-tmp/leftover-destdir-files ; \
exit 1; }
cd distcheck-tmp/build && $(MAKE) dist
cd distcheck-tmp/build && rm *.gz
cd distcheck-tmp/build && $(MAKE) distclean
cd distcheck-tmp && find build -type f -print > leftover-build-files
@test `cat distcheck-tmp/leftover-build-files | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
cat distcheck-tmp/leftover-build-files ; \
exit 1; }
$(rm_distcheck)
clean-here:
-rm -f $(TARGETS) *.$(OBJEXT)
distclean-here: clean-here
-rm -f config.h stamp-h config.log config.status \
config.make Makefile *.d
maintainer-clean-here: distclean-here
true
tags-here:
etags $(srcdir)/*.c $(srcdir)/*.h
DEP_FILES = $(SOURCES:.c=.$(OBJEXT).d)
@DEP_INCLUDE@ $(DEP_FILES)
Figure out what to do about extern inline, as it's not supported by
newer gcc-3.x.
libc {
GLIBC_2.1 {
# variables in normal name space
argp_err_exit_status; argp_program_bug_address; argp_program_version;
argp_program_version_hook;
# a*
argp_error; argp_failure; argp_help; argp_parse; argp_state_help;
argp_usage;
# kludge for recursive argp callers that know the magic.
_argp_unlock_xxx;
}
}
/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
Copyright (C) 1996, 1997, 1999, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* If set by the user program, it should point to string that is the
bug-reporting address for the program. It will be printed by argp_help if
the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help
messages), embedded in a sentence that says something like `Report bugs to
ADDR.'. */
const char *argp_program_bug_address = 0;
/* Default definition for ARGP_ERR_EXIT_STATUS
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#if HAVE_SYSEXITS_H
# include <sysexits.h>
#else
# define EX_USAGE 64
#endif
#include "argp.h"
/* The exit status that argp will use when exiting due to a parsing error.
If not defined or set by the user program, this defaults to EX_USAGE from
<sysexits.h>. */
error_t argp_err_exit_status = EX_USAGE;
This diff is collapsed.
This diff is collapsed.
/* Real definitions for extern inline functions in argp-fmtstream.h
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define ARGP_FS_EI
#undef __OPTIMIZE__
#define __OPTIMIZE__
#include "argp-fmtstream.h"
/* Add weak aliases. */
#if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias)
weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc)
weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts)
weak_alias (__argp_fmtstream_write, argp_fmtstream_write)
weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin)
weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin)
weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin)
weak_alias (__argp_fmtstream_point, argp_fmtstream_point)
#endif
This diff is collapsed.
/* Name frobnication for compiling argp outside of glibc
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#if !_LIBC
/* This code is written for inclusion in gnu-libc, and uses names in the
namespace reserved for libc. If we're not compiling in libc, define those
names to be the normal ones instead. */
/* argp-parse functions */
#undef __argp_parse
#define __argp_parse argp_parse
#undef __option_is_end
#define __option_is_end _option_is_end
#undef __option_is_short
#define __option_is_short _option_is_short
#undef __argp_input
#define __argp_input _argp_input
/* argp-help functions */
#undef __argp_help
#define __argp_help argp_help
#undef __argp_error
#define __argp_error argp_error
#undef __argp_failure
#define __argp_failure argp_failure
#undef __argp_state_help
#define __argp_state_help argp_state_help
#undef __argp_usage
#define __argp_usage argp_usage
#undef __argp_basename
#define __argp_basename _argp_basename
#undef __argp_short_program_name
#define __argp_short_program_name _argp_short_program_name
/* argp-fmtstream functions */
#undef __argp_make_fmtstream
#define __argp_make_fmtstream argp_make_fmtstream
#undef __argp_fmtstream_free
#define __argp_fmtstream_free argp_fmtstream_free
#undef __argp_fmtstream_putc
#define __argp_fmtstream_putc argp_fmtstream_putc
#undef __argp_fmtstream_puts
#define __argp_fmtstream_puts argp_fmtstream_puts
#undef __argp_fmtstream_write
#define __argp_fmtstream_write argp_fmtstream_write
#undef __argp_fmtstream_printf
#define __argp_fmtstream_printf argp_fmtstream_printf
#undef __argp_fmtstream_set_lmargin
#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin
#undef __argp_fmtstream_set_rmargin
#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin
#undef __argp_fmtstream_set_wmargin
#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin
#undef __argp_fmtstream_point
#define __argp_fmtstream_point argp_fmtstream_point
#undef __argp_fmtstream_update
#define __argp_fmtstream_update _argp_fmtstream_update
#undef __argp_fmtstream_ensure
#define __argp_fmtstream_ensure _argp_fmtstream_ensure
#undef __argp_fmtstream_lmargin
#define __argp_fmtstream_lmargin argp_fmtstream_lmargin
#undef __argp_fmtstream_rmargin
#define __argp_fmtstream_rmargin argp_fmtstream_rmargin
#undef __argp_fmtstream_wmargin
#define __argp_fmtstream_wmargin argp_fmtstream_wmargin
/* normal libc functions we call */
#undef __sleep
#define __sleep sleep
#undef __strcasecmp
#define __strcasecmp strcasecmp
#undef __vsnprintf
#define __vsnprintf vsnprintf
#endif /* !_LIBC */
#ifndef __set_errno
#define __set_errno(e) (errno = (e))
#endif
This diff is collapsed.
/* Default definition for ARGP_PROGRAM_VERSION.
Copyright (C) 1996, 1997, 1999, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* If set by the user program to a non-zero value, then a default option
--version is added (unless the ARGP_NO_HELP flag is used), which will
print this this string followed by a newline and exit (unless the
ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
const char *argp_program_version = 0;
/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
Copyright (C) 1996, 1997, 1999, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "argp.h"
/* If set by the user program to a non-zero value, then a default option
--version is added (unless the ARGP_NO_HELP flag is used), which calls
this function with a stream to print the version to and a pointer to the
current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
void (*argp_program_version_hook) (FILE *stream, struct argp_state *state) = 0;
/* Test program for argp argument parser
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <stdio.h>
#include "argp.h"
#if !HAVE_ASPRINTF
#include <stdarg.h>
static int
asprintf (char **result, const char *format, ...)
{
size_t size;
char *p;
for (size = 200, p = NULL;; size *= 2)
{
va_list args;
int written;
p = realloc(p, size + 1);
if (!p)
{
fprintf(stderr, "Virtual memory exhausted.\n");
abort();
}
p[size] = '\0';
va_start(args, format);
written = vsnprintf(p, size, format, args);
va_end(args);
if (written >= 0)
{
*result = p;
return written;
}
}
}
#endif /* !HAVE_ASPRINTF */
const char *argp_program_version = "argp-test 1.0";
struct argp_option sub_options[] =
{
{"subopt1", 's', 0, 0, "Nested option 1", 0},
{"subopt2", 'S', 0, 0, "Nested option 2", 0},
{ 0, 0, 0, 0, "Some more nested options:", 10},
{"subopt3", 'p', 0, 0, "Nested option 3", 0},
{"subopt4", 'q', 0, 0, "Nested option 4", 1},
{0, 0, 0, 0, 0, 0}
};
static const char sub_args_doc[] = "STRING...\n-";
static const char sub_doc[] = "\vThis is the doc string from the sub-arg-parser.";
static error_t
sub_parse_opt (int key, char *arg, struct argp_state *state UNUSED)
{
switch (key)
{
case ARGP_KEY_NO_ARGS:
printf ("NO SUB ARGS\n");
break;
case ARGP_KEY_ARG:
printf ("SUB ARG: %s\n", arg);
break;
case 's' : case 'S': case 'p': case 'q':
printf ("SUB KEY %c\n", key);
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
}
static char *
sub_help_filter (int key, const char *text, void *input UNUSED)
{
if (key == ARGP_KEY_HELP_EXTRA)
return strdup ("This is some extra text from the sub parser (note that it \
is preceded by a blank line).");
else
return (char *)text;
}
static struct argp sub_argp = {
sub_options, sub_parse_opt, sub_args_doc, sub_doc, 0, sub_help_filter, 0
};
/* Structure used to communicate with the parsing functions. */
struct params
{
unsigned foonly; /* Value parsed for foonly. */
unsigned foonly_default; /* Default value for it. */
};
#define OPT_PGRP 1
#define OPT_SESS 2
struct argp_option options[] =
{
{"pid", 'p', "PID", 0, "List the process PID", 0},
{"pgrp", OPT_PGRP,"PGRP",0, "List processes in the process group PGRP", 0},
{"no-parent", 'P', 0, 0, "Include processes without parents", 0},
{0, 'x', 0, OPTION_ALIAS, NULL, 0},
{"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally"
" if there's some reason ps can't"
" print a field for any process, it's"
" removed from the output entirely)", 0},
{"reverse", 'r', 0, 0, "Reverse the order of any sort", 0},
{"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS, NULL, 0},
{"session", OPT_SESS,"SID", OPTION_ARG_OPTIONAL,
"Add the processes from the session"
" SID (which defaults to the sid of"
" the current process)", 0},
{0,0,0,0, "Here are some more options:", 0},