/* We don't use our include/crc32.h, but crc32 from zlib!
*
- * The zlib implemenation performs pre/post-conditioning. The util-linux
+ * The zlib implementation performs pre/post-conditioning. The util-linux
* imlemenation requires post-conditioning (xor) in the applications.
*/
#include <zlib.h>
static void __attribute__((__noreturn__)) usage(void)
{
- printf(
- _("usage: %s [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] "
- "[-n name] dirname outfile\n"
- " -v be verbose\n"
- " -E make all warnings errors "
- "(non-zero exit status)\n"
- " -b blksize use this blocksize, must equal page size\n"
- " -e edition set edition number (part of fsid)\n"
- " -N endian set cramfs endianness (big|little|host), default host\n"
- " -i file insert a file image into the filesystem\n"
- " -n name set name of cramfs filesystem\n"
- " -p pad by %d bytes for boot code\n"
- " -s sort directory entries (old option, ignored)\n"
- " -z make explicit holes\n"
- " dirname root of the filesystem to be compressed\n"
- " outfile output file\n"),
- program_invocation_short_name, PAD_SIZE);
-
+ fputs(USAGE_HEADER, stdout);
+ printf(_(" %s [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] [-n name] dirname outfile\n"),
+ program_invocation_short_name);
+ fputs(USAGE_SEPARATOR, stdout);
+ puts(_("Make compressed ROM file system."));
+ fputs(USAGE_OPTIONS, stdout);
+ puts(_( " -v be verbose"));
+ puts(_( " -E make all warnings errors (non-zero exit status)"));
+ puts(_( " -b blksize use this blocksize, must equal page size"));
+ puts(_( " -e edition set edition number (part of fsid)"));
+ printf(_(" -N endian set cramfs endianness (%s|%s|%s), default %s\n"), "big", "little", "host", "host");
+ puts(_( " -i file insert a file image into the filesystem"));
+ puts(_( " -n name set name of cramfs filesystem"));
+ printf(_(" -p pad by %d bytes for boot code\n"), PAD_SIZE);
+ puts(_( " -s sort directory entries (old option, ignored)"));
+ puts(_( " -z make explicit holes"));
+ puts(_( " dirname root of the filesystem to be compressed"));
+ puts(_( " outfile output file"));
fputs(USAGE_SEPARATOR, stdout);
printf(USAGE_HELP_OPTIONS(16));
printf(USAGE_MAN_TAIL("mkfs.cramfs(8)"));
entry->size = parse_directory(root_entry, path, &entry->child, fslen_ub);
} else if (S_ISREG(st.st_mode)) {
entry->path = xstrdup(path);
- if (entry->size && entry->size >= (1 << CRAMFS_SIZE_WIDTH)) {
+ if (entry->size >= (1 << CRAMFS_SIZE_WIDTH)) {
warn_size = 1;
entry->size = (1 << CRAMFS_SIZE_WIDTH) - 1;
}
memset(super->name, 0x00, sizeof(super->name));
if (opt_name)
- strncpy((char *)super->name, opt_name, sizeof(super->name));
+ str2memcpy((char *)super->name, opt_name, sizeof(super->name));
else
- strncpy((char *)super->name, "Compressed", sizeof(super->name));
+ str2memcpy((char *)super->name, "Compressed", sizeof(super->name));
super->root.mode = root->mode;
super->root.uid = root->uid;
(len-- == 0 ||
(begin[3] == '\0' &&
memcmp(begin, begin + 4, len) == 0))))))));
- else
- /* Never create holes. */
- return 0;
+
+ /* Never create holes. */
+ return 0;
}
/*
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc > 1) {
/* first arg may be one of our standard longopts */
if (!strcmp(argv[1], "--help"))
usage();
if (!strcmp(argv[1], "--version")) {
- printf(UTIL_LINUX_VERSION);
+ print_version(EXIT_SUCCESS);
exit(MKFS_EX_OK);
}
}
/* old option, ignored */
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(MKFS_EX_OK);
+ print_version(MKFS_EX_OK);
case 'v':
verbose = 1;
break;