diff options
author | file <file@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-08-18 18:57:33 +0000 |
---|---|---|
committer | file <file@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-08-18 18:57:33 +0000 |
commit | 3d620570c259bb0b0a7b23606d81af8b073d6cd2 (patch) | |
tree | a3d4b81201fa7f6709bed3226464513ace95ac79 /zttest.c | |
parent | 8775564b9a343a68405d6e489ba1ec4aea85e5a6 (diff) |
Add option to specify how long to let zttest run for (issue #7751 reported by kshumard)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1324 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zttest.c')
-rw-r--r-- | zttest.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -27,6 +27,7 @@ int main(int argc, char *argv[]) int fd; int res; int count=0; + int seconds; int ms; int curarg = 1; int verbose=0; @@ -41,16 +42,21 @@ int main(int argc, char *argv[]) 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) { |