From b7fc9e0f6d6105ba2203f219743d4b269415e84b Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 12 Nov 2007 13:06:02 -0800 Subject: initial import from bash_3.1dfsg.orig.tar.gz --- examples/loadables/template.c | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 examples/loadables/template.c (limited to 'examples/loadables/template.c') diff --git a/examples/loadables/template.c b/examples/loadables/template.c new file mode 100644 index 0000000..7bb3f9f --- /dev/null +++ b/examples/loadables/template.c @@ -0,0 +1,56 @@ +/* template - example template for loadable builtin */ + +/* See Makefile for compilation details. */ + +#include + +#if defined (HAVE_UNISTD_H) +# include +#endif +#include "bashansi.h" +#include +#include + +#include "builtins.h" +#include "shell.h" +#include "bashgetopt.h" + +#if !defined (errno) +extern int errno; +#endif + +extern char *strerror (); + +template_builtin (list) + WORD_LIST *list; +{ + int opt, rval; + + rval = EXECUTION_SUCCESS; + reset_internal_getopt (); + while ((opt = internal_getopt (list, "")) != -1) + { + switch (opt) + { + default: + builtin_usage (); + return (EX_USAGE); + } + } + list = loptend; + + return (rval); +} + +char *template_doc[] = { + (char *)NULL +}; + +struct builtin template_struct = { + "template", /* builtin name */ + template_builtin, /* function implementing the builtin */ + BUILTIN_ENABLED, /* initial flags for builtin */ + template_doc, /* array of long documentation strings. */ + "template", /* usage synopsis; becomes short_doc */ + 0 /* reserved for internal use */ +}; -- cgit v1.2.3