RM = rm -f
-#HEADERS= foo.h bar.h baz.h
+HEADERS= pd_readline.h
-OBJECTS = pd_readline.o keyhandler.o funcs.o history.o
+OBJECTS = keyhandler.o funcs.o history.o pd_readline.o
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
pd_readline: $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS)
-#pd_readline.o: $(HEADERS)
+pd_readline.o: $(HEADERS)
#keyhandler.o: $(HEADERS)
#funcs.o: $(HEADERS)
#history.o: $(HEADERS)
{
int i = getch();
- switch(i);
+ switch(i)
{
case (27): escape() ;
case (33): dosomething();
case (42): something();
- default: stuff():
+ default: stuff();
}
}
/* Ctrl-C and Ctrl-V. */
-
+#include "pd_readline.h"
int main(void)
{
/* Read in the command history file. */
- readhistory();
+ readhistory("test.txt");
while(1)
--- /dev/null
+
+
+/* pd_readline.h */
+/* Header file for pd_readline. */
+/* This code is released to the public domain. */
+/* "Share and enjoy...." ;) */
+/* See the UNLICENSE file for details. */
+
+
+/* Buffer typedef. */
+typedef struct {
+ int index;
+ char array[80] ;
+} buf;
+
+
+
+/* Cursor movement funcs. */
+int up(int i);
+int down(int i);
+buf left(buf b);
+buf right(buf b);
+buf delch(buf b);
+buf insch(buf b);
+
+/* Escape-key handling. */
+int esc(int i);
+
+/* Other funcs. */
+void readhistory(char *fname);
+int keyhandler(void);
+
+
+
+
+
+
+
+
+