summaryrefslogtreecommitdiffstats
path: root/bin/dd/args.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-08-15 19:10:05 +0000
committerrwatson <rwatson@FreeBSD.org>2004-08-15 19:10:05 +0000
commit9e69bea9f10d447d337c54d6f5378346f998434f (patch)
treec508168354348245f2a483698e91245e93ecf503 /bin/dd/args.c
parent7e0b05723702eca98bf7ece454b0be3fac59f877 (diff)
downloadFreeBSD-src-9e69bea9f10d447d337c54d6f5378346f998434f.zip
FreeBSD-src-9e69bea9f10d447d337c54d6f5378346f998434f.tar.gz
Add a "fillchar" command line argument to dd(1) that permits the user
to specify an alternative padding character when using a conversion mode, or when using noerror with sync and an input error occurs. This facilities reading old and error-prone media by allowing the user to more effectively mark error blocks in the output stream.
Diffstat (limited to 'bin/dd/args.c')
-rw-r--r--bin/dd/args.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/dd/args.c b/bin/dd/args.c
index c4d418b..161fbfc 100644
--- a/bin/dd/args.c
+++ b/bin/dd/args.c
@@ -58,6 +58,7 @@ static void f_cbs(char *);
static void f_conv(char *);
static void f_count(char *);
static void f_files(char *);
+static void f_fillchar(char *);
static void f_ibs(char *);
static void f_if(char *);
static void f_obs(char *);
@@ -77,6 +78,7 @@ static const struct arg {
{ "conv", f_conv, 0, 0 },
{ "count", f_count, C_COUNT, C_COUNT },
{ "files", f_files, C_FILES, C_FILES },
+ { "fillchar", f_fillchar, C_FILL, C_FILL },
{ "ibs", f_ibs, C_IBS, C_BS|C_IBS },
{ "if", f_if, C_IF, C_IF },
{ "iseek", f_skip, C_SKIP, C_SKIP },
@@ -224,6 +226,16 @@ f_files(char *arg)
}
static void
+f_fillchar(char *arg)
+{
+
+ if (strlen(arg) != 1)
+ errx(1, "need exactly one fill char");
+
+ fill_char = arg[0];
+}
+
+static void
f_ibs(char *arg)
{
uintmax_t res;
OpenPOWER on IntegriCloud