diff options
Diffstat (limited to 'dd.c')
-rw-r--r-- | dd.c | 47 |
1 files changed, 33 insertions, 14 deletions
@@ -1,30 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | * Mini dd implementation for busybox | ||
3 | * | ||
4 | * Copyright (C) 1999 by Lineo, inc. | ||
5 | * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> | ||
6 | * based in part on code taken from sash. | ||
7 | * | ||
2 | * Copyright (c) 1999 by David I. Bell | 8 | * Copyright (c) 1999 by David I. Bell |
3 | * Permission is granted to use, distribute, or modify this source, | 9 | * Permission is granted to use, distribute, or modify this source, |
4 | * provided that this copyright notice remains intact. | 10 | * provided that this copyright notice remains intact. |
5 | * | 11 | * |
6 | * The "dd" command, originally taken from sash. | ||
7 | * | ||
8 | * Permission to distribute this code under the GPL has been granted. | 12 | * Permission to distribute this code under the GPL has been granted. |
9 | * Mostly rewritten and bugs fixed for busybox by Erik Andersen <andersee@debian.org> | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
22 | * General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
27 | * | ||
10 | */ | 28 | */ |
11 | 29 | ||
30 | |||
12 | #include "internal.h" | 31 | #include "internal.h" |
13 | #include <stdio.h> | 32 | #include <stdio.h> |
14 | #include <fcntl.h> | 33 | #include <fcntl.h> |
15 | #include <errno.h> | 34 | #include <errno.h> |
16 | 35 | ||
17 | static const char dd_usage[] = | 36 | static const char dd_usage[] = |
18 | "Copy a file, converting and formatting according to options\n\ | 37 | "dd [if=name] [of=name] [bs=n] [count=n]\n" |
19 | \n\ | 38 | "Copy a file, converting and formatting according to options\n\n" |
20 | usage: [if=name] [of=name] [bs=n] [count=n]\n\ | 39 | "\tif=FILE\tread from FILE instead of stdin\n" |
21 | \tif=FILE\tread from FILE instead of stdin\n\ | 40 | "\tof=FILE\twrite to FILE instead of stout\n" |
22 | \tof=FILE\twrite to FILE instead of stout\n\ | 41 | "\tbs=n\tread and write N BYTES at a time\n" |
23 | \tbs=n\tread and write N BYTES at a time\n\ | 42 | "\tcount=n\tcopy only n input blocks\n" |
24 | \tcount=n\tcopy only n input blocks\n\ | 43 | //"\tskip=n\tskip n input blocks\n" |
25 | \tskip=n\tskip n input blocks\n\ | 44 | "\n" |
26 | \n\ | 45 | "BYTES may be suffixed: by k for x1024, b for x512, and w for x2.\n"; |
27 | BYTES may be suffixed: by k for x1024, b for x512, and w for x2.\n"; | ||
28 | 46 | ||
29 | 47 | ||
30 | 48 | ||
@@ -118,6 +136,7 @@ extern int dd_main (int argc, char **argv) | |||
118 | goto usage; | 136 | goto usage; |
119 | } | 137 | } |
120 | } | 138 | } |
139 | #if 0 | ||
121 | else if (strncmp(*argv, "skip", 4) == 0) { | 140 | else if (strncmp(*argv, "skip", 4) == 0) { |
122 | skipBlocks = atoi( *argv); | 141 | skipBlocks = atoi( *argv); |
123 | if (skipBlocks <= 0) { | 142 | if (skipBlocks <= 0) { |
@@ -126,8 +145,8 @@ extern int dd_main (int argc, char **argv) | |||
126 | } | 145 | } |
127 | 146 | ||
128 | } | 147 | } |
148 | #endif | ||
129 | else { | 149 | else { |
130 | fprintf (stderr, "Got here. argv=%s\n", *argv); | ||
131 | goto usage; | 150 | goto usage; |
132 | } | 151 | } |
133 | argc--; | 152 | argc--; |