[Toybox] Fwd: Re: [patch] add sed

Felix Janda felix.janda at posteo.de
Sun Aug 4 02:53:07 PDT 2013


Dave wrote:
> On 8/3/2013 7:25 PM, Strake wrote:
> >
> >> Besides that there's -i, which could be done easily by open()ing a
> >> temporary file, writing to that, then renaming to the original filename.
> > This violates the doctrine to do one thing well. Alas, users want it,
> > and scripts use it.
> >
> > Giving flags to users is like giving cigarettes to children.
> Frequently on a space constrained device you are forced to edit large 
> files with ed because there is not enough temp space to create that temp 
> file.  Frequently in a recovery situation there is zero temp space. If 
> you wanted to implement the -i so it /really really /edits files *i*n 
> place, that would be a good reason to eliminate ed.

So where keeps ed its buffer?


If the edited file fits into memory, instead of open()ing a temporary
file, writing and renaming one could read the file into memory and
then use fmemopen().

Felix

 1375609987.0


More information about the Toybox mailing list