summaryrefslogtreecommitdiff
path: root/ex_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'ex_io.c')
-rw-r--r--ex_io.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/ex_io.c b/ex_io.c
index cd456cb..d45f2c0 100644
--- a/ex_io.c
+++ b/ex_io.c
@@ -99,11 +99,7 @@ bool wasalt;
short isalt;
long cntch; /* Count of characters on unit io */
-#ifndef VMUNIX
-short cntln; /* Count of lines " */
-#else
-int cntln;
-#endif
+long cntln; /* Count of lines " */
long cntnull; /* Count of nulls " */
#ifndef BIT8
long cntodd; /* Count of non-ascii characters " */
@@ -125,7 +121,7 @@ filename(int comm)
if (savedfile[0] == 0 && comm != 'f')
error(catgets(catd, 1, 72,
"No file|No current filename"));
- CP(file, savedfile);
+ lcpy(file, savedfile, sizeof file);
wasalt = (isalt > 0) ? isalt-1 : 0;
isalt = 0;
oldadot = altdot;
@@ -152,39 +148,39 @@ filename(int comm)
case 'e':
if (savedfile[0]) {
altdot = lineDOT();
- CP(altfile, savedfile);
+ lcpy(altfile, savedfile, sizeof altfile);
}
- CP(savedfile, file);
+ lcpy(savedfile, file, sizeof savedfile);
break;
default:
if (file[0]) {
if (c != 'E')
altdot = lineDOT();
- CP(altfile, file);
+ lcpy(altfile, file, sizeof altfile);
}
break;
}
}
- if (hush && comm != 'f' || comm == 'E')
+ if ((hush && comm != 'f') || comm == 'E')
return;
if (file[0] != 0) {
lprintf("\"%s\"", file);
if (comm == 'f') {
if (value(READONLY))
- printf(catgets(catd, 1, 73, " [Read only]"));
+ ex_printf(catgets(catd, 1, 73, " [Read only]"));
if (!edited)
- printf(catgets(catd, 1, 74, " [Not edited]"));
+ ex_printf(catgets(catd, 1, 74, " [Not edited]"));
if (tchng)
- printf(catgets(catd, 1, 75, " [Modified]"));
+ ex_printf(catgets(catd, 1, 75, " [Modified]"));
}
flush();
} else
- printf(catgets(catd, 1, 76, "No file "));
+ ex_printf(catgets(catd, 1, 76, "No file "));
if (comm == 'f') {
if (!(i = lineDOL()))
i++;
- printf(catgets(catd, 1, 77,
+ ex_printf(catgets(catd, 1, 77,
" line %d of %d --%ld%%--"), lineDOT(), lineDOL(),
(long) 100 * lineDOT() / i);
}
@@ -384,7 +380,7 @@ missing:
if (strlen(str) > FNSIZE - 4)
error(catgets(catd, 1, 89, "Filename too long"));
/* samef: */
- CP(file, str);
+ lcpy(file, str, sizeof file);
}
/*
@@ -424,7 +420,7 @@ rop(int c)
* "edit" commands, not just for the first one.
*/
if (1 || !seenprompt) {
- printf(catgets(catd, 1, 90, " [New file]"));
+ ex_printf(catgets(catd, 1, 90, " [New file]"));
noonl();
return;
}
@@ -470,7 +466,7 @@ rop(int c)
}
}
if (value(READONLY) && !hush) {
- printf(catgets(catd, 1, 102, " [Read only]"));
+ ex_printf(catgets(catd, 1, 102, " [Read only]"));
flush();
}
if (c == 'r')
@@ -528,29 +524,29 @@ iostats(void)
io = -1;
if (hush == 0) {
if (value(TERSE))
- printf(catgets(catd, 1, 103,
- " %d/%d"), cntln, (int)cntch);
+ ex_printf(catgets(catd, 1, 103,
+ " %ld/%ld"), cntln, cntch);
else
- printf(catgets(catd, 1, 104,
- " %d line%s, %d character%s"), cntln, plural((long) cntln),
- (int)cntch, plural((int)cntch));
+ ex_printf(catgets(catd, 1, 104,
+ " %ld line%s, %ld character%s"), cntln, plural(cntln),
+ cntch, plural(cntch));
if (cntnull
#ifndef BIT8
|| cntodd
#endif
) {
- printf(catgets(catd, 1, 105, " ("));
+ ex_printf(catgets(catd, 1, 105, " ("));
if (cntnull) {
- printf(catgets(catd, 1, 106,
+ ex_printf(catgets(catd, 1, 106,
"%d null"), (int)cntnull);
#ifndef BIT8
if (cntodd)
- printf(catgets(catd, 1, 107, ", "));
+ ex_printf(catgets(catd, 1, 107, ", "));
#endif
}
#ifndef BIT8
if (cntodd)
- printf(catgets(catd, 1, 108,
+ ex_printf(catgets(catd, 1, 108,
"%d non-ASCII"), (int)cntodd);
#endif
putchar(')');
@@ -654,7 +650,7 @@ wop(bool dofname)
saddr2=addr2;
addr1=one;
addr2=dol;
- CP(file, savedfile);
+ lcpy(file, savedfile, sizeof file);
if (inopen) {
vclrech(0);
splitw++;
@@ -707,12 +703,13 @@ cre:
if (io < 0)
syserror();
writing = 1;
- if (hush == 0)
+ if (hush == 0) {
if (nonexist)
- printf(catgets(catd, 1, 115, " [New file]"));
+ ex_printf(catgets(catd, 1, 115, " [New file]"));
else if (value(WRITEANY) && edfile() != EDF)
- printf(catgets(catd, 1, 116,
+ ex_printf(catgets(catd, 1, 116,
" [Existing file]"));
+ }
break;
case 2:
@@ -758,7 +755,7 @@ getfile(void)
if (ninbuf < 0) {
if (lp != linebuf) {
lp++;
- printf(catgets(catd, 1, 117,
+ ex_printf(catgets(catd, 1, 117,
" [Incomplete last line]"));
break;
}
@@ -805,6 +802,7 @@ putfile(int isfilter)
register int nib;
struct stat statb;
+ (void)isfilter;
a1 = addr1;
clrstats();
cntln = fixedzero ? 0 : addr2 - a1 + 1;
@@ -882,7 +880,7 @@ source(char *fil, bool okfail)
saveglobp = globp;
saveinput = input;
if (input)
- strcpy(saveinline, input);
+ lcpy(saveinline, input, sizeof saveinline);
peekc = 0; lastc = 0; globp = 0; input = 0;
if (saveinp < 0)
error(catgets(catd, 1, 119, "Too many nested sources"));
@@ -992,7 +990,7 @@ mbtowi(int *cp, const char *s, size_t n)
if (i >= 0 && widthok(wc) && !(wc & 0x70000000))
*cp = wc;
else {
- *cp = *s&0377 | INVBIT;
+ *cp = (*s & 0377) | INVBIT;
i = 1;
}
return i;