To curse or not to curse

William Kucharski kucharsk at uts.amdahl.com
Tue Jun 6 03:46:46 AEST 1989


Here's a program which demonstrates one way of doing things:

#include <stdio.h>
#include <termio.h>

main()
{
        int     a,c;
        char    ch[BUF];
        struct termio o,t;

	if (ioctl(0, TCGETA, &o))
		perror("ioctl: get");

        t = o;
        t.c_lflag = 0;		/* shut off everything */
        t.c_cc[VEOF] = 1;	/* MIN chars == 1 */

        if (ioctl(0, TCSETA, &t))
                perror("ioctl: set");

        for (a = 0; a < BUF; a++) {
                c = getc(stdin);
                ch[a] = (char) c;
                printf(".");
        }

	ch[BUF] = '\0';	/* NULL terminate it */

        printf("\n%s\n", ch);

        if (ioctl(0, TCSETA, &o))
                perror("ioctl: set back");
}

-- 
					William Kucharski

ARPA: kucharsk at uts.amdahl.com
UUCP: ...!{ames,decwrl,sun,uunet}!amdahl!kucharsk

Disclaimer:  The opinions expressed above are my own, and may not agree with
	     those of any other sentient being, not to mention those of my 
	     employer.  So there.



More information about the Comp.unix.questions mailing list