Applied Bjorn Andersson's autoconf/automake patch. LCDproc is now built
with the standard "./autogen.sh && ./configure && make && make install" instead of just tweaking the Makefile and typing "make".
This commit is contained in:
@@ -1,133 +0,0 @@
|
||||
include Makefile.config
|
||||
|
||||
########################################################################
|
||||
# Please edit Makefile.config to configure LCDproc for your system.
|
||||
########################################################################
|
||||
|
||||
|
||||
########################################################################
|
||||
# You shouldn't need to touch anything below here.
|
||||
########################################################################
|
||||
|
||||
#GCC = gcc -Wall -Wp,-lang-c-c++-comments -O6
|
||||
DIRS = shared clients/lcdproc clients server/drivers server
|
||||
TARGETS = server clients shared
|
||||
SOURCES = Makefile \
|
||||
shared/Makefile \
|
||||
shared/LL.c shared/LL.h \
|
||||
shared/config.c shared/config.h \
|
||||
shared/sockets.c shared/sockets.h \
|
||||
clients/Makefile \
|
||||
clients/mode.c clients/mode.h \
|
||||
tests/Makefile \
|
||||
server/Makefile \
|
||||
server/main.c server/main.h \
|
||||
server/lcd.c server/lcd.h \
|
||||
server/drv_base.c server/drv_base.h \
|
||||
server/drivers/MtxOrb.c server/drivers/MtxOrb.h \
|
||||
server/drivers/wirz-sli.c server/drivers/wirz-sli.h \
|
||||
server/drivers/text.c server/drivers/text.h \
|
||||
server/drivers/debug.c server/drivers/debug.h \
|
||||
server/drivers/curses_drv.c server/drivers/curses_drv.h \
|
||||
server/drivers/hd44780.c server/drivers/hd44780.h server/drivers/port.h
|
||||
EXTRAS = WHATSNEW INSTALL README COPYING TODO README.IRman \
|
||||
docs/menustuff.txt docs/netstuff.txt docs/README.dg \
|
||||
docs/README.dg2 docs/hd44780_howto.txt
|
||||
DOCS = docs/lcdproc.1
|
||||
#MISC += $(OS) $(DRIVERS)
|
||||
|
||||
|
||||
|
||||
###################################################################
|
||||
# Compilation...
|
||||
#
|
||||
|
||||
# TODO: Make sure lcdproc is configured first...
|
||||
#@NOTCONFIGURED=`find . -newer . -name Makefile.config`
|
||||
#@if [ $(NOTCONFIGURED) ]; do \
|
||||
# echo Please configure lcdproc before compiling! ;\
|
||||
# echo Edit "Makefile.config" to configure. ;\
|
||||
# exit 0 ;\
|
||||
#@done;
|
||||
all:
|
||||
@echo Compiling LCDproc...
|
||||
@for i in $(DIRS); do \
|
||||
(cd $$i; [ -f Makefile ] && $(MAKE) $@) \
|
||||
done; true
|
||||
|
||||
|
||||
server:
|
||||
cd server; $(MAKE)
|
||||
|
||||
clients:
|
||||
cd clients; $(MAKE)
|
||||
|
||||
shared:
|
||||
cd shared; $(MAKE)
|
||||
|
||||
tests:
|
||||
cd tests; $(MAKE)
|
||||
|
||||
|
||||
##################################################################
|
||||
# Installation
|
||||
#
|
||||
install: $(TARGETS) $(DOCS)
|
||||
@echo Installing LCDproc...
|
||||
# @echo Sorry! Cannot do that yet...
|
||||
# @echo Please read INSTALL for instructions
|
||||
@for i in $(DIRS); do \
|
||||
(cd $$i; [ -f Makefile ] && $(MAKE) $@) \
|
||||
done; true
|
||||
if [ ! -e /dev/lcd ]; then ln -s $(DEVICE) /dev/lcd ; chmod a+rw $(DEVICE) ; fi
|
||||
@echo "All done -- enjoy!"
|
||||
@echo "Be sure to verify that /dev/lcd points to the correct device."
|
||||
@ls -l /dev/lcd
|
||||
|
||||
# TODO: Have the installer insert lcdproc in system startup scripts?
|
||||
|
||||
|
||||
##################################################################
|
||||
# Other stuff...
|
||||
#
|
||||
clean:
|
||||
@for i in $(DIRS); do \
|
||||
(cd $$i; [ -f Makefile ] && $(MAKE) $@) \
|
||||
done
|
||||
rm -f *~ core
|
||||
|
||||
# Distribution file
|
||||
dist:
|
||||
@echo Making distributable tarball...
|
||||
make clean
|
||||
rm -rf lcdproc-$(VERSION)
|
||||
rm -rf lcdproc-$(VERSION).tar.gz
|
||||
mkdir lcdproc-$(VERSION)
|
||||
tar cBf - . --exclude CVS --exclude lcdproc-$(VERSION) | (cd lcdproc-$(VERSION) && tar xBfv -)
|
||||
tar cfv lcdproc-$(VERSION).tar lcdproc-$(VERSION)
|
||||
gzip lcdproc-$(VERSION).tar
|
||||
rm -rf lcdproc-$(VERSION)
|
||||
|
||||
# This includes source...
|
||||
#tarball:
|
||||
# tar cfv lcd.tar .
|
||||
# gzip lcd.tar
|
||||
|
||||
edit:
|
||||
emacs . &
|
||||
|
||||
.PHONY : todo
|
||||
todo :
|
||||
@echo ---------------===========================================
|
||||
@grep -n TODO\\\|FIXME `find . -type f` | grep -v grep
|
||||
@echo ---------------===========================================
|
||||
|
||||
#todo:
|
||||
# @echo ---------------===========================================
|
||||
# @grep TODO $(SOURCES) | grep -v SOURCES
|
||||
# @grep FIXME $(SOURCES) | grep -v SOURCES
|
||||
# @echo ---------------===========================================
|
||||
|
||||
#TODO: Keep updating the "Thank You's" section of the README.
|
||||
#TODO: Don't forget about homework!
|
||||
|
||||
-136
@@ -1,136 +0,0 @@
|
||||
########################################################################
|
||||
# Modify these variables to fit your system.
|
||||
########################################################################
|
||||
|
||||
##################### Installation base directory
|
||||
# This should point to /usr/local, for most people, or
|
||||
# to /usr if you want to integrate LCDproc into your main filesystem.
|
||||
INSTALL_DIR = /usr/local
|
||||
|
||||
##################### Serial device
|
||||
# This should be whatever your display is connected to.
|
||||
# "make install" will create a link from /dev/lcd to DEVICE
|
||||
# if you don't already have a /dev/lcd
|
||||
DEVICE = /dev/ttyS0
|
||||
|
||||
##################### Operating System
|
||||
# Uncomment the section for your OS.
|
||||
|
||||
### For Linux...
|
||||
OS=-DLINUX
|
||||
|
||||
### For BSD. We call it xBSD to
|
||||
# avoid a clash with the BSD in sys/param.h
|
||||
#OS=-DxBSD
|
||||
|
||||
### For IRIX...
|
||||
#OS=-DIRIX
|
||||
|
||||
### For Alpha processors...
|
||||
#CFLAGS += -mieee
|
||||
|
||||
##################### Inet port to use...
|
||||
# Use whatever you want...
|
||||
# The default is 13666
|
||||
LCDPORT=-DLCDPORT=13666
|
||||
|
||||
##################### Modescreen Options
|
||||
|
||||
##### Load Screen
|
||||
# Max: Load Avg at which the backlight will start blinking
|
||||
MISC += -DLOAD_MAX=1.3
|
||||
# Min: Load Avg at which the backlight will turn off (asleep)
|
||||
MISC += -DLOAD_MIN=0.05
|
||||
|
||||
##### Filesystems to display stats for... (comment out ones you don't want)
|
||||
# NFS (Network File System)
|
||||
MISC += -DSTAT_NFS
|
||||
# SMBFS (Samba filesystem -- Windows drives)
|
||||
MISC += -DSTAT_SMBFS
|
||||
|
||||
|
||||
##################### Drivers
|
||||
# Comment out each section you don't want.
|
||||
|
||||
# Matrix-Orbital displays
|
||||
DRIVERS += -DMTXORB_DRV
|
||||
DOBJ += MtxOrb.o
|
||||
|
||||
# Wirz SLI
|
||||
DRIVERS += -DSLI_DRV
|
||||
DOBJ += wirz-sli.o
|
||||
|
||||
# CrystalFontz displays
|
||||
DRIVERS += -DCFONTZ_DRV
|
||||
DOBJ += CFontz.o
|
||||
|
||||
# Curses text-based output
|
||||
DRIVERS += -DCURSES_DRV
|
||||
DOBJ += curses_drv.o
|
||||
LIB += -lncurses
|
||||
|
||||
# Regular text output (ugly)
|
||||
DRIVERS += -DTEXT_DRV
|
||||
DOBJ += text.o
|
||||
|
||||
# HD44780 parallel port lcd displays
|
||||
#DRIVERS += -DHD44780_DRV
|
||||
#DOBJ += hd44780.o
|
||||
# Pick one of the following ports to use
|
||||
#LPTPORT = 0x378
|
||||
#LPTPORT = 0x278
|
||||
#LPTPORT = 0x3bc
|
||||
|
||||
# Joystick input... handy!
|
||||
DRIVERS += -DJOY_DRV
|
||||
DOBJ += joy.o
|
||||
|
||||
# Irman input... handy!
|
||||
#DRIVERS += -DIRMANIN_DRV
|
||||
#DOBJ += irmanin.o ../../../libirman-0.4.1b/libirman.a
|
||||
#IRMAN=1
|
||||
|
||||
|
||||
##################### Debugging Options
|
||||
# Please uncomment only one of these two, and comment the other:
|
||||
# Uncomment this to build a debugging executable
|
||||
#DEBUG = -g -DDEBUG
|
||||
# If the above is commented, this shouldn't be...
|
||||
MISC += -Wno-unused
|
||||
|
||||
|
||||
########################################################################
|
||||
# You shouldn't need to touch anything below here.
|
||||
########################################################################
|
||||
|
||||
GCC = gcc -Wall -Wp,-lang-c-c++-comments -O6 $(CFLAGS)
|
||||
VERSION = 0.4-pre9
|
||||
MISC += $(OS) $(DRIVERS) $(DEBUG) $(LCDPORT) -DVERSION=\"$(VERSION)\"
|
||||
|
||||
|
||||
###################################################################
|
||||
# Compilation...
|
||||
#
|
||||
#all:
|
||||
# @echo Compiling LCDproc...
|
||||
# @for i in $(DIRS); do \
|
||||
# (cd $$i; [ -f Makefile ] && $(MAKE) $@) \
|
||||
# done; true
|
||||
|
||||
##################################################################
|
||||
# Other stuff...
|
||||
#
|
||||
#clean:
|
||||
# @for i in $(DIRS); do \
|
||||
# (cd $$i; [ -f Makefile ] && $(MAKE) $@) \
|
||||
# done
|
||||
# rm -f *~ core
|
||||
#
|
||||
#edit:
|
||||
# emacs . &
|
||||
|
||||
#.PHONY : todo
|
||||
#todo :
|
||||
# @echo ---------------===========================================
|
||||
# @grep -n TODO\\\|FIXME `find . -type f` | grep -v grep
|
||||
# @echo ---------------===========================================
|
||||
@@ -1,39 +0,0 @@
|
||||
########################################################################
|
||||
# You shouldn't need to touch anything below here.
|
||||
########################################################################
|
||||
include ../Makefile.config
|
||||
|
||||
DIRS = lcdproc
|
||||
TARGETS = lcdproc/lcdproc
|
||||
|
||||
###################################################################
|
||||
# Compilation...
|
||||
#
|
||||
all: $(TARGETS)
|
||||
for i in $(DIRS); do \
|
||||
(cd $$i; [ -f Makefile ] && $(MAKE) $@) \
|
||||
done
|
||||
|
||||
|
||||
##################################################################
|
||||
# Installation
|
||||
#
|
||||
install: $(TARGETS)
|
||||
@echo Installing LCD clients...
|
||||
for i in $(DIRS); do \
|
||||
(cd $$i; [ -f Makefile ] && $(MAKE) $@) \
|
||||
done; true
|
||||
|
||||
|
||||
##################################################################
|
||||
# Other stuff...
|
||||
#
|
||||
clean:
|
||||
for i in $(DIRS); do \
|
||||
(cd $$i; [ -f Makefile ] && $(MAKE) $@) \
|
||||
done; true
|
||||
rm -f *.o *~ core
|
||||
|
||||
edit:
|
||||
emacs . &
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
include ../../Makefile.config
|
||||
|
||||
########################################################################
|
||||
# You shouldn't need to touch anything below here.
|
||||
########################################################################
|
||||
|
||||
TARGET = lcdproc
|
||||
OBJ = main.o mode.o batt.o chrono.o cpu.o disk.o load.o mem.o
|
||||
LIB += -L../../shared -lLCDstuff
|
||||
|
||||
|
||||
###################################################################
|
||||
# Compilation...
|
||||
#
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJ) Makefile
|
||||
$(GCC) -s $(MISC) -o $(TARGET) $(OBJ) $(LIB)
|
||||
|
||||
%.o: %.c %.h Makefile
|
||||
$(GCC) -c $(MISC) $<
|
||||
|
||||
|
||||
##################################################################
|
||||
# Installation
|
||||
#
|
||||
install: $(TARGET)
|
||||
@echo ... lcdproc main client ...
|
||||
install -m 0755 -o root -g root $(TARGET) /usr/local/bin/
|
||||
|
||||
|
||||
##################################################################
|
||||
# Other stuff...
|
||||
#
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET) *~ core
|
||||
|
||||
edit:
|
||||
emacs . &
|
||||
|
||||
+4
-51
@@ -4,6 +4,10 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef LINUX
|
||||
#include <sys/vfs.h>
|
||||
#else
|
||||
@@ -85,57 +89,6 @@ static int get_fs(mounts fs[])
|
||||
return x;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int get_fs(mounts fs[])
|
||||
{
|
||||
struct statfs fsinfo;
|
||||
char line[256];
|
||||
int x = 0, y;
|
||||
|
||||
mtab_fd = fopen("/etc/mtab", "r");
|
||||
|
||||
// Get rid of old, unmounted filesystems...
|
||||
memset(fs, 0, sizeof(mounts)*256);
|
||||
|
||||
while (x < 256)
|
||||
{
|
||||
if(fgets(line, 256, mtab_fd) == NULL)
|
||||
{
|
||||
fclose(mtab_fd);
|
||||
return x;
|
||||
}
|
||||
|
||||
sscanf(line, "%s %s %s", fs[x].dev, fs[x].mpoint, fs[x].type);
|
||||
|
||||
if( strcmp(fs[x].type, "proc")
|
||||
#ifndef STAT_NFS
|
||||
&& strcmp(fs[x].type, "nfs")
|
||||
#endif
|
||||
#ifndef STAT_SMBFS
|
||||
&& strcmp(fs[x].type, "smbfs")
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef LINUX
|
||||
y = statfs(fs[x].mpoint, &fsinfo);
|
||||
#else
|
||||
y = statfs(fs[x].mpoint, &fsinfo, sizeof(fsinfo), 0);
|
||||
#endif
|
||||
fs[x].bsize = fsinfo.f_bsize;
|
||||
fs[x].blocks = fsinfo.f_blocks;
|
||||
fs[x].bfree = fsinfo.f_bfree;
|
||||
fs[x].files = fsinfo.f_files;
|
||||
fs[x].ffree = fsinfo.f_ffree;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(mtab_fd);
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int disk_init()
|
||||
{
|
||||
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "mode.h"
|
||||
#include "../../shared/sockets.h"
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
include ../Makefile.config
|
||||
|
||||
########################################################################
|
||||
# You shouldn't need to touch anything below here.
|
||||
########################################################################
|
||||
|
||||
TARGET = LCDd
|
||||
DIRS = drivers
|
||||
OBJ += sock.o clients.o parse.o client_functions.o client_data.o screen.o \
|
||||
widget.o screenlist.o render.o serverscreens.o main.o input.o \
|
||||
menu.o menus.o
|
||||
LIB += drivers/libLCDdrivers.a ../shared/libLCDstuff.a
|
||||
|
||||
ifeq ($(IRMAN),1)
|
||||
LIB += ../../libirman-0.4.1b/libirman.a
|
||||
endif
|
||||
|
||||
|
||||
include ../Makefile.config
|
||||
|
||||
###################################################################
|
||||
# Compilation...
|
||||
#
|
||||
#all: $(OBJ)
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJ) $(LIB) Makefile
|
||||
$(GCC) -s $(MISC) -o $(TARGET) $(OBJ) $(LIB)
|
||||
|
||||
%.o: %.c %.h Makefile
|
||||
$(GCC) -c $(MISC) $<
|
||||
|
||||
|
||||
##################################################################
|
||||
# Installation
|
||||
#
|
||||
install: $(TARGET)
|
||||
@echo Installing LCD Server...
|
||||
install -m 0755 -o root -g root $(TARGET) /usr/local/bin/
|
||||
|
||||
|
||||
##################################################################
|
||||
# Other stuff...
|
||||
#
|
||||
clean:
|
||||
@for i in $(DIRS); do \
|
||||
(cd $$i; [ -f Makefile ] && $(MAKE) $@) \
|
||||
done
|
||||
rm -f $(OBJ) $(TARGET) *~ core
|
||||
|
||||
edit:
|
||||
emacs . &
|
||||
@@ -1,45 +0,0 @@
|
||||
########################################################################
|
||||
# You shouldn't need to touch anything below here.
|
||||
########################################################################
|
||||
include ../../Makefile.config
|
||||
|
||||
TARGET = libLCDdrivers.a
|
||||
OBJ += lcd.o drv_base.o $(DOBJ)
|
||||
SOURCES = Makefile lcd.c lcd.h \
|
||||
MtxOrb.c MtxOrb.h wirz-sli.c wirz-sli.h text.c text.h \
|
||||
curses_drv.c curses_drv.h drv_base.c drv_base.h \
|
||||
hd44780.c hd44780.h port.h joy.c joy.h irman.c irman.h \
|
||||
CFontz.c CFontz.h
|
||||
INCLUDE = -I../../shared
|
||||
|
||||
|
||||
###################################################################
|
||||
# Compilation...
|
||||
#
|
||||
all: $(TARGET)
|
||||
|
||||
|
||||
$(TARGET): $(OBJ) Makefile
|
||||
$(AR) rcs $(TARGET) $(OBJ)
|
||||
#$(TARGET): $(OBJ) Makefile
|
||||
# $(GCC) -s $(MISC) $(INCLUDE) -o $(TARGET) $(OBJ) $(LIB)
|
||||
|
||||
%.o: %.c %.h Makefile
|
||||
$(GCC) -c $(MISC) $(INCLUDE) $<
|
||||
|
||||
|
||||
##################################################################
|
||||
# Other stuff...
|
||||
#
|
||||
clean:
|
||||
rm -f $(OBJ) *.o $(DOBJ) $(TARGET) *~ core
|
||||
|
||||
edit:
|
||||
nedit $(SOURCES) $(EXTRAS) &
|
||||
|
||||
todo:
|
||||
@echo ---------------===========================================
|
||||
@grep TODO $(SOURCES) | grep -v SOURCES
|
||||
@grep FIXME $(SOURCES) | grep -v SOURCES
|
||||
@echo ---------------===========================================
|
||||
|
||||
@@ -989,59 +989,3 @@ void MtxOrb_init_all(int type)
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: Remove this code wich was use for developpement.
|
||||
// PS: That was the code to define unidirectionnal [h|v]bar.
|
||||
/*
|
||||
if(type==hbar){
|
||||
if(custom!=hbar) {
|
||||
MtxOrb_set_known_char(1, barr1);
|
||||
MtxOrb_set_known_char(2, barr2);
|
||||
MtxOrb_set_known_char(3, barr3);
|
||||
MtxOrb_set_known_char(4, barr4);
|
||||
custom=hbar;
|
||||
}
|
||||
}
|
||||
|
||||
if(type==vbar){
|
||||
if(custom!=vbar) {
|
||||
MtxOrb_set_known_char(1, baru1);
|
||||
MtxOrb_set_known_char(2, baru2);
|
||||
MtxOrb_set_known_char(3, baru3);
|
||||
MtxOrb_set_known_char(4, baru4);
|
||||
MtxOrb_set_known_char(5, baru5);
|
||||
MtxOrb_set_known_char(6, baru6);
|
||||
MtxOrb_set_known_char(7, baru7);
|
||||
custom=vbar;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// TODO: Remove this code wich was use for developpement.
|
||||
// PS: It was a good idea, but not working (fixing take to much time).
|
||||
/*
|
||||
void MtxOrb_icon(int which, char dest)
|
||||
{
|
||||
if(custom==bign) custom=beat;
|
||||
MtxOrb_set_known_char(dest, which+21);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// TODO: Remove this code wich was use for developpement.
|
||||
// PS: Temporary code used durring developpement of dynamic bar.
|
||||
/*
|
||||
if(type==barr1)return(1);
|
||||
if(type==barr2)return(2);
|
||||
if(type==barr3)return(3);
|
||||
if(type==barr4)return(4);
|
||||
if(type==baru1)return(1);
|
||||
if(type==baru2)return(2);
|
||||
if(type==baru3)return(3);
|
||||
if(type==baru4)return(4);
|
||||
if(type==baru5)return(5);
|
||||
if(type==baru6)return(6);
|
||||
if(type==baru7)return(7);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include "../lcd.h"
|
||||
#include "lcd.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
#include <string.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include "LL.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../../shared/LL.h"
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
contains a few things that other parts of the program might want
|
||||
to know about...
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../shared/debug.h"
|
||||
|
||||
#include "drivers/lcd.h"
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
########################################################################
|
||||
# You shouldn't need to touch anything below here.
|
||||
########################################################################
|
||||
include ../Makefile.config
|
||||
|
||||
|
||||
TARGET = libLCDstuff.a
|
||||
OBJ = LL.o sockets.o str.o
|
||||
#OBJ = LL.o config.o sockets.o
|
||||
#TODO: config and sockets stuff...
|
||||
|
||||
###################################################################
|
||||
# Compilation...
|
||||
#
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJ) Makefile
|
||||
ar rcs $(TARGET) $(OBJ)
|
||||
#$(TARGET): $(OBJ) Makefile
|
||||
# $(GCC) -s $(MISC) -o $(TARGET) $(OBJ) $(LIB)
|
||||
|
||||
%.o: %.c %.h Makefile
|
||||
$(GCC) -c $(MISC) $<
|
||||
|
||||
|
||||
##################################################################
|
||||
# Installation
|
||||
#
|
||||
install: $(TARGET)
|
||||
@echo No shared stuff will be installed...
|
||||
|
||||
|
||||
##################################################################
|
||||
# Other stuff...
|
||||
#
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET) *~ core
|
||||
|
||||
edit:
|
||||
emacs . &
|
||||
|
||||
-158
@@ -1,158 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
|
||||
typedef struct command
|
||||
{
|
||||
char *text;
|
||||
struct command *child;
|
||||
int (*func)(char *line);
|
||||
};
|
||||
|
||||
command main_list[] = {
|
||||
"Key", NULL, Key_func,
|
||||
"Driver", Driver_commands,NULL,
|
||||
NULL, NULL, NULL,
|
||||
};
|
||||
|
||||
command Driver_commands[] = {
|
||||
"MtxOrb", NULL, MtxOrb_drv_init,
|
||||
"curses", NULL, curses_drv_init,
|
||||
"hd44780", NULL, hd44780_drv_init,
|
||||
// "X11", NULL, X11_drv_init,
|
||||
// "debug", NULL, debug_drv_init,
|
||||
"text", NULL, text_drv_init,
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Interpret a line...
|
||||
int parse_line(char *line);
|
||||
// Interpret the rest of the line...
|
||||
int parse_rest(char *line, command *commands);
|
||||
|
||||
|
||||
////////// Helper functions for line parsing /////////////////
|
||||
// Pops off the first word of the string.
|
||||
char *shift(char *string);
|
||||
|
||||
|
||||
////////////// Config Functions /////////////////////////////////
|
||||
int Key_func(char *line)
|
||||
{
|
||||
// uh, interpret the command...
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int parse_line(char *line, command *commands)
|
||||
{
|
||||
int i, j;
|
||||
int newtoken, inquote;
|
||||
char *str;
|
||||
// char *tok;
|
||||
int argc;
|
||||
char *argv[256];
|
||||
char delimiters[] = " \0";
|
||||
char leftquote[] = "\0\"'`([{\0";
|
||||
char rightquote[] = "\0\"'`)]}\0";
|
||||
char errmsg[256];
|
||||
int invalid=0;
|
||||
int err=0;
|
||||
|
||||
// And parse all its messages...
|
||||
//debug("parse: Getting messages...\n");
|
||||
str = strdup(line);
|
||||
debug("parse: ...%s\n", str);
|
||||
// Now, split up the string...
|
||||
//len = strlen(str);
|
||||
argc=0;
|
||||
newtoken=1;
|
||||
inquote=0;
|
||||
for(i=0; str[i]; i++)
|
||||
{
|
||||
if(inquote) // Scan for the end of the quote
|
||||
{
|
||||
if(str[i] == rightquote[inquote])
|
||||
{ // Found the end of the quote
|
||||
inquote=0;
|
||||
str[i] = 0;
|
||||
newtoken=1;
|
||||
}
|
||||
}
|
||||
else // Normal operation; split at delimiters
|
||||
{
|
||||
for(j=1; leftquote[j]; j++)
|
||||
{
|
||||
// Found the beginning of a new quote...
|
||||
if(str[i] == leftquote[j])
|
||||
{
|
||||
inquote = j;
|
||||
str[i] = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
for(j=0; delimiters[j]; j++)
|
||||
{
|
||||
// Break into a new string...
|
||||
if(str[i] == delimiters[j])
|
||||
{
|
||||
str[i] = 0;
|
||||
newtoken = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(newtoken && str[i])
|
||||
{
|
||||
newtoken=0;
|
||||
argv[argc] = str + i;
|
||||
argc++;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
if(inquote)
|
||||
{
|
||||
sprintf(errmsg, "huh? Unterminated string: missing %c\n",
|
||||
rightquote[inquote]);
|
||||
sock_send_string(c->sock, errmsg);
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
for(tok = strtok(str, delimiters);
|
||||
tok;
|
||||
tok=strtok(NULL, delimiters))
|
||||
{
|
||||
argv[argc] = tok;
|
||||
argc++;
|
||||
}
|
||||
*/
|
||||
argv[argc] = NULL;
|
||||
if(argc < 1) continue;
|
||||
|
||||
// Now find and call the appropriate function...
|
||||
// debug("parse: Finding function...\n");
|
||||
invalid = 1;
|
||||
for(i=0; commands[i].keyword; i++)
|
||||
{
|
||||
// debug("(checking %s)\n", commands[i].keyword);
|
||||
if(0 == strcmp(argv[0], commands[i].keyword))
|
||||
{
|
||||
// debug("(FOUND %s)\n", commands[i].keyword);
|
||||
invalid = commands[i].function(c, argc, argv);
|
||||
// debug("parse: Returned %i...\n", err);
|
||||
}
|
||||
}
|
||||
if(invalid)
|
||||
{
|
||||
// FIXME: Check for buffer overflows here...
|
||||
err = 1;
|
||||
//sprintf(errmsg, "huh? Invalid command \"%s\"\n", argv[0]);
|
||||
//sock_send_string(c->sock, errmsg);
|
||||
}
|
||||
|
||||
free(str); // Don't want to forget this... :)
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
|
||||
// Read entire config file
|
||||
int config_load_file(char *file);
|
||||
|
||||
// Save new options
|
||||
int config_save_file(char *file);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef LCDPORT
|
||||
#define LCDPORT 13666
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user