File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / usr.bin / bsc / cmd / 3270 / emgetstr.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:26:11 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v121, HEAD
Power 6/32 Unix version 1.21

/*	D.L.Buck and Associates, Inc. - May, 1984
 *
 *	COPYRIGHT NOTICE:
 *		Copyright c 1984 - An unpublished work by
 *		D.L.Buck and Associates, Inc.
 *
 *	PROPRIETARY RIGHTS NOTICE:
 *		All rights reserved. This document and program contains
 *		proprietary information of D.L.Buck and Associates,Inc.
 *		of San Jose, California, U.S.A., embodying confidential
 *		information,  ideas, and expressions,  no part of which
 *		may be reproduced, or transmitted in any form or by any
 *		means,	electronic,  mechanical,  or otherwise, without
 *		the written permission of D.L.Buck and Associates, Inc.
 *
 * NAME
 *	emgetstr
 *
 * SYNOPSIS
 *	char emgetstr()
 *
 * DESCRIPTION
 *	emgetstr uses emgetchar to get a string from the window cmd_scr
 *	entered by the user in command mode.
 */

#include <em.h>
char *emgetstr(buffer)
char *buffer;
{
	static char sccsid[] = "@(#)emgetstr.c	1.4 REL";
	int emgetchar();
	register int cptr;
	register int cmd_curs = 9;
	register int count = 0;

	while ((cptr = emgetchar()) != CARRET && cptr != DOWN)	{
		if (cptr == NOCHAR) continue;
		if (cptr == BACKSP || cptr == LEFT || cptr == DELCHR)	{
			if (--cmd_curs < 9) {
				cmd_curs = 9;
				continue;
			}
			mvwaddch(cmd_scr,0,cmd_curs,' ');
			wmove(cmd_scr,0,cmd_curs);
			wrefresh(cmd_scr);
			buffer[--count] = '\0';
			continue;
		}
		buffer[count] = cptr;
		mvwaddch(cmd_scr,0,cmd_curs,cptr);
		wrefresh(cmd_scr);
		++cmd_curs; ++count;
	}
	buffer[count] = '\0';
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.