Patch-ID: bash32-032
[bash.git] / examples / loadables / template.c
blob7bb3f9f3592bd9819f7e11828f9a749bd369b7f8
1 /* template - example template for loadable builtin */
3 /* See Makefile for compilation details. */
5 #include <config.h>
7 #if defined (HAVE_UNISTD_H)
8 # include <unistd.h>
9 #endif
10 #include "bashansi.h"
11 #include <stdio.h>
12 #include <errno.h>
14 #include "builtins.h"
15 #include "shell.h"
16 #include "bashgetopt.h"
18 #if !defined (errno)
19 extern int errno;
20 #endif
22 extern char *strerror ();
24 template_builtin (list)
25 WORD_LIST *list;
27 int opt, rval;
29 rval = EXECUTION_SUCCESS;
30 reset_internal_getopt ();
31 while ((opt = internal_getopt (list, "")) != -1)
33 switch (opt)
35 default:
36 builtin_usage ();
37 return (EX_USAGE);
40 list = loptend;
42 return (rval);
45 char *template_doc[] = {
46 (char *)NULL
49 struct builtin template_struct = {
50 "template", /* builtin name */
51 template_builtin, /* function implementing the builtin */
52 BUILTIN_ENABLED, /* initial flags for builtin */
53 template_doc, /* array of long documentation strings. */
54 "template", /* usage synopsis; becomes short_doc */
55 0 /* reserved for internal use */