Use NULL instead of 0 when setting up pointer.
This commit is contained in:
parent
449918b191
commit
f5f8c098c7
@ -199,21 +199,21 @@ main(int argc, char **argv)
|
||||
* look thru args (if any) for changes to defaults
|
||||
*/
|
||||
if (argv[i][0] != '-') {/* no flag on parameter */
|
||||
if (input == 0) { /* we must have the input file */
|
||||
if (input == NULL) { /* we must have the input file */
|
||||
in_name = argv[i]; /* remember name of input file */
|
||||
input = fopen(in_name, "r");
|
||||
if (input == 0) /* check for open error */
|
||||
if (input == NULL) /* check for open error */
|
||||
err(1, "%s", in_name);
|
||||
continue;
|
||||
}
|
||||
else if (output == 0) { /* we have the output file */
|
||||
else if (output == NULL) { /* we have the output file */
|
||||
out_name = argv[i]; /* remember name of output file */
|
||||
if (strcmp(in_name, out_name) == 0) { /* attempt to overwrite
|
||||
* the file */
|
||||
errx(1, "input and output files must be different");
|
||||
}
|
||||
output = fopen(out_name, "w");
|
||||
if (output == 0) /* check for create error */
|
||||
if (output == NULL) /* check for create error */
|
||||
err(1, "%s", out_name);
|
||||
continue;
|
||||
}
|
||||
@ -222,9 +222,9 @@ main(int argc, char **argv)
|
||||
else
|
||||
set_option(argv[i]);
|
||||
} /* end of for */
|
||||
if (input == 0)
|
||||
if (input == NULL)
|
||||
input = stdin;
|
||||
if (output == 0) {
|
||||
if (output == NULL) {
|
||||
if (troff || input == stdin)
|
||||
output = stdout;
|
||||
else {
|
||||
@ -1223,11 +1223,11 @@ bakcopy(void)
|
||||
|
||||
/* re-open backup file as the input file */
|
||||
input = fopen(bakfile, "r");
|
||||
if (input == 0)
|
||||
if (input == NULL)
|
||||
err(1, "%s", bakfile);
|
||||
/* now the original input file will be the output */
|
||||
output = fopen(in_name, "w");
|
||||
if (output == 0) {
|
||||
if (output == NULL) {
|
||||
unlink(bakfile);
|
||||
err(1, "%s", in_name);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user