diff options
author | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2000-07-09 16:21:23 +0000 |
---|---|---|
committer | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2000-07-09 16:21:23 +0000 |
commit | f9267e152c9c4e2b150366c590674180e66d45df (patch) | |
tree | e7e5dfd0d642c0a71503684b9eaff7da99c50562 /readline/examples/fileman.c | |
parent | a44161c313d46a1b10fd764728a089c26037710a (diff) | |
download | fsf-binutils-gdb-f9267e152c9c4e2b150366c590674180e66d45df.zip fsf-binutils-gdb-f9267e152c9c4e2b150366c590674180e66d45df.tar.gz fsf-binutils-gdb-f9267e152c9c4e2b150366c590674180e66d45df.tar.bz2 |
Import of readline 4.1
Diffstat (limited to 'readline/examples/fileman.c')
-rw-r--r-- | readline/examples/fileman.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/readline/examples/fileman.c b/readline/examples/fileman.c index 0702a5b..dc29a40 100644 --- a/readline/examples/fileman.c +++ b/readline/examples/fileman.c @@ -1,22 +1,22 @@ /* 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> +# include <config.h> #endif #include <sys/types.h> #ifdef HAVE_SYS_FILE_H -#include <sys/file.h> +# include <sys/file.h> #endif #include <sys/stat.h> +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#include <fcntl.h> #include <stdio.h> #include <errno.h> @@ -26,6 +26,10 @@ # include <strings.h> #endif /* !HAVE_STRING_H */ +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif + #ifdef READLINE_LIBRARY # include "readline.h" # include "history.h" @@ -34,7 +38,6 @@ # include <readline/history.h> #endif -extern char *getwd (); extern char *xmalloc (); /* The names of functions that actually do the manipulation. */ @@ -300,7 +303,12 @@ com_view (arg) if (!valid_argument ("view", arg)) return 1; +#if defined (__MSDOS__) + /* more.com doesn't grok slashes in pathnames */ + sprintf (syscom, "less %s", arg); +#else sprintf (syscom, "more %s", arg); +#endif return (system (syscom)); } @@ -406,7 +414,7 @@ com_pwd (ignore) { char dir[1024], *s; - s = getwd (dir); + s = getcwd (dir, sizeof(dir) - 1); if (s == 0) { printf ("Error getting pwd: %s\n", dir); |