public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Nils Stec <nils.stec@gmail.com>
Cc: ELKS <linux-8086@vger.kernel.org>
Subject: Re: Cleaning up elkscmd and adding help text - Questions
Date: Fri, 27 Mar 2015 13:54:46 +0000	[thread overview]
Message-ID: <20150327135446.61a7bca1@www.etchedpixels.co.uk> (raw)
In-Reply-To: <551512AC.5050704@gmail.com>

On Fri, 27 Mar 2015 09:19:56 +0100
Nils Stec <nils.stec@gmail.com> wrote:

> Hi,
> 
> i started to write some patches, at the moment 2. Now it's the time to 
> ask you guys some questions about that.
> 
> I wrote a patch for cat which shows the user some usage-information.
> Jody Bruchon used write() for this purpose, other tools are using 
> fprintf(stderr, ....).
> I don't know which i should prefer. In my opinion i would rather use 
> fprintf.
> STDERR should be the output for operations, right?

A lot of small programs try and avoid using stdio as it makes them a lot
smaller in memory and on disk if they do so.

> 
> I wrote a second patch, which adds some more functionality to cp.
> It adds three command-line-options:
>      -v    be verbose
>      -i     be interactive, ask before overwriting
>      -n    don't overwrite files
> 
> i want to add 3 more options:
>      -u    update-only (only overwrite if source is newer)
>      -b    make a backup if destination file already exists
>      -f     force, if destfile cannot be opened, remove it, try again.
> 
> 
> Is this the right way to write code for this project? It's the first 
> time I'm doing this in here and i don't wan't to do things wrong...
> 
> I think these two patches are still just drafts - i send them because i 
> want to show, i know theres more work to do on this two patches.

They look ok to me, in fact the bug I see in patch #2 isn't yours - the
existing code is not checking if the malloc of buf fails.... (and given
its always needed it looks like it could just be declared as a fixed
static buffer so that malloc isn't needed at all)

Alan

      parent reply	other threads:[~2015-03-27 13:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27  8:19 Cleaning up elkscmd and adding help text - Questions Nils Stec
2015-03-27 13:19 ` Jody Bruchon
2015-03-27 14:10   ` Alan Cox
2015-03-27 16:17     ` Jody Bruchon
2015-03-27 18:19       ` MFLD
2015-03-27 18:26         ` Jody Bruchon
2015-03-27 18:52           ` MFLD
2015-03-27 22:19             ` Alan Cox
2015-03-28 15:35               ` LM
2015-03-27 18:41         ` Alan Cox
2015-03-27 17:59   ` Nils Stec
2015-03-27 18:31     ` Alan Cox
2015-03-27 13:54 ` Alan Cox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150327135446.61a7bca1@www.etchedpixels.co.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linux-8086@vger.kernel.org \
    --cc=nils.stec@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox