if (argc == 1) {
rpmfile = stdin;
} else {
- rpmfile = fopen(argv[1], "r");
- if (!rpmfile) perror_msg_and_die("Can't open rpm file");
+ rpmfile = xfopen(argv[1], "r");
/* set the buffer size */
setvbuf(rpmfile, NULL, _IOFBF, 0x8000);
}
extern int sed_main(int argc, char **argv)
{
- int opt;
+ int opt, status = EXIT_SUCCESS;
#ifdef CONFIG_FEATURE_CLEAN_UP
/* destroy command strings on exit */
int i;
FILE *file;
for (i = optind; i < argc; i++) {
- file = fopen(argv[i], "r");
- if (file == NULL) {
- perror_msg("%s", argv[i]);
- } else {
+ if (file = wfopen(argv[i], "r")) {
process_file(file);
fclose(file);
- }
+ } else
+ status = EXIT_FAILURE;
}
}
- return 0;
+ return status;
}
#else
strcpy(s, "./trace");
#endif /* not_this_way */
- if ((tracefile = fopen(s, "a")) == NULL) {
- fprintf(stderr, "Can't open %s\n", s);
+ if ((tracefile = wfopen(s, "a")) == NULL)
return;
- }
#ifdef O_APPEND
if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND);
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin.
- * $Id: ash.c,v 1.34 2001/10/31 11:05:49 andersen Exp $
+ * $Id: ash.c,v 1.35 2001/11/12 16:44:55 kraai Exp $
*/
static int timescmd (int argc, char **argv)
{