projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
date and time created 85/05/01 18:17:37 by bloom
[unix-history]
/
usr
/
src
/
lib
/
libcurses
/
cr_put.c
diff --git
a/usr/src/lib/libcurses/cr_put.c
b/usr/src/lib/libcurses/cr_put.c
index
161ddf7
..
cadb553
100644
(file)
--- a/
usr/src/lib/libcurses/cr_put.c
+++ b/
usr/src/lib/libcurses/cr_put.c
@@
-11,7
+11,7
@@
int plodput();
* as formatting of lines (printing of control characters,
* line numbering and the like).
*
* as formatting of lines (printing of control characters,
* line numbering and the like).
*
- *
%G% (Berkeley) @(#)cr_put.c 1.2
+ *
@(#)cr_put.c 1.5 (Berkeley) %G%
*/
/*
*/
/*
@@
-38,16
+38,6
@@
int ly, lx, y, x; {
fgoto();
}
fgoto();
}
-char
-_putchar(c)
-reg char c; {
-
- putchar(c);
-#ifdef DEBUG
- fprintf(outf, "_PUTCHAR(%s)\n", unctrl(c));
-#endif
-}
-
fgoto()
{
reg char *cgp;
fgoto()
{
reg char *cgp;
@@
-65,11
+55,11
@@
fgoto()
while (l > 0) {
if (_pfast)
if (CR)
while (l > 0) {
if (_pfast)
if (CR)
-
tputs(CR, 0, _putchar
);
+
_puts(CR
);
else
_putchar('\r');
if (NL)
else
_putchar('\r');
if (NL)
-
tputs(NL, 0, _putchar
);
+
_puts(NL
);
else
_putchar('\n');
l--;
else
_putchar('\n');
l--;
@@
-111,7
+101,7
@@
fgoto()
* Superbee description which wins better.
*/
if (NL /* && !XB */ && _pfast)
* Superbee description which wins better.
*/
if (NL /* && !XB */ && _pfast)
-
tputs(NL, 0, _putchar
);
+
_puts(NL
);
else
_putchar('\n');
l--;
else
_putchar('\n');
l--;
@@
-223,14
+213,12
@@
plod(cnt)
}
else
/*
}
else
/*
- * No home and no up means it's impossible, so we return an
- * incredibly big number to make cursor motion win out.
+ * No home and no up means it's impossible.
*/
if (!UP && destline < outline)
*/
if (!UP && destline < outline)
- return
(500)
;
+ return
-1
;
if (GT)
if (GT)
- i = destcol % HARDTABS
- + destcol / HARDTABS;
+ i = destcol % HARDTABS + destcol / HARDTABS;
else
i = destcol;
/*
else
i = destcol;
/*
@@
-270,10
+258,7
@@
plod(cnt)
else
plodput('\r');
if (NC) {
else
plodput('\r');
if (NC) {
- if (NL)
- tputs(NL, 0, plodput);
- else
- plodput('\n');
+ put_nl();
outline++;
}
outcol = 0;
outline++;
}
outcol = 0;
@@
-281,10
+266,7
@@
plod(cnt)
dontcr:
while (outline < destline) {
outline++;
dontcr:
while (outline < destline) {
outline++;
- if (NL && _pfast)
- tputs(NL, 0, plodput);
- else
- plodput('\n');
+ put_nl();
if (plodcnt < 0)
goto out;
if (NONL || _pfast == 0)
if (plodcnt < 0)
goto out;
if (NONL || _pfast == 0)
@@
-316,10
+298,10
@@
dontcr:
goto out;
}
if (GT && destcol - outcol > 1) {
goto out;
}
if (GT && destcol - outcol > 1) {
- for (;;) {
- i = tabcol(outcol, HARDTABS);
- if (i > destcol)
- break;
+
for (;;) {
+
i = tabcol(outcol, HARDTABS);
+
if (i > destcol)
+
break;
if (TA)
tputs(TA, 0, plodput);
else
if (TA)
tputs(TA, 0, plodput);
else
@@
-351,9
+333,9
@@
dontcr:
if (plodflg) /* avoid a complex calculation */
plodcnt--;
else {
if (plodflg) /* avoid a complex calculation */
plodcnt--;
else {
- i =
_win->_y[outline-_win->_begy][outcol-_win->_begx
];
+ i =
curscr->_y[outline][outcol
];
if ((i&_STANDOUT) == (curscr->_flags&_STANDOUT))
if ((i&_STANDOUT) == (curscr->_flags&_STANDOUT))
- putchar(i);
+
_
putchar(i);
else
goto nondes;
}
else
goto nondes;
}
@@
-393,3
+375,20
@@
int col, ts;
offset = 0;
return col + ts - (col % ts) + offset;
}
offset = 0;
return col + ts - (col % ts) + offset;
}
+
+/*
+ * put out a newline appropriately, twice if necessary (uck)
+ */
+static
+put_nl()
+{
+ if (NL)
+ tputs(NL, 0, plodput);
+ else
+ plodput('\n');
+ if (AM && XN && outcol == COLS - 1)
+ if (NL)
+ tputs(NL, 0, plodput);
+ else
+ plodput('\n');
+}