--- multiplexer/repeatts.c 2001/05/14 20:47:02 1.2 +++ multiplexer/repeatts.c 2001/07/11 12:40:43 1.3 @@ -127,39 +127,43 @@ D(fprintf(stderr,"command_do(%s,%s,%s)\n if (arg2 != NULL) { if (is_long (arg2, &l2)) { if (l2 >= 0) { - if (arg3 != NULL) { - if (nextf >= 0) { - close (nextf); - } - if ((nextf = open (arg3, O_RDONLY)) >= 0) { - if (fstat (nextf, &stat) == 0) { -D(fprintf(stderr,"file %d, mode %07o, name %s, ino %ld, size %ld\n",nextf,stat.st_mode,arg3,stat.st_ino,stat.st_size)); - if (S_ISREG (stat.st_mode)) { - if ((stat.st_size % TS_PACKET_SIZE) == 0) { - if (stat.st_size > 0) { - nextrdelay = l2 / (stat.st_size / TS_PACKET_SIZE); + if ((l1 >= l2) || (l1 == 0)) { + if (arg3 != NULL) { + if (nextf >= 0) { + close (nextf); + } + if ((nextf = open (arg3, O_RDONLY)) >= 0) { + if (fstat (nextf, &stat) == 0) { + D(fprintf(stderr,"file %d, mode %07o, name %s, ino %ld, size %ld\n",nextf,stat.st_mode,arg3,stat.st_ino,stat.st_size)); + if (S_ISREG (stat.st_mode)) { + if ((stat.st_size % TS_PACKET_SIZE) == 0) { + if (stat.st_size > 0) { + nextrdelay = l2 / (stat.st_size / TS_PACKET_SIZE); + } else { + nextrdelay = 0; + } + nextfdelay = l1; + D(fprintf(stderr,"next opened(%d,%d)\n",nextfdelay,nextrdelay)); + return (TRUE); } else { - nextrdelay = 0; + fprintf (stderr, "File size not multiple of 188\n"); } - nextfdelay = l1; -D(fprintf(stderr,"next opened(%d,%d)\n",nextfdelay,nextrdelay)); - return (TRUE); } else { - fprintf (stderr, "File size not multiple of 188\n"); + fprintf (stderr, "File not regular\n"); } } else { - fprintf (stderr, "File not regular\n"); + fprintf (stderr, "Cannot stat file\n"); } + close (nextf); + nextf = -1; } else { - fprintf (stderr, "Cannot stat file\n"); + fprintf (stderr, "Cannot open file\n"); } - close (nextf); - nextf = -1; } else { - fprintf (stderr, "Cannot open file\n"); + fprintf (stderr, "File name missing\n"); } } else { - fprintf (stderr, "File name missing\n"); + fprintf (stderr, "0