/**
* -- implementation words for TOOLS-EXT / TOOLS-MIX
*
* Copyright (C) Tektronix, Inc. 1998 - 2001. All rights reserved.
*
* @see GNU LGPL
* @author Tektronix CTE @(#) %derived_by: guidod %
* @version %version: %
* (%date_modified: %)
*
* @description
* These are tool words used throughout the system implemenation.
*//*@{*/
/** _?stop_ ( -- ?key )
* check for a keypress, and if it was 'q' being pressed
: _?stop_ _key?_ _key_ [char] q = ;
*/_export int
p4_Q_stop (void)
{
if (p4_ekeypressed ())
{
register int ch;
ch = p4_getkey ();
if (tolower (ch) == 'q') return 1;
}
return 0;
}
/** _?cr_ ( -- ?stopped )
* Like CR but stop after one screenful and return flag if 'q' pressed.
* Improved by aph@oclc.org (Andrew Houghton)
*/_export int
p4_Q_cr (void)
{
static char more[] = "more? ";
static char help[] = "\r[next line=<return>, next page=<space>, quit=q] ";
FX (p4_cr);
if (P4_opt.isnotatty)
return 0;
if (PFE.lines < PFE.more)
return 0;
PFE.lines = 0;
for (;;)
{
register int ch;
p4_outs (more);
ch = p4_getkey (); /* tolower(..) may be a macro ! *gud*/
switch (tolower (ch))
{
case 'n': /* no more */
case 'q': /* quit */
return 1;
case 'y': /* more */
case ' ': /* page */
while (p4_OUT)
FX (p4_backspace);
PFE.more = PFE.rows - 1;
return 0;
case '\r': /* line */
case '\n': /* line */
while (p4_OUT)
FX (p4_backspace);
PFE.more = 1;
return 0;
default: /* unknown */
p4_dot_bell ();
/* ... */
case '?': /* help */
case 'h': /* help */
p4_outs (help);
break;
}
}
}