[Toybox] ln implementation

Elie De Brauwer eliedebrauwer at gmail.com
Mon Feb 13 08:07:03 PST 2012


On 02/12/2012 09:23 PM, Andre Renaud wrote:
> Hi,
>
> Here is a pretty minimal implementation of the 'ln' command.

Hello Andre,

If you change

USE_LN(NEWTOY(ln, "fs", TOYFLAG_BIN))

into

USE_LN(NEWTOY(ln, "<2>2fs", TOYFLAG_BIN))

Then this equals the same as stating that two arguments (other than f s) 
are expected (see toys/link.c and lib/args.c for inspiration). Then you 
can omit null-pointer checking and the usage printing. On my system it 
then just behaves as follows:

edb at lapedb:~/edb-stuff/toybox/toybox$ ./toybox ln -sf a
usage: ln [-s] [-f] file1 file2

Create a link from file2 to file1

-s    Create a symbolic link
-f    Force the creation of the link, even if file2 already exists

ln: Need 2 arguments

my 2 cents
E.
-- 
Elie De Brauwer


 1329149223.0


More information about the Toybox mailing list