aboutsummaryrefslogtreecommitdiffstats
path: root/lib/readline/examples/fileman.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1997-06-05 14:59:13 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:50 +0000
commitd166f048818e10cf3799aa24a174fb22835f1acc (patch)
tree1ca27f9243900f8b236d0cde6a3862002aea9e19 /lib/readline/examples/fileman.c
parentccc6cda312fea9f0468ee65b8f368e9653e1380b (diff)
downloadandroid_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.gz
android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.bz2
android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.zip
Imported from ../bash-2.01.tar.gz.
Diffstat (limited to 'lib/readline/examples/fileman.c')
-rw-r--r--lib/readline/examples/fileman.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/lib/readline/examples/fileman.c b/lib/readline/examples/fileman.c
index 8709120..0702a5b 100644
--- a/lib/readline/examples/fileman.c
+++ b/lib/readline/examples/fileman.c
@@ -1,15 +1,38 @@
/* fileman.c -- A tiny application which demonstrates how to use the
GNU Readline library. This application interactively allows users
to manipulate files and their modes. */
+/*
+ * Remove the next line if you're compiling this against an installed
+ * libreadline.a
+ */
+#define READLINE_LIBRARY
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
-#include <stdio.h>
#include <sys/types.h>
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
+#endif
#include <sys/stat.h>
-#include <sys/errno.h>
-#include <readline/readline.h>
-#include <readline/history.h>
+#include <stdio.h>
+#include <errno.h>
+
+#if defined (HAVE_STRING_H)
+# include <string.h>
+#else /* !HAVE_STRING_H */
+# include <strings.h>
+#endif /* !HAVE_STRING_H */
+
+#ifdef READLINE_LIBRARY
+# include "readline.h"
+# include "history.h"
+#else
+# include <readline/readline.h>
+# include <readline/history.h>
+#endif
extern char *getwd ();
extern char *xmalloc ();
@@ -54,7 +77,7 @@ int done;
char *
dupstr (s)
- int s;
+ char *s;
{
char *r;
@@ -304,7 +327,8 @@ com_stat (arg)
printf ("Statistics for `%s':\n", arg);
- printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
+ printf ("%s has %d link%s, and is %d byte%s in length.\n",
+ arg,
finfo.st_nlink,
(finfo.st_nlink == 1) ? "" : "s",
finfo.st_size,