summaryrefslogtreecommitdiff
path: root/usr.bin/tcopy/tcopy.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tcopy/tcopy.c')
-rw-r--r--usr.bin/tcopy/tcopy.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/usr.bin/tcopy/tcopy.c b/usr.bin/tcopy/tcopy.c
index 4d9d516b08e9..07eb41268aba 100644
--- a/usr.bin/tcopy/tcopy.c
+++ b/usr.bin/tcopy/tcopy.c
@@ -87,6 +87,7 @@ main(int argc, char *argv[])
msg = stdout;
guesslen = 1;
+ outp = -1;
while ((ch = getopt(argc, argv, "cs:vx")) != -1)
switch((char)ch) {
case 'c':
@@ -157,16 +158,16 @@ main(int argc, char *argv[])
if (nread >= 0)
goto r1;
}
- err(1, "read error, file %d, record %qu", filen, record);
+ err(1, "read error, file %d, record %ju", filen, (intmax_t)record);
} else if (nread != lastnread) {
if (lastnread != 0 && lastnread != NOCOUNT) {
if (lastrec == 0 && nread == 0)
- fprintf(msg, "%qu records\n", record);
+ fprintf(msg, "%ju records\n", (intmax_t)record);
else if (record - lastrec > 1)
- fprintf(msg, "records %qu to %qu\n",
- lastrec, record);
+ fprintf(msg, "records %ju to %ju\n",
+ (intmax_t)lastrec, (intmax_t)record);
else
- fprintf(msg, "record %qu\n", lastrec);
+ fprintf(msg, "record %ju\n", (intmax_t)lastrec);
}
if (nread != 0)
fprintf(msg, "file %d: block size %d: ",
@@ -184,10 +185,12 @@ r1: guesslen = 0;
nw = write(outp, buff, nread);
if (nw != nread) {
if (nw == -1) {
- warn("write error, file %d, record %qu", filen, record);
+ warn("write error, file %d, record %ju", filen,
+ (intmax_t)record);
} else {
- warnx("write error, file %d, record %qu", filen, record);
- warnx("write (%d) != read (%d)", nw, nread);
+ warnx("write error, file %d, record %ju", filen,
+ (intmax_t)record);
+ warnx("write (%d) != read (%d)", nw, nread);
}
errx(5, "copy aborted");
}
@@ -200,8 +203,8 @@ r1: guesslen = 0;
break;
}
fprintf(msg,
- "file %d: eof after %qu records: %qu bytes\n",
- filen, record, size);
+ "file %d: eof after %ju records: %ju bytes\n",
+ filen, (intmax_t)record, (intmax_t)size);
needeof = 1;
filen++;
tsize += size;
@@ -210,7 +213,7 @@ r1: guesslen = 0;
}
lastnread = nread;
}
- fprintf(msg, "total length: %qu bytes\n", tsize);
+ fprintf(msg, "total length: %ju bytes\n", (intmax_t)tsize);
(void)signal(SIGINT, oldsig);
if (op == COPY || op == COPYVERIFY) {
writeop(outp, MTWEOF);
@@ -281,11 +284,11 @@ intr(int signo __unused)
{
if (record) {
if (record - lastrec > 1)
- fprintf(msg, "records %qu to %qu\n", lastrec, record);
+ fprintf(msg, "records %ju to %ju\n", (intmax_t)lastrec, (intmax_t)record);
else
- fprintf(msg, "record %qu\n", lastrec);
+ fprintf(msg, "record %ju\n", (intmax_t)lastrec);
}
- fprintf(msg, "interrupt at file %d: record %qu\n", filen, record);
+ fprintf(msg, "interrupt at file %d: record %ju\n", filen, (intmax_t)record);
fprintf(msg, "total length: %ju bytes\n", (uintmax_t)(tsize + size));
exit(1);
}