rename 'count' into the more appropriate 'columns'

This commit is contained in:
tg 2006-08-02 10:42:30 +00:00
parent df54522223
commit ad43cfa6cd

16
lex.c
View File

@ -2,7 +2,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.19 2006/08/02 10:41:03 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/lex.c,v 1.20 2006/08/02 10:42:30 tg Exp $");
/* Structure to keep track of the lexing state and the various pieces of info /* Structure to keep track of the lexing state and the various pieces of info
* needed for each particular state. */ * needed for each particular state. */
@ -1090,7 +1090,7 @@ set_prompt(int to, Source *s)
static int static int
dopprompt(const char *cp, int ntruncate, const char **spp, int doprint) dopprompt(const char *cp, int ntruncate, const char **spp, int doprint)
{ {
int count = 0, lines = 0; int columns = 0, lines = 0;
const char *sp = cp; const char *sp = cp;
char delimiter = 0; char delimiter = 0;
int indelimit = 0; int indelimit = 0;
@ -1109,18 +1109,18 @@ dopprompt(const char *cp, int ntruncate, const char **spp, int doprint)
if (indelimit && *cp != delimiter) if (indelimit && *cp != delimiter)
; ;
else if (*cp == '\n' || *cp == '\r') { else if (*cp == '\n' || *cp == '\r') {
count = 0; columns = 0;
++lines; ++lines;
sp = cp + 1; sp = cp + 1;
} else if (*cp == '\t') { } else if (*cp == '\t') {
count = (count | 7) + 1; columns = (columns | 7) + 1;
} else if (*cp == '\b') { } else if (*cp == '\b') {
if (count > 0) if (columns > 0)
count--; columns--;
} else if (*cp == delimiter) } else if (*cp == delimiter)
indelimit = !indelimit; indelimit = !indelimit;
else else
count++; columns++;
if (*cp != delimiter) { if (*cp != delimiter) {
if (ntruncate && !indelimit) if (ntruncate && !indelimit)
--ntruncate; --ntruncate;
@ -1132,7 +1132,7 @@ dopprompt(const char *cp, int ntruncate, const char **spp, int doprint)
*spp = sp; *spp = sp;
if (doprint) if (doprint)
shf_flush(shl_out); shf_flush(shl_out);
return (count + (lines * x_cols)); return (columns + (lines * x_cols));
} }