Only in mycat: cat diff -rbc cat/cat.1 mycat/cat.1 *** cat/cat.1 Thu Apr 22 19:46:00 1999 --- mycat/cat.1 Wed Jun 27 03:50:20 2001 *************** *** 44,50 **** .Nd concatenate and print files .Sh SYNOPSIS .Nm ! .Op Fl benstuv .Op Fl .Op Ar .Sh DESCRIPTION --- 44,50 ---- .Nd concatenate and print files .Sh SYNOPSIS .Nm ! .Op Fl benstuva .Op Fl .Op Ar .Sh DESCRIPTION *************** *** 71,76 **** --- 71,78 ---- as well. .It Fl n Number the output lines, starting at 1. + .It Fl a + Speak the output as well as print it. .It Fl s Squeeze multiple adjacent empty lines, causing the output to be single spaced. diff -rbc cat/cat.c mycat/cat.c *** cat/cat.c Thu Apr 22 19:46:01 1999 --- mycat/cat.c Thu Jun 28 14:21:22 2001 *************** *** 63,70 **** #include #include #include ! ! int bflag, eflag, nflag, sflag, tflag, vflag; int rval; char *filename; --- 63,70 ---- #include #include #include ! #include ! int bflag, eflag, nflag, sflag, tflag, vflag, aflag; int rval; char *filename; *************** *** 84,90 **** (void)setlocale(LC_ALL, ""); ! while ((ch = getopt(argc, argv, "benstuv")) != -1) switch (ch) { case 'b': bflag = nflag = 1; /* -b implies -n */ --- 84,90 ---- (void)setlocale(LC_ALL, ""); ! while ((ch = getopt(argc, argv, "benstuva")) != -1) switch (ch) { case 'b': bflag = nflag = 1; /* -b implies -n */ *************** *** 107,116 **** case 'v': vflag = 1; break; default: case '?': (void)fprintf(stderr, ! "usage: cat [-benstuv] [-] [file ...]\n"); exit(1); /* NOTREACHED */ } --- 107,121 ---- case 'v': vflag = 1; break; + case 'a': + aflag = 1; + break; default: case '?': (void)fprintf(stderr, ! "usage: cat [-benstuva] [-] [file ...]\n"); ! (void)fprintf(stderr, ! "\t-a\tspeak output\n"); exit(1); /* NOTREACHED */ } *************** *** 258,265 **** static int bsize; static char *buf; struct stat sbuf; ! wfd = fileno(stdout); if (buf == NULL) { if (fstat(wfd, &sbuf)) err(1, "%s", filename); --- 263,274 ---- static int bsize; static char *buf; struct stat sbuf; ! SpeechChannel channel; ! int errno; wfd = fileno(stdout); + if (aflag) + if ((errno = NewSpeechChannel(NULL, &channel)) != 0) + err(1, "Unable to create speech channel error: %d", errno); if (buf == NULL) { if (fstat(wfd, &sbuf)) err(1, "%s", filename); *************** *** 267,276 **** if ((buf = malloc((u_int)bsize)) == NULL) err(1, "cannot allocate buffer"); } ! while ((nr = read(rfd, buf, (u_int)bsize)) > 0) for (off = 0; nr; nr -= nw, off += nw) if ((nw = write(wfd, buf + off, (u_int)nr)) < 0) err(1, "stdout"); if (nr < 0) { warn("%s", filename); rval = 1; --- 276,298 ---- if ((buf = malloc((u_int)bsize)) == NULL) err(1, "cannot allocate buffer"); } ! while ((nr = read(rfd, buf, (u_int)bsize)) > 0) { ! if (aflag) { ! if ((errno = SpeakText(channel, buf, nr)) != 0) ! err(1, "Unable to speak text error: %d", errno); ! } for (off = 0; nr; nr -= nw, off += nw) if ((nw = write(wfd, buf + off, (u_int)nr)) < 0) err(1, "stdout"); + if (aflag) { + while(SpeechBusy()) + usleep(250); + } + + } + if (aflag) + if ((errno = DisposeSpeechChannel(channel)) != 0) + err(1, "Unable to dispose of speech channel error: %d", errno); if (nr < 0) { warn("%s", filename); rval = 1;