On Fri, 27 Mar 2015 09:19:56 +0100 Nils Stec <nils.stec@xxxxxxxxx> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-8086" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html