2 * rl - command-line interface to read a line from the standard input
3 * (or another fd) using readline.
5 * usage: rl [-p prompt] [-u unit] [-d default]
9 * Remove the next line if you're compiling this against an installed
12 #define READLINE_LIBRARY
14 #if defined (HAVE_CONFIG_H)
19 #include <sys/types.h>
20 #include "posixstat.h"
27 #if !defined (strchr) && !defined (__STDC__)
28 extern char *strrchr();
31 static char *progname;
39 rl_insert_text (deftext);
40 deftext = (char *)NULL;
41 rl_startup_hook = (Function *)NULL;
48 fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n",
61 progname = strrchr(argv[0], '/');
68 prompt = "readline$ ";
72 while ((opt = getopt(argc, argv, "p:u:d:")) != EOF)
83 fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg);
98 if (fstat (fd, &sb) < 0)
100 fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd);
103 ifp = fdopen (fd, "r");
107 if (deftext && *deftext)
108 rl_startup_hook = set_deftext;
110 temp = readline (prompt);