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
add cpio to subdirectory list
[unix-history]
/
usr
/
src
/
bin
/
dd
/
dd.c
diff --git
a/usr/src/bin/dd/dd.c
b/usr/src/bin/dd/dd.c
index
b78fbd1
..
dfec8b2
100644
(file)
--- a/
usr/src/bin/dd/dd.c
+++ b/
usr/src/bin/dd/dd.c
@@
-1,4
+1,8
@@
-static char *sccsid = "@(#)dd.c 4.1 (Berkeley) %G%";
+#ifndef lint
+static char *sccsid = "@(#)dd.c 4.6 (Berkeley) %G%";
+#endif
+
+#include <sys/file.h>
#include <stdio.h>
#include <signal.h>
#include <stdio.h>
#include <signal.h>
@@
-242,7
+246,7
@@
char **argv;
}
}
fprintf(stderr,"bad arg: %s\n", string);
}
}
fprintf(stderr,"bad arg: %s\n", string);
- exit(
0
);
+ exit(
1
);
}
if(conv == null && cflag&(LCASE|UCASE))
conv = cnull;
}
if(conv == null && cflag&(LCASE|UCASE))
conv = cnull;
@@
-251,16
+255,13
@@
char **argv;
else
ibf = dup(0);
if(ibf < 0) {
else
ibf = dup(0);
if(ibf < 0) {
-
fprintf(stderr,"cannot open: %s\n",
ifile);
- exit(
0
);
+
perror(
ifile);
+ exit(
1
);
}
}
- if (ofile)
- obf = creat(ofile, 0666);
- else
- obf = dup(1);
+ obf = ofile ? open(ofile, O_WRONLY|O_CREAT, 0666) : dup(1);
if(obf < 0) {
fprintf(stderr,"cannot create: %s\n", ofile);
if(obf < 0) {
fprintf(stderr,"cannot create: %s\n", ofile);
- exit(
0
);
+ exit(
1
);
}
if (bs) {
ibs = obs = bs;
}
if (bs) {
ibs = obs = bs;
@@
-269,7
+270,7
@@
char **argv;
}
if(ibs == 0 || obs == 0) {
fprintf(stderr,"counts: cannot be zero\n");
}
if(ibs == 0 || obs == 0) {
fprintf(stderr,"counts: cannot be zero\n");
- exit(
0
);
+ exit(
1
);
}
ibuf = sbrk(ibs);
if (fflag)
}
ibuf = sbrk(ibs);
if (fflag)
@@
-279,7
+280,7
@@
char **argv;
sbrk(64); /* For good measure */
if(ibuf == (char *)-1 || obuf == (char *)-1) {
fprintf(stderr, "not enough memory\n");
sbrk(64); /* For good measure */
if(ibuf == (char *)-1 || obuf == (char *)-1) {
fprintf(stderr, "not enough memory\n");
- exit(
0
);
+ exit(
1
);
}
ibc = 0;
obc = 0;
}
ibc = 0;
obc = 0;
@@
-329,7
+330,7
@@
loop:
} else
nifr++;
ip = ibuf;
} else
nifr++;
ip = ibuf;
- c =
(ibc>>1) & ~
1;
+ c =
ibc >>
1;
if(cflag&SWAB && c)
do {
a = *ip++;
if(cflag&SWAB && c)
do {
a = *ip++;
@@
-417,7
+418,7
@@
number(big)
case '\0':
if (n>=big || n<0) {
case '\0':
if (n>=big || n<0) {
- fprintf(stderr, "dd: argument %
D
out of range\n", n);
+ fprintf(stderr, "dd: argument %
ld
out of range\n", n);
exit(1);
}
return(n);
exit(1);
}
return(n);