mtd/util mkfs.jffs2.c,1.31,1.32
David Woodhouse
dwmw2 at infradead.org
Sun Jan 12 10:42:06 EST 2003
Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv9569
Modified Files:
mkfs.jffs2.c
Log Message:
Make -V work, avoid spewing to stdout if it's a tty
Index: mkfs.jffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs2.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- mkfs.jffs2.c 12 Jan 2003 14:39:31 -0000 1.31
+++ mkfs.jffs2.c 12 Jan 2003 15:42:04 -0000 1.32
@@ -38,7 +38,7 @@
* Rewritten again. Cleanly separated host and target filsystem
* activities (mainly so I can reuse all the host handling stuff as I
* rewrite other mkfs utils). Added a verbose option to list types
- * and attributes as files are added to the filesystem. Major cleanup
+ * and attributes as files are added to the file system. Major cleanup
* and scrubbing of the code so it can be read, understood, and
* modified by mere mortals.
*
@@ -89,7 +89,7 @@
};
-static int out_fd = 1;
+static int out_fd = -1;
static char default_rootdir[] = ".";
static char *rootdir = default_rootdir;
static int verbose = 0;
@@ -641,7 +641,7 @@
}
}
-/* Here is where we do the actual creation of the filesystem */
+/* Here is where we do the actual creation of the file system */
#include "linux/jffs2.h"
#define JFFS2_MAX_FILE_SIZE 0xFFFFFFFF
@@ -1167,12 +1167,12 @@
static char *helptext =
"Usage: mkfs.jffs2 [OPTIONS]\n"
- "Make a JFFS2 filesystem image from an existing directory tree\n\n"
+ "Make a JFFS2 file system image from an existing directory tree\n\n"
"Options:\n"
" -p, --pad[=SIZE] Pad output to SIZE bytes with 0xFF. If SIZE is\n"
" not specified, the output is padded to the end of\n"
" the final erase block\n"
- " -r, -d, --root=DIR Build filesystem from directory DIR (default: cwd)\n"
+ " -r, -d, --root=DIR Build file system from directory DIR (default: cwd)\n"
" -s, --pagesize=SIZE Use page size (max data node size) SIZE (default: 4KiB)\n"
" -e, --eraseblock=SIZE Use erase block size SIZE (default: 64KiB)\n"
" -c, --cleanmarker=SIZE Size of cleanmarker (default 12)\n"
@@ -1200,13 +1200,8 @@
FILE *devtable = NULL;
struct filesystem_entry *root;
-
- if (argc == 1) {
- error_msg_and_die(helptext);
- }
-
while ((opt = getopt_long(argc, argv,
- "D:d:r:s:o:qUPfh?ve:lbp::nc:", long_options, &c)) >= 0)
+ "D:d:r:s:o:qUPfh?vVe:lbp::nc:", long_options, &c)) >= 0)
{
switch (opt) {
case 'D':
@@ -1230,7 +1225,7 @@
break;
case 'o':
- if (out_fd != 1) {
+ if (out_fd != -1) {
error_msg_and_die("output filename specified more than once");
}
out_fd = open(optarg, O_CREAT | O_TRUNC | O_RDWR, 0644);
@@ -1308,7 +1303,12 @@
break;
}
}
-
+ if (out_fd == -1) {
+ if (isatty(1)) {
+ error_msg_and_die(helptext);
+ }
+ out_fd = 1;
+ }
if (lstat(rootdir, &sb)) {
perror_msg_and_die("%s", rootdir);
}
More information about the linux-mtd-cvs
mailing list