|
From: Peter K. <pk...@us...> - 2001-03-09 13:16:14
|
The following files were modified in apps/bluetooth/btd:
Name Old version New version Comment
---- ----------- ----------- -------
Makefile 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20
btd.c 1.84 1.85=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Support for compiling without readline (by Matthias Fuchs).
The diff of the modified file(s):
--- Makefile 2000/12/14 16:40:31 1.5
+++ Makefile 2001/03/09 13:18:02 1.6
@@ -16,8 +16,22 @@
=20
OBJS =3D btd.o
=20
+# Define HAVE_READLINE_READLINE if you have readline support, with the inc=
lude
+# files in $(include_dir)/readline. Define HAVE_READLINE if you have the
+# include files in $(include_dir). Define neither if you do not want to use
+# readline.
+HAVE_READLINE_READLINE =3D 1
+#HAVE_READLINE =3D 1
+
+ifdef HAVE_READLINE_READLINE
LDLIBS +=3D -lreadline -ltermcap
-CFLAGS +=3D -I$(prefix)/include
+CFLAGS +=3D -DHAVE_READLINE_READLINE -I$(prefix)/include
+endif
+
+ifdef HAVE_READLINE
+LDLIBS +=3D -lreadline -ltermcap
+CFLAGS +=3D -DHAVE_READLINE -I$(prefix)/include
+endif
=20
all: $(PROGS)
=20
--- btd.c 2001/03/05 11:15:55 1.84
+++ btd.c 2001/03/09 13:18:02 1.85
@@ -150,8 +150,13 @@
#include <sys/un.h>
#include <arpa/inet.h>
=20
+#if defined(HAVE_READLINE_READLINE)
#include <readline/readline.h>
#include <readline/history.h>
+#elif defined(HAVE_READLINE)
+#include <readline.h>
+#include <history.h>
+#endif
=20
#define RESTART_ENABLED
=20
@@ -322,6 +327,13 @@
#define MANUFACTURER_SPEC 0x3f
#endif
=20
+#if !defined(HAVE_READLINE) && !defined(HAVE_READLINE_READLINE)
+void read_history(char *hist_file_name);
+void write_history(char *hist_file_name);
+void add_history(char *command);
+char *readline(char *promt);
+#endif=20
+
/* Modem emulator stuff */
=20
#define CONNECT 1
@@ -776,6 +788,13 @@
{
char *line =3D readline("> ");
int tmp;
+
+ if (!line)
+ {
+ start_ppp =3D 0;
+ break;
+ }
+
add_history(line);
=20=20=20=20=20=20=20
tmp =3D process_cmd(line, bt_cfd);
@@ -789,6 +808,7 @@
start_ppp =3D 0;
break;
}
+=20=20=20=20=20=20
free(line);
}
write_history(BTD_HISTORY_FILE);
@@ -860,6 +880,42 @@
syslog(LOG_INFO, "ppp child died, now restart!\n\n\n");
}
}
+
+/* readline replacement - mfuchs */
+#if !defined(HAVE_READLINE) && !defined(HAVE_READLINE_READLINE)
+#define MAXLINE 100
+
+void read_history(char *hist_file_name)
+{
+}
+
+void write_history(char *hist_file_name)
+{
+}
+
+void add_history(char *command)
+{
+}
+
+char *readline(char *promt)
+{
+ int len;
+ char *line;
+
+ if ((line =3D malloc(MAXLINE)))
+ {
+ printf("%s", promt);
+ fflush(stdout);
+ *line =3D 0;
+ if ((len =3D read(STDIN_FILENO, line, MAXLINE-1)) >=3D 0)
+ {
+ line[len] =3D 0;
+ }
+ }
+
+ return line;
+}
+#endif /* !HAVE_READLINE */
=20
#ifndef BTD_USERSTACK
static void start_sdp_server(void)
|