xringd (1.20-25.2) direct (non packaging) changes

Summary

 Makefile    |   36 ++++++++++--------------------------
 ringsm.c    |    2 +-
 xringd.c    |   13 ++++++++-----
 xringd.conf |   12 ++++++++----
 4 files changed, 27 insertions(+), 36 deletions(-)

    
download this patch

Patch contents

--- xringd-1.20.orig/Makefile
+++ xringd-1.20/Makefile
@@ -1,4 +1,3 @@
-#
 # Makefile  --	xringd
 #
 # Copyright (c) 1995-1996 Angelo Haritsis. All rights reserved.
@@ -7,10 +6,10 @@
 #
 
 VERSION=1.20
-
+DESTDIR=
 # where we install
-BINDIR=/usr/local/sbin
-MANDIR=/usr/local/man
+BINDIR=${DESTDIR}/usr/sbin
+MANDIR=${DESTDIR}/usr/share/man
 
 # Number of seconds (compiled-in) to wait after resetting the state machine
 # before accepting any new rings; can also be set on cmd line (-t)
@@ -21,18 +20,13 @@
 CONF=/etc/xringd.conf
 
 # compiled-in modem device; can be specified on command line (-c)
-MODEM=/dev/modem
-
-#DBG=-DRINGSM_DUMP -DDEBUG	# include ringsm debug code
+MODEM=/dev/ttyS0
 
 DEFS=-DVERSION=\"$(VERSION)\" -DMODEM_FILE=\"$(MODEM)\" -DCONF_FILE=\"$(CONF)\" -DINIT_TIMEOUT=$(INITWAIT) $(DBG)
 
 CC=gcc
-CFLAGS =-Wall -O2 -m486 $(DEFS) -s
-#CFLAGS = -g $(DEFS)
+CFLAGS= -Wall -O2 $(DEFS) -s
 LDFLAGS=-s
-#LDFLAGS=-g
-
 
 OBJ = ringsm.o xringd.o
 
@@ -40,23 +34,13 @@
 	$(CC) $(LDFLAGS) $(OBJ) -o $@
 
 install: xringd
-	-install -o root -g bin -m 755 xringd $(BINDIR)
-	-install -o root -g root -m 755 xringd.8 $(MANDIR)/man8
-	@echo "!!! You also need a config file, eg. /etc/xringd.conf"
-
-dist:
-	-mv -f xringd*.lsm xringd-$(VERSION).lsm > /dev/null 2>&1
-	-perl -pi -e "s/Version:\t[0-9.]+/Version:\t$(VERSION)/;s/xringd-[0-9]+\.[0-9]+/xringd-$(VERSION)/g;" xringd-$(VERSION).lsm
-	#-perl -pi -e "s/xringd [0-9.]+/xringd $(VERSION)/;" README 
-	cp xringd*.lsm $(HOME)/
-	( cd .. ; tar --exclude \*.o --exclude RCS --exclude test \
-		--exclude .gdb_history \
-		-zcvSf $(HOME)/xringd-$(VERSION).tgz xringd \
-	)
+	/usr/bin/install -o root -g bin -m 755 xringd $(BINDIR)
+	/usr/bin/install -o root -g root -m 755 xringd.8 $(MANDIR)/man8
+	#/usr/bin/install -o root -g root -m 600 xringd.conf ${DESTDIR}/etc
 
-# util to show the internal kernel mdoem input counters
+# util to show the internal kernel modem input counters
 uartcount: uartcount.c
 	$(CC) $(CFLAGS) $? -o $@
 
 clean:
-	rm -f *.o xringd errors tags
+	rm -f *.o xringd errors tags uartcount
--- xringd-1.20.orig/ringsm.c
+++ xringd-1.20/ringsm.c
@@ -223,7 +223,7 @@
  * simple parser for the configuration file - check for a few errors
  * static line_now has the line number where parser is now
  */
-static line_now;
+static int line_now;
 
 static int
 conf_parse(FILE *f, argparse_cback argparse)
--- xringd-1.20.orig/xringd.conf
+++ xringd-1.20/xringd.conf
@@ -14,7 +14,8 @@
 #
 
 # command line options (-c -n silently ignored)
-#-m /dev/ttyS1
+# modem device
+-m /dev/ttyS0
 #-a /usr/local/audio/bin/play /usr/local/lib/sounds/ring.au
 -a 
 # rings this far are taken as one ring:
@@ -25,11 +26,14 @@
 #-l 100
 
 # 2 rings 10-25 sec apart followed by 30 secs silence: ppp connect with office1
-R 10-25 R 30 : /etc/ppp/ppp.start office1
+#R 10-25 R 30 : /etc/ppp/ppp.start office1
 
 # 3 rings with 10-20 secs between each pair => ppp connect with office2
-R 10-20 R 10-20 R 30 : /etc/ppp/ppp.start office2
+#R 10-20 R 10-20 R 30 : /etc/ppp/ppp.start office2
 
 # 2 nearish rings then 1 ring after 20-26 secs, followed by no ring in
 # 30 secs => heater on!
-R 1-6 R 10-16 R 8 : /usr/local/bin/turn-heater on
+#R 1-6 R 10-16 R 8 : /usr/local/bin/turn-heater on
+
+# Debian default, can we say?
+R 20-30 R 30 : /usr/bin/pon provider
--- xringd-1.20.orig/xringd.c
+++ xringd-1.20/xringd.c
@@ -44,6 +44,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <paths.h>
 #include <fcntl.h>
@@ -77,7 +78,7 @@
 #define MAXLINE 512
 
 #ifndef MODEM_FILE
-#define MODEM_FILE "/dev/modem"
+#define MODEM_FILE "/dev/ttyS0"
 #endif
 #ifndef CONF_FILE
 #define CONF_FILE "/etc/xringd.conf"
@@ -128,8 +129,7 @@
 void fork_cmd(char *cmd);
 
 
-void
-main (int argc, char *argv[])
+int main (int argc, char *argv[])
 {
 	int arg;
 	struct serial_icounter_struct c;
@@ -204,6 +204,7 @@
 			ringsm_dump();
 	}
 	/* NOTREACHED */
+	return 0;
 }
 
 void
@@ -271,13 +272,15 @@
 
 	va_start(p, fmt);
 	vsprintf(buf, fmt, p);
-	if (log_level >= level)
+	if (log_level >= level) {
 		if (debug || -1 == priority) {
 			fflush(stdout);
 			fprintf(stderr, PROG ": %s\n", buf);
 			fflush(stderr);
-		} else
+		} else {
 			syslog(priority, buf);
+		}
+	}
 	va_end(p);
 }