tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] Re: iflag/oflag for dd(1)



In article <20150317141959.GD672%homeworld.netbsd.org@localhost>,
Emmanuel Dreyfus  <manu%netbsd.org@localhost> wrote:
>On Mon, Mar 16, 2015 at 05:08:38AM +0100, Emmanuel Dreyfus wrote:
>> Linux's dd(1) has iflag and oflag operands to specify the O_* flags that
>> should be given to open(2) for the input and output file.
>
>Since the idea seems welcome, I implemented it:
>http://ftp.espci.fr/shadow/manu/dd-ioflag.patch
>
>Any comment?

Some of the flags don't make sense:
(O_CREAT,O_RDONLY,O_RDWR,O_TRUNC,O_WRONLY,O_APPEND)
since they interfere with the operation of the dd command (linux does not
support them either).

I would also put the errx in f_ioflag to reduce code duplication:

static u_int
f_ioflag(char *arg, const char *argname)
{
#ifdef NO_IOFLAG
	errx(EXIT_FAILURE, "%s option disabled", argname);
#else
	...
#endif
}

christos



Home | Main Index | Thread Index | Old Index