summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-11-23 18:50:16 -0500
committerChet Ramey <chet.ramey@case.edu>2011-11-23 18:50:16 -0500
commitd19d2a576e818d6732b0d1b1ae72e3cc96fc29a3 (patch)
tree0dc29bf495127f11637ab5bb92c41f0b8241bf8a /examples
parent7ea38d677dc0ce50dfcbfc43150919579627b274 (diff)
downloadreadline-d19d2a576e818d6732b0d1b1ae72e3cc96fc29a3.tar.gz
Readline-4.0 import
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.in13
-rw-r--r--examples/rl.c3
-rw-r--r--examples/rlversion.c21
3 files changed, 32 insertions, 5 deletions
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 1848673..879aa49 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,6 +1,6 @@
# This is the Makefile for the examples subdirectory of readline. -*- text -*-
#
-SHELL = /bin/sh
+SHELL = @MAKE_SHELL@
RM = rm -f
srcdir = @srcdir@
@@ -14,7 +14,7 @@ CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
CPPFLAGS = @CPPFLAGS@
-INCLUDES = -I $(srcdir) -I $(top_srcdir) -I..
+INCLUDES = -I$(srcdir) -I$(top_srcdir) -I..
CCFLAGS = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
LDFLAGS = -g -L..
@@ -22,10 +22,11 @@ LDFLAGS = -g -L..
TERMCAP_LIB = @TERMCAP_LIB@
.c.o:
+ ${RM} $@
$(CC) $(CCFLAGS) -c $<
-EXECUTABLES = fileman rltest rl
-OBJECTS = fileman.o rltest.o rl.o
+EXECUTABLES = fileman rltest rl rlversion
+OBJECTS = fileman.o rltest.o rl.o rlversion.o
all: $(EXECUTABLES)
@@ -38,6 +39,9 @@ fileman: fileman.o
rltest: rltest.o
$(CC) $(LDFLAGS) -o $@ rltest.o -lreadline $(TERMCAP_LIB)
+rlversion: rlversion.o
+ $(CC) $(LDFLAGS) -o $@ rlversion.o -lreadline $(TERMCAP_LIB)
+
clean mostlyclean:
$(RM) $(OBJECTS)
$(RM) $(EXECUTABLES)
@@ -48,3 +52,4 @@ distclean maintainer-clean: clean
fileman.o: fileman.c
rltest.o: rltest.c
rl.o: rl.c
+rlversion.o: rlversion.c
diff --git a/examples/rl.c b/examples/rl.c
index ccddd0f..17a6343 100644
--- a/examples/rl.c
+++ b/examples/rl.c
@@ -42,6 +42,7 @@ set_deftext ()
}
}
+static void
usage()
{
fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n",
@@ -54,7 +55,7 @@ main (argc, argv)
{
char *temp, *prompt;
struct stat sb;
- int done, opt, fd;
+ int opt, fd;
FILE *ifp;
progname = strrchr(argv[0], '/');
diff --git a/examples/rlversion.c b/examples/rlversion.c
new file mode 100644
index 0000000..2d73a96
--- /dev/null
+++ b/examples/rlversion.c
@@ -0,0 +1,21 @@
+/*
+ * rlversion -- print out readline's version number
+ */
+
+#define READLINE_LIBRARY
+
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+#include "posixstat.h"
+
+#include "readline.h"
+
+main()
+{
+ printf ("%s\n", rl_library_version ? rl_library_version : "unknown");
+ exit (0);
+}