Imported from ../bash-4.0-rc1.tar.gz.
[platform/upstream/bash.git] / examples / loadables / hello.c
index 3f371e5..bff6e76 100644 (file)
@@ -3,19 +3,21 @@
 
 /* See Makefile for compilation details. */
 
-#include "config.h"
+#include <config.h>
 
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif
 
 #include <stdio.h>
+
 #include "builtins.h"
 #include "shell.h"
+#include "bashgetopt.h"
 
 /* A builtin `xxx' is normally implemented with an `xxx_builtin' function.
    If you're converting a command that uses the normal Unix argc/argv
-   calling convention, use argv = word_list_to_argv (list, &argc) and call
+   calling convention, use argv = make_builtin_argv (list, &argc) and call
    the original `main' something like `xxx_main'.  Look at cat.c for an
    example.
 
@@ -29,6 +31,7 @@
 
    A builtin command returns EXECUTION_SUCCESS for success and
    EXECUTION_FAILURE to indicate failure. */
+int
 hello_builtin (list)
      WORD_LIST *list;
 {
@@ -38,10 +41,12 @@ hello_builtin (list)
 }
 
 /* An array of strings forming the `long' documentation for a builtin xxx,
-   which is printed by `help xxx'.  It must end with a NULL. */
+   which is printed by `help xxx'.  It must end with a NULL.  By convention,
+   the first line is a short description. */
 char *hello_doc[] = {
+       "Sample builtin.",
+       "",
        "this is the long doc for the sample hello builtin",
-       "which is a bare-bones echo",
        (char *)NULL
 };
 
@@ -53,7 +58,7 @@ struct builtin hello_struct = {
        hello_builtin,          /* function implementing the builtin */
        BUILTIN_ENABLED,        /* initial flags for builtin */
        hello_doc,              /* array of long documentation strings. */
-       "hello [args]",         /* usage synopsis; becomes short_doc */
+       "hello",                /* usage synopsis; becomes short_doc */
        0                       /* reserved for internal use */
 };