int status = EXIT_SUCCESS;
unsigned long flags;
- flags = bb_getopt_ulflags(argc, argv, "cf");
+ flags = getopt32(argc, argv, "cf");
while (optind < argc) {
- const char *compressed_file = argv[optind++];
- const char *delete_path = NULL;
+ char *compressed_file = argv[optind++];
+ char *delete_path = NULL;
char *uncompressed_file = NULL;
int src_fd;
int dst_fd;
- if (strcmp(compressed_file, "-") == 0) {
+ if (LONE_DASH(compressed_file)) {
src_fd = STDIN_FILENO;
flags |= GUNZIP_TO_STDOUT;
} else {
extension = strrchr(uncompressed_file, '.');
if (!extension || (strcmp(extension, ".Z") != 0)) {
- bb_error_msg_and_die("Invalid extension");
+ bb_error_msg_and_die("invalid extension");
}
*extension = '\0';
/* do the decompression, and cleanup */
if ((xread_char(src_fd) != 0x1f) || (xread_char(src_fd) != 0x9d)) {
- bb_error_msg_and_die("Invalid magic");
+ bb_error_msg_and_die("invalid magic");
}
status = uncompress(src_fd, dst_fd);
/* delete_path will be NULL if in test mode or from stdin */
if (delete_path && (unlink(delete_path) == -1)) {
- bb_error_msg_and_die("Couldn't remove %s", delete_path);
+ bb_error_msg_and_die("cannot remove %s", delete_path);
}
free(uncompressed_file);