home *** CD-ROM | disk | FTP | other *** search
- #include "stdio.h"
- #include <signal.h>
-
- int nomap = 0, is_of = 1;
-
- main(ac, av)
- int ac;
- char **av;
- {
- while(ac > 1 && av[1][0] == '-')
- {
- switch(av[1][1])
- {
- case 'c':
- nomap = 1;
- break;
- case 'n': case 'h':
- is_of = 0;
- break;
- default: break;
- }
- ac--;
- av++;
- }
-
- lzinit();
- hpcat();
- exit(0);
- }
-
- #include <sgtty.h>
-
- lzinit()
- {
- struct sgttyb nbuf;
- unsigned long lbits;
-
- setbuf(stdout, NULL);
- /* Work around to by-pass bug in terminal driver and force LITOUT */
- lbits = LMDMBUF|LLITOUT;
- ioctl(fileno(stdout), TIOCLSET, &lbits);
- ioctl(fileno(stdout), TIOCGETP, &nbuf);
- nbuf.sg_flags &= ~(ECHO|XTABS|CRMOD); /* While we're at it, set the mode */
- ioctl(fileno(stdout), TIOCSETP, &nbuf);
-
- fputs("\033&k3G", stdout); /* Set device to sane mode */
- }
-
- hpcat()
- {
- register int c, cnt = 0;
-
- while((c = getchar()) != EOF)
- {
-
- if(c == '\t')
- {
- do {
- delay();
- putchar(' ');
- cnt++;
- } while(cnt%8 != 0);
- }
- else if(is_of && c == '\031')
- {
- if(getchar() == '\001') kill(getpid(), SIGSTOP);
- }
- else
- {
- delay();
- putchar(c);
- if(c == '\f' || c == '\n')
- {
- cnt = 0;
- }
- else cnt++;
- }
- }
- }
-
- #include <sys/time.h>
-
- struct timeval tm = {0, 1500};
-
- delay()
- {
- select(0, 0, 0, 0, &tm);
- }
-
- /* Old version, hope to use again later
- #include <sys/time.h>
- #include <signal.h>
-
- int wakeup;
-
- void nullfunc(){
- wakeup = 1;
- }
-
- struct itimerval tm = {{0, 0}, {0, 1500}};
-
- delay()
- {
-
- void nullfunc();
-
- signal(SIGALRM, nullfunc);
- wakeup = 0;
- if(setitimer(ITIMER_REAL, &tm, NULL)) exit(1);
- while(wakeup == 0) sigpause(0);
- }
- */
-