[zaptel-commits] file: trunk r1324 - /trunk/zttest.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Fri Aug 18 11:57:33 MST 2006


Author: file
Date: Fri Aug 18 13:57:33 2006
New Revision: 1324

URL: http://svn.digium.com/view/zaptel?rev=1324&view=rev
Log:
Add option to specify how long to let zttest run for (issue #7751 reported by kshumard)

Modified:
    trunk/zttest.c

Modified: trunk/zttest.c
URL: http://svn.digium.com/view/zaptel/trunk/zttest.c?rev=1324&r1=1323&r2=1324&view=diff
==============================================================================
--- trunk/zttest.c (original)
+++ trunk/zttest.c Fri Aug 18 13:57:33 2006
@@ -27,6 +27,7 @@
 	int fd;
 	int res;
 	int count=0;
+	int seconds;
 	int ms;
 	int curarg = 1;
 	int verbose=0;
@@ -41,16 +42,21 @@
 	while(curarg < argc) {
 		if (!strcasecmp(argv[curarg], "-v"))
 			verbose++;
+		if (!strcasecmp(argv[curarg], "-c") && argc > curarg)
+			seconds = atoi(argv[curarg + 1]);
 		curarg++;
 	}
 	printf("Opened pseudo zap interface, measuring accuracy...\n");
 	signal(SIGHUP, hup_handler);
 	signal(SIGINT, hup_handler);
+	signal(SIGALRM, hup_handler);
 	/* Flush input buffer */
 	for (count = 0;count < 4; count++)
 		res = read(fd, buf, sizeof(buf));
 	count = 0;
 	gettimeofday(&start, NULL);
+	if (seconds > 0)
+		alarm(seconds + 1);
 	for(;;) {
 		res = read(fd, buf, sizeof(buf));
 		if (res < 0) {



More information about the zaptel-commits mailing list