示例#1
0
文件: stty.c 项目: ISLEcode/kornshell
static int infof(Opt_t* op, Sfio_t* sp, const char* s, Optdisc_t* dp)
{
	NoP(op);
	NoP(s);
	NoP(dp);
	sfprintf(sp,"[+Control Modes.]{");
	listfields(sp,C_FLAG);
	listgroup(sp,SPEED,"Attempt to set input and output baud rate to number given.  A value of \b0\b causes immediate hangup");
	listchars(sp,NUM);
	listgroup(sp,SIZE,"Number of bits in a character");
	sfprintf(sp,"}[+Input Modes.]{");
	listfields(sp,I_FLAG);
	sfprintf(sp,"}[+Output Modes.]{");
	listfields(sp,O_FLAG);
#ifdef CRDLY
	listmask(sp,CRDLY,"Carriage return delay style");
#endif
#ifdef NLDLY
	listmask(sp,NLDLY,"Newline delay style");
#endif
#ifdef TABDLY
	listmask(sp,TABDLY,"Horizontal tab delay style");
#endif
#ifdef BSDLY
	listmask(sp,BSDLY,"Backspace delay style");
#endif
#ifdef FFDLY
	listmask(sp,FFDLY,"Form feed delay style");
#endif
#ifdef VTDLY
	listmask(sp,VTDLY,"Vertical tab delay style");
#endif
	sfprintf(sp,"}[+Local Modes.]{");
	listfields(sp,L_FLAG);
	sfprintf(sp,"}[+Control Assignments.?If \ac\a is \bundef\b or an empty "
		"string then the control assignment is disabled.]{");
	listchars(sp,WIND);
	listchars(sp,CHAR);
	sfprintf(sp,"}[+Combination Modes.]{");
	listmode(sp,"ek");
	listmode(sp,"evenp");
	listmode(sp,"lcase");
	listmode(sp,"oddp");
	listmode(sp,"parity");
	listmode(sp,"sane");
	listmode(sp,"tabs");
	listmode(sp,"LCASE");
	sfputc(sp,'}');
	return(1);
}
示例#2
0
static void
list(int aflag, int hflag)
{
	int	i, d = 0;
	speed_t	is, os;

	is = cfgetispeed(&ts);
	os = cfgetospeed(&ts);
	if (is == os)
		printf("speed %s baud;", baudrate(is));
	else
		printf("ispeed %s baud; ospeed %s baud;",
				baudrate(is), baudrate(os));
	if (aflag == 0) {
		for (i = 0; modes[i].m_name; i++) {
			if (modes[i].m_type == M_PCFLAG)
				d += listmode(ts.c_cflag, modes[i], aflag, 1);
		}
		d = 0;
	}
	if (sysv3 && aflag == 0) {
		putchar('\n');
	} else {
		putchar(sysv3 ? ' ' : '\n');
		printf("rows = %d%s columns = %d; "
				"ypixels = %d%s xpixels = %d%s\n",
			(int)ws.ws_row,
			aflag&&hflag ? "" : ";",
			(int)ws.ws_col,
			(int)ws.ws_ypixel,
			aflag&&hflag ? "" : ";",
			(int)ws.ws_xpixel,
			aflag&&hflag ? "" : ";");
	}
	if ((ts.c_lflag&ICANON) == 0)
		printf("min = %d; time = %d;\n",
				(int)ts.c_cc[VMIN], (int)ts.c_cc[VTIME]);
	for (i = 0; modes[i].m_name; i++) {
		if (modes[i].m_flg&040)
			continue;
		switch (modes[i].m_type) {
		case M_NSEPAR:
			if (sysv3)
				break;
		case M_SEPAR:
			if (d && (modes[i].m_flg&8 ||
					(modes[i].m_flg&(aflag?2:4)) == 0)) {
				fputs(modes[i].m_name, stdout);
				d = 0;
			}
			break;
		case M_IFLAG:
			d += listmode(ts.c_iflag, modes[i], aflag, d);
			break;
		case M_OFLAG:
			d += listmode(ts.c_oflag, modes[i], aflag, d);
			break;
		case M_CFLAG:
			d += listmode(ts.c_cflag, modes[i], aflag, d);
			break;
		case M_LFLAG:
			d += listmode(ts.c_lflag, modes[i], aflag, d);
			break;
		case M_CC:
			if (hflag == 0)
				d += listchar(ts.c_cc, modes[i], aflag, d);
			break;
		}
		if (d >= 72 && aflag == 0) {
			putchar('\n');
			d = 0;
		}
	}
	if (d && aflag == 0)
		putchar('\n');
}