"-b --omitbad omit bad blocks from the dump\n"
"-p --prettyprint print nice (hexdump)\n"
"-s addr --startaddress=addr start address\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
static void display_version (void)
"You may redistribute copies of " PROGRAM "\n"
"under the terms of the GNU General Public Licence.\n"
"See the file `COPYING' for more information.\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
// Option variables
case 'f':
if (!(dumpfile = strdup(optarg))) {
perror("stddup");
- exit(1);
+ exit(EXIT_FAILURE);
}
break;
case 'i':
/* Open MTD device */
if ((fd = open(mtddev, O_RDONLY)) == -1) {
perror("open flash");
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Fill in MTD device capability structure */
if (ioctl(fd, MEMGETINFO, &meminfo) != 0) {
perror("MEMGETINFO");
close(fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Make sure device page sizes are valid */
!(meminfo.oobsize == 8 && meminfo.writesize == 256)) {
fprintf(stderr, "Unknown flash (not normal NAND)\n");
close(fd);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Read the real oob length */
oob.length = meminfo.oobsize;
if (ioctl (fd, MEMGETOOBSEL, &old_oobinfo) != 0) {
perror ("MEMGETOOBSEL");
close (fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (ioctl (fd, MEMSETOOBSEL, &none_oobinfo) != 0) {
perror ("MEMSETOOBSEL");
close (fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
oobinfochanged = 1;
break;
default:
perror ("MTDFILEMODE");
close (fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
}
} else {
} else if ((ofd = open(dumpfile, O_WRONLY | O_TRUNC | O_CREAT, 0644))== -1) {
perror ("open outfile");
close(fd);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Initialize start/end addresses and block size */
perror ("MEMSETOOBSEL");
close(fd);
close(ofd);
- return 1;
+ return EXIT_FAILURE;
}
}
/* Close the output file and MTD device */
close(ofd);
/* Exit happy */
- return 0;
+ return EXIT_SUCCESS;
closeall:
/* The new mode change is per file descriptor ! */
}
close(fd);
close(ofd);
- exit(1);
+ exit(EXIT_FAILURE);
}