summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.in13
-rw-r--r--examples/autoconf/BASH_CHECK_LIB_TERMCAP5
-rw-r--r--examples/excallback.c2
-rw-r--r--examples/fileman.c170
-rw-r--r--examples/hist_erasedups.c10
-rw-r--r--examples/hist_purgecmd.c12
-rw-r--r--examples/histexamp.c10
-rw-r--r--examples/manexamp.c42
-rw-r--r--examples/rl-timeout.c12
-rw-r--r--examples/rl.c14
-rw-r--r--examples/rlcat.c18
-rw-r--r--examples/rlevent.c10
-rw-r--r--examples/rlptytest.c19
-rw-r--r--examples/rltest.c6
14 files changed, 172 insertions, 171 deletions
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 291c6b7..20a9896 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -71,7 +71,8 @@ TERMCAP_LIB = @TERMCAP_LIB@
SOURCES = excallback.c fileman.c histexamp.c manexamp.c rl-fgets.c rl.c \
rlbasic.c rlcat.c rlevent.c rlptytest.c rltest.c rlversion.c \
- rltest2.c rl-callbacktest.c hist_erasedups.c hist_purgecmd.c \
+ rl-callbacktest.c rl-callbacktest2.c rl-callbacktest3.c \
+ hist_erasedups.c hist_purgecmd.c \
rlkeymaps.c rl-timeout.c
EXECUTABLES = fileman$(EXEEXT) rltest$(EXEEXT) rl$(EXEEXT) rlcat$(EXEEXT) \
@@ -81,7 +82,7 @@ EXECUTABLES = fileman$(EXEEXT) rltest$(EXEEXT) rl$(EXEEXT) rlcat$(EXEEXT) \
rlkeymaps$(EXEEXT) rl-timeout$(EXEEXT)
OBJECTS = fileman.o rltest.o rl.o rlevent.o rlcat.o rlversion.o histexamp.o \
- rltest2.o rl-callbacktest.o rlbasic.o hist_erasedups.o hist_purgecmd.o \
+ rl-callbacktest.o rlbasic.o hist_erasedups.o hist_purgecmd.o \
rlkeymaps.o rl-timeout.o
OTHEREXE = rlptytest$(EXEEXT)
@@ -138,6 +139,12 @@ rltest2$(EXEEXT): rltest2.o $(READLINE_LIB)
rl-callbacktest$(EXEEXT): rl-callbacktest.o $(READLINE_LIB)
$(CC) $(LDFLAGS) -o $@ rl-callbacktest.o $(READLINE_LIB) $(TERMCAP_LIB)
+rl-callbacktest2$(EXEEXT): rl-callbacktest2.o $(READLINE_LIB)
+ $(CC) $(LDFLAGS) -o $@ rl-callbacktest2.o $(READLINE_LIB) $(TERMCAP_LIB)
+
+rl-callbacktest3$(EXEEXT): rl-callbacktest3.o $(READLINE_LIB)
+ $(CC) $(LDFLAGS) -o $@ rl-callbacktest3.o $(READLINE_LIB) $(TERMCAP_LIB)
+
rlptytest$(EXEEXT): rlptytest.o $(READLINE_LIB)
$(CC) $(LDFLAGS) -o $@ rlptytest.o $(READLINE_LIB) $(TERMCAP_LIB) $(LIBUTIL)
@@ -164,6 +171,7 @@ distclean maintainer-clean: clean
$(RM) Makefile
fileman.o: fileman.c
+manexamp.o: manexamp.c
rltest.o: rltest.c
rltest2.o: rltest2.c
rl.o: rl.c
@@ -179,6 +187,7 @@ rl-callbacktest.o: rl-callbacktest.c
rl-timeout.o: rl-timeout.c
fileman.o: $(top_srcdir)/readline.h
+manexamp.o: $(top_srcdir)/readline.h
rltest.o: $(top_srcdir)/readline.h
rltest2.o: $(top_srcdir)/readline.h $(top_srcdir)/history.h
rl.o: $(top_srcdir)/readline.h
diff --git a/examples/autoconf/BASH_CHECK_LIB_TERMCAP b/examples/autoconf/BASH_CHECK_LIB_TERMCAP
index 0a09883..7047d72 100644
--- a/examples/autoconf/BASH_CHECK_LIB_TERMCAP
+++ b/examples/autoconf/BASH_CHECK_LIB_TERMCAP
@@ -31,11 +31,14 @@ TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libncurses; then
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
+elif test $bash_cv_termcap_lib = libcurses; then
+TERMCAP_LIB=-lcurses
+TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libc; then
TERMCAP_LIB=
TERMCAP_DEP=
else
-TERMCAP_LIB=-lcurses
+TERMCAP_LIB=-lncurses
TERMCAP_DEP=
fi
])
diff --git a/examples/excallback.c b/examples/excallback.c
index 923c923..04ecb14 100644
--- a/examples/excallback.c
+++ b/examples/excallback.c
@@ -102,7 +102,7 @@ cc_t old_vtime;
struct termios term;
int
-main()
+main(int c, char **v)
{
fd_set fds;
diff --git a/examples/fileman.c b/examples/fileman.c
index 2a8b097..c26bccf 100644
--- a/examples/fileman.c
+++ b/examples/fileman.c
@@ -1,6 +1,6 @@
/* fileman.c - file manager example for readline library. */
-/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2009,2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
@@ -61,24 +61,24 @@
# include <readline/history.h>
#endif
-extern char *xmalloc PARAMS((size_t));
+extern char *xmalloc (size_t);
-void initialize_readline PARAMS((void));
-void too_dangerous PARAMS((char *));
+void initialize_readline (void);
+void too_dangerous (char *);
-int execute_line PARAMS((char *));
-int valid_argument PARAMS((char *, char *));
+int execute_line (char *);
+int valid_argument (char *, char *);
/* The names of functions that actually do the manipulation. */
-int com_list PARAMS((char *));
-int com_view PARAMS((char *));
-int com_rename PARAMS((char *));
-int com_stat PARAMS((char *));
-int com_pwd PARAMS((char *));
-int com_delete PARAMS((char *));
-int com_help PARAMS((char *));
-int com_cd PARAMS((char *));
-int com_quit PARAMS((char *));
+int com_list (char *);
+int com_view (char *);
+int com_rename (char *);
+int com_stat (char *);
+int com_pwd (char *);
+int com_delete (char *);
+int com_help (char *);
+int com_cd (char *);
+int com_quit (char *);
/* A structure which contains information on the commands this program
can understand. */
@@ -105,8 +105,11 @@ COMMAND commands[] = {
};
/* Forward declarations. */
-char *stripwhite ();
-COMMAND *find_command ();
+char *dupstr (char *);
+int execute_line (char *);
+char *stripwhite (char *);
+
+COMMAND *find_command (char *);
/* The name of this program, as taken from argv[0]. */
char *progname;
@@ -115,8 +118,7 @@ char *progname;
int done;
char *
-dupstr (s)
- char *s;
+dupstr (char *s)
{
char *r;
@@ -125,45 +127,9 @@ dupstr (s)
return (r);
}
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- char *line, *s;
-
- progname = argv[0];
-
- initialize_readline (); /* Bind our completer. */
-
- /* Loop reading and executing lines until the user quits. */
- for ( ; done == 0; )
- {
- line = readline ("FileMan: ");
-
- if (!line)
- break;
-
- /* Remove leading and trailing whitespace from the line.
- Then, if there is anything left, add it to the history list
- and execute it. */
- s = stripwhite (line);
-
- if (*s)
- {
- add_history (s);
- execute_line (s);
- }
-
- free (line);
- }
- exit (0);
-}
-
/* Execute a command line. */
int
-execute_line (line)
- char *line;
+execute_line (char *line)
{
register int i;
COMMAND *command;
@@ -202,8 +168,7 @@ execute_line (line)
/* Look up NAME as the name of a command, and return a pointer to that
command. Return a NULL pointer if NAME isn't a command name. */
COMMAND *
-find_command (name)
- char *name;
+find_command (char *name)
{
register int i;
@@ -217,8 +182,7 @@ find_command (name)
/* Strip whitespace from the start and end of STRING. Return a pointer
into STRING. */
char *
-stripwhite (string)
- char *string;
+stripwhite (char *string)
{
register char *s, *t;
@@ -242,14 +206,14 @@ stripwhite (string)
/* */
/* **************************************************************** */
-char *command_generator PARAMS((const char *, int));
-char **fileman_completion PARAMS((const char *, int, int));
+char *command_generator (const char *, int);
+char **fileman_completion (const char *, int, int);
/* Tell the GNU Readline library how to complete. We want to try to complete
on command names if this is the first word in the line, or on filenames
if not. */
void
-initialize_readline ()
+initialize_readline (void)
{
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "FileMan";
@@ -264,9 +228,7 @@ initialize_readline ()
in case we want to do some simple parsing. Return the array of matches,
or NULL if there aren't any. */
char **
-fileman_completion (text, start, end)
- const char *text;
- int start, end;
+fileman_completion (const char *text, int start, int end)
{
char **matches;
@@ -285,9 +247,7 @@ fileman_completion (text, start, end)
to start from scratch; without any state (i.e. STATE == 0), then we
start at the top of the list. */
char *
-command_generator (text, state)
- const char *text;
- int state;
+command_generator (const char *text, int state)
{
static int list_index, len;
char *name;
@@ -326,43 +286,39 @@ static char syscom[1024];
/* List the file(s) named in arg. */
int
-com_list (arg)
- char *arg;
+com_list (char *arg)
{
if (!arg)
arg = "";
- sprintf (syscom, "ls -FClg %s", arg);
+ snprintf (syscom, sizeof (syscom), "ls -FClg %s", arg);
return (system (syscom));
}
int
-com_view (arg)
- char *arg;
+com_view (char *arg)
{
if (!valid_argument ("view", arg))
return 1;
#if defined (__MSDOS__)
/* more.com doesn't grok slashes in pathnames */
- sprintf (syscom, "less %s", arg);
+ snprintf (syscom, sizeof (syscom), "less %s", arg);
#else
- sprintf (syscom, "more %s", arg);
+ snprintf (syscom, sizeof (syscom), "more %s", arg);
#endif
return (system (syscom));
}
int
-com_rename (arg)
- char *arg;
+com_rename (char *arg)
{
too_dangerous ("rename");
return (1);
}
int
-com_stat (arg)
- char *arg;
+com_stat (char *arg)
{
struct stat finfo;
@@ -390,8 +346,7 @@ com_stat (arg)
}
int
-com_delete (arg)
- char *arg;
+com_delete (char *arg)
{
too_dangerous ("delete");
return (1);
@@ -400,8 +355,7 @@ com_delete (arg)
/* Print out help for ARG, or for all of the commands if ARG is
not present. */
int
-com_help (arg)
- char *arg;
+com_help (char *arg)
{
register int i;
int printed = 0;
@@ -440,8 +394,7 @@ com_help (arg)
/* Change to the directory ARG. */
int
-com_cd (arg)
- char *arg;
+com_cd (char *arg)
{
if (chdir (arg) == -1)
{
@@ -455,8 +408,7 @@ com_cd (arg)
/* Print out the current working directory. */
int
-com_pwd (ignore)
- char *ignore;
+com_pwd (char *ignore)
{
char dir[1024], *s;
@@ -473,8 +425,7 @@ com_pwd (ignore)
/* The user wishes to quit using this program. Just set DONE non-zero. */
int
-com_quit (arg)
- char *arg;
+com_quit (char *arg)
{
done = 1;
return (0);
@@ -482,8 +433,7 @@ com_quit (arg)
/* Function which tells you that you can't do this. */
void
-too_dangerous (caller)
- char *caller;
+too_dangerous (char *caller)
{
fprintf (stderr,
"%s: Too dangerous for me to distribute. Write it yourself.\n",
@@ -493,8 +443,7 @@ too_dangerous (caller)
/* Return non-zero if ARG is a valid argument for CALLER, else print
an error message and return zero. */
int
-valid_argument (caller, arg)
- char *caller, *arg;
+valid_argument (char *caller, char *arg)
{
if (!arg || !*arg)
{
@@ -504,3 +453,36 @@ valid_argument (caller, arg)
return (1);
}
+
+int
+main (int argc, char **argv)
+{
+ char *line, *s;
+
+ progname = argv[0];
+
+ initialize_readline (); /* Bind our completer. */
+
+ /* Loop reading and executing lines until the user quits. */
+ for ( ; done == 0; )
+ {
+ line = readline ("FileMan: ");
+
+ if (!line)
+ break;
+
+ /* Remove leading and trailing whitespace from the line.
+ Then, if there is anything left, add it to the history list
+ and execute it. */
+ s = stripwhite (line);
+
+ if (*s)
+ {
+ add_history (s);
+ execute_line (s);
+ }
+
+ free (line);
+ }
+ exit (0);
+}
diff --git a/examples/hist_erasedups.c b/examples/hist_erasedups.c
index f820eba..717bb7e 100644
--- a/examples/hist_erasedups.c
+++ b/examples/hist_erasedups.c
@@ -1,6 +1,6 @@
/* hist_erasedups -- remove all duplicate entries from history file */
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2011,2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
@@ -41,16 +41,14 @@
int hist_erasedups (void);
static void
-usage()
+usage(void)
{
fprintf (stderr, "hist_erasedups: usage: hist_erasedups [-t] [filename]\n");
exit (2);
}
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
char *fn;
int r;
@@ -94,7 +92,7 @@ main (argc, argv)
}
int
-hist_erasedups ()
+hist_erasedups (void)
{
int r, n;
HIST_ENTRY *h, *temp;
diff --git a/examples/hist_purgecmd.c b/examples/hist_purgecmd.c
index 7992d81..3adb699 100644
--- a/examples/hist_purgecmd.c
+++ b/examples/hist_purgecmd.c
@@ -1,7 +1,7 @@
/* hist_purgecmd -- remove all instances of command or pattern from history
file */
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2011,2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
@@ -46,16 +46,14 @@
int hist_purgecmd (char *, int);
static void
-usage()
+usage(void)
{
fprintf (stderr, "hist_purgecmd: usage: hist_purgecmd [-r] [-t] [-f filename] command-spec\n");
exit (2);
}
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
char *fn;
int r, flags;
@@ -109,9 +107,7 @@ main (argc, argv)
}
int
-hist_purgecmd (cmd, flags)
- char *cmd;
- int flags;
+hist_purgecmd (char *cmd, int flags)
{
int r, n, rflags;
HIST_ENTRY *temp;
diff --git a/examples/histexamp.c b/examples/histexamp.c
index 309d769..2e946ac 100644
--- a/examples/histexamp.c
+++ b/examples/histexamp.c
@@ -32,9 +32,7 @@
#include <string.h>
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
char line[1024], *t;
int len, done;
@@ -91,6 +89,7 @@ main (argc, argv)
register HIST_ENTRY **the_list;
register int i;
time_t tt;
+ struct tm *tm;
char timestr[128];
the_list = history_list ();
@@ -98,8 +97,9 @@ main (argc, argv)
for (i = 0; the_list[i]; i++)
{
tt = history_get_time (the_list[i]);
- if (tt)
- strftime (timestr, sizeof (timestr), "%a %R", localtime(&tt));
+ tm = tt ? localtime (&tt) : 0;
+ if (tm)
+ strftime (timestr, sizeof (timestr), "%a %R", tm);
else
strcpy (timestr, "??");
printf ("%d: %s: %s\n", i + history_base, timestr, the_list[i]->line);
diff --git a/examples/manexamp.c b/examples/manexamp.c
index 351c628..c8e11d5 100644
--- a/examples/manexamp.c
+++ b/examples/manexamp.c
@@ -1,6 +1,6 @@
/* manexamp.c -- The examples which appear in the documentation are here. */
-/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2009,2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
@@ -18,9 +18,35 @@
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+
+#include <stdlib.h>
#include <stdio.h>
-#include <readline/readline.h>
+
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+
+#include <locale.h>
+
+#ifndef errno
+extern int errno;
+#endif
+
+#if defined (READLINE_LIBRARY)
+# include "readline.h"
+# include "history.h"
+#else
+# include <readline/readline.h>
+# include <readline/history.h>
+#endif
/* **************************************************************** */
/* */
@@ -33,7 +59,7 @@ static char *line_read = (char *)NULL;
/* Read a string, and return a pointer to it. Returns NULL on EOF. */
char *
-rl_gets ()
+rl_gets (void)
{
/* If the buffer has already been allocated, return the memory
to the free pool. */
@@ -60,10 +86,11 @@ rl_gets ()
/* **************************************************************** */
/* Invert the case of the COUNT following characters. */
-invert_case_line (count, key)
- int count, key;
+int
+invert_case_line (int count, int key)
{
- register int start, end;
+ int start, end;
+ int direction;
start = rl_point;
@@ -92,7 +119,7 @@ invert_case_line (count, key)
}
if (start == end)
- return;
+ return 0;
/* Tell readline that we are modifying the line, so save the undo
information. */
@@ -108,4 +135,5 @@ invert_case_line (count, key)
/* Move point to on top of the last character changed. */
rl_point = end - direction;
+ return 0;
}
diff --git a/examples/rl-timeout.c b/examples/rl-timeout.c
index b8a24ba..81f00f5 100644
--- a/examples/rl-timeout.c
+++ b/examples/rl-timeout.c
@@ -56,7 +56,7 @@ const char *prompt = "rl-timeout$ ";
/* **************************************************************** */
void
-rltest_timeout_readline1 ()
+rltest_timeout_readline1 (void)
{
const char *temp;
@@ -78,14 +78,14 @@ rltest_timeout_readline1 ()
/* **************************************************************** */
static int
-timeout_handler ()
+timeout_handler (void)
{
printf ("timeout\n");
return READERR;
}
void
-rltest_timeout_readline2 ()
+rltest_timeout_readline2 (void)
{
const char *temp;
@@ -134,7 +134,7 @@ cb_linehandler (char *line)
}
void
-rltest_timeout_callback1 ()
+rltest_timeout_callback1 (void)
{
fd_set fds;
int r;
@@ -180,7 +180,7 @@ rltest_timeout_callback1 ()
/* **************************************************************** */
static int
-cb_timeouthandler ()
+cb_timeouthandler (void)
{
printf ("timeout\n");
rl_callback_handler_remove ();
@@ -189,7 +189,7 @@ cb_timeouthandler ()
}
void
-rltest_timeout_callback2 ()
+rltest_timeout_callback2 (void)
{
int r;
diff --git a/examples/rl.c b/examples/rl.c
index 39e5b8e..dd8f88d 100644
--- a/examples/rl.c
+++ b/examples/rl.c
@@ -5,7 +5,7 @@
* usage: rl [-p prompt] [-u unit] [-d default] [-n nchars]
*/
-/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
@@ -55,15 +55,11 @@ extern void exit();
extern int optind;
extern char *optarg;
-#if !defined (strchr) && !defined (__STDC__)
-extern char *strrchr();
-#endif
-
static char *progname;
static char *deftext;
static int
-set_deftext ()
+set_deftext (void)
{
if (deftext)
{
@@ -75,16 +71,14 @@ set_deftext ()
}
static void
-usage()
+usage(void)
{
fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n",
progname, progname);
}
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
char *temp, *prompt;
struct stat sb;
diff --git a/examples/rlcat.c b/examples/rlcat.c
index f1b0362..419a197 100644
--- a/examples/rlcat.c
+++ b/examples/rlcat.c
@@ -4,7 +4,7 @@
* usage: rlcat
*/
-/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2009,2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
@@ -64,21 +64,20 @@ extern int errno;
extern int optind;
extern char *optarg;
-static int stdcat();
+static int fcopy(FILE *);
+static int stdcat(int, char **);
static char *progname;
static int vflag;
static void
-usage()
+usage(void)
{
fprintf (stderr, "%s: usage: %s [-vEVN] [filename]\n", progname, progname);
}
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
char *temp;
int opt, Vflag, Nflag;
@@ -134,8 +133,7 @@ main (argc, argv)
}
static int
-fcopy(fp)
- FILE *fp;
+fcopy(FILE *fp)
{
int c;
char *x;
@@ -155,9 +153,7 @@ fcopy(fp)
}
int
-stdcat (argc, argv)
- int argc;
- char **argv;
+stdcat (int argc, char **argv)
{
int i, fd, r;
char *s;
diff --git a/examples/rlevent.c b/examples/rlevent.c
index 1b7f4eb..57e4b4b 100644
--- a/examples/rlevent.c
+++ b/examples/rlevent.c
@@ -69,7 +69,7 @@ static char *progname;
static char *deftext;
static int
-event_hook ()
+event_hook (void)
{
fprintf (stderr, "ding!\n");
sleep (1);
@@ -77,7 +77,7 @@ event_hook ()
}
static int
-set_deftext ()
+set_deftext (void)
{
if (deftext)
{
@@ -89,16 +89,14 @@ set_deftext ()
}
static void
-usage()
+usage(void)
{
fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n",
progname, progname);
}
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
char *temp, *prompt;
struct stat sb;
diff --git a/examples/rlptytest.c b/examples/rlptytest.c
index d170f62..021a868 100644
--- a/examples/rlptytest.c
+++ b/examples/rlptytest.c
@@ -42,8 +42,7 @@ static int masterfd = -1;
static int slavefd;
void
-sigint (s)
- int s;
+sigint (int s)
{
tty_reset (STDIN_FILENO);
close (masterfd);
@@ -53,14 +52,13 @@ sigint (s)
}
void
-sigwinch (s)
- int s;
+sigwinch (int s)
{
rl_resize_terminal ();
}
static int
-user_input()
+user_input(void)
{
int size;
const int MAX = 1024;
@@ -78,7 +76,7 @@ user_input()
}
static int
-readline_input()
+readline_input(void)
{
const int MAX = 1024;
char *buf = (char *)malloc(MAX+1);
@@ -124,7 +122,7 @@ rlctx_send_user_command(char *line)
}
static void
-custom_deprep_term_function ()
+custom_deprep_term_function (void)
{
}
@@ -226,9 +224,10 @@ static enum { RESET, TCBREAK } ttystate = RESET;
*
* Returns: 0 on success, -1 on error
*/
-int tty_cbreak(int fd){
+int tty_cbreak(int fd)
+{
struct termios buf;
- int ttysavefd = -1;
+ int ttysavefd = -1;
if(tcgetattr(fd, &save_termios) < 0)
return -1;
@@ -316,7 +315,7 @@ int tty_reset(int fd)
}
int
-main()
+main(int c, char **v)
{
int val;
diff --git a/examples/rltest.c b/examples/rltest.c
index 8b7c00c..feab90f 100644
--- a/examples/rltest.c
+++ b/examples/rltest.c
@@ -4,7 +4,7 @@
/* */
/* **************************************************************** */
-/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2009,2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
@@ -48,10 +48,8 @@ extern void exit();
# include <readline/history.h>
#endif
-extern HIST_ENTRY **history_list ();
-
int
-main ()
+main (int c, char **v)
{
char *temp, *prompt;
int done;