コード例 #1
0
ファイル: hack.topl.c プロジェクト: blakeney/slack
void
clrlin(void)
{
	if(flags.toplin) {
		home();
		cl_end();
		if(tly > 1) docorner(1, tly-1);
		remember_topl();
	}
	flags.toplin = 0;
}
コード例 #2
0
ファイル: hack.topl.c プロジェクト: tcadigan/hack_1.0
void clrlin()
{
    if(flags.topl != 0) {
        home();
        cl_end();

        if(tly > 1) {
            docorner(1, tly - 1);
        }

        remember_topl();
    }

    flags.topl = 0;
}
コード例 #3
0
ファイル: hack.topl.c プロジェクト: blakeney/slack
static void
xmore(const char *s)	/* allowed chars besides space/return */
{
	if(flags.toplin) {
		curs(tlx, tly);
		if(tlx + 8 > CO) putsym('\n'), tly++;
	}

	if(flags.standout)
		standoutbeg();
	putstr("--More--");
	if(flags.standout)
		standoutend();

	xwaitforspace(s);
	if(flags.toplin && tly > 1) {
		home();
		cl_end();
		docorner(1, tly-1);
	}
	flags.toplin = 0;
}
コード例 #4
0
ファイル: hack.topl.c プロジェクト: tcadigan/hack_1.0
/* spaceflag: TRUE if space required */
void xmore(boolean spaceflag)
{
    if(flags.topl != 0) {
        curs(tlx, tly);
        
        if((tlx + 8) > COLNO) {
            putsym('\n');
            ++tly;
        }
    }

    putstr("--More--");
    xwaitforspace(spaceflag);

    if((flags.topl != 0) && (tly > 1)) {
        home();
        cl_end();
        docorner(1, tly - 1);
    }

    flags.topl = 0;
}
コード例 #5
0
ファイル: hack.pager.c プロジェクト: Freeaqingme/OpenBSD
/*
 * Flexible pager: feed it with a number of lines and it will decide
 * whether these should be fed to the pager above, or displayed in a
 * corner.
 * Call:
 *	cornline(0, title or 0)	: initialize
 *	cornline(1, text)	: add text to the chain of texts
 *	cornline(2, morcs)	: output everything and cleanup
 *	cornline(3, 0)		: cleanup
 */
void
cornline(int mode, char *text)
{
	static struct line {
		struct line *next_line;
		char *line_text;
	} *texthead, *texttail;
	static int maxlen;
	static int linect;
	struct line *tl;

	if(mode == 0) {
		texthead = 0;
		maxlen = 0;
		linect = 0;
		if(text) {
			cornline(1, text);	/* title */
			cornline(1, "");	/* blank line */
		}
		return;
	}

	if(mode == 1) {
	    int len;

	    if(!text) return;	/* superfluous, just to be sure */
	    linect++;
	    len = strlen(text);
	    if(len > maxlen)
		maxlen = len;
	    tl = (struct line *)
		alloc((unsigned)(len + sizeof(struct line) + 1));
	    tl->next_line = 0;
	    tl->line_text = (char *)(tl + 1);
	    (void) strlcpy(tl->line_text, text, len + 1);
	    if(!texthead)
		texthead = tl;
	    else
		texttail->next_line = tl;
	    texttail = tl;
	    return;
	}

	/* --- now we really do it --- */
	if(mode == 2 && linect == 1)			    /* topline only */
		pline(texthead->line_text);
	else
	if(mode == 2) {
	    int curline, lth;

	    if(flags.toplin == 1) more();	/* ab@unido */
	    remember_topl();

	    lth = CO - maxlen - 2;		   /* Use full screen width */
	    if (linect < LI && lth >= 10) {		     /* in a corner */
		home();
		cl_end();
		flags.toplin = 0;
		curline = 1;
		for (tl = texthead; tl; tl = tl->next_line) {
		    curs(lth, curline);
		    if(curline > 1)
			cl_end();
		    putsym(' ');
		    putstr (tl->line_text);
		    curline++;
		}
		curs(lth, curline);
		cl_end();
		cmore(text);
		home();
		cl_end();
		docorner(lth, curline-1);
	    } else {					/* feed to pager */
		set_pager(0);
		for (tl = texthead; tl; tl = tl->next_line) {
		    if (page_line (tl->line_text)) {
			set_pager(2);
			goto cleanup;
		    }
		}
		if(text) {
			cgetret(text);
			set_pager(2);
		} else
			set_pager(1);
	    }
	}

cleanup:
	while ((tl = texthead)) {
		texthead = tl->next_line;
		free((char *) tl);
	}
}