grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / dos / makelink.c
bloba65564f3a9b8d46b6ea4556c5d44b0723996f112
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Create a hard or soft link.
6 Lang: English
7 */
8 #include <dos/dosextens.h>
9 #include "dos_intern.h"
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
15 #include <exec/types.h>
16 #include <proto/dos.h>
18 AROS_LH3(LONG, MakeLink,
20 /* SYNOPSIS */
21 AROS_LHA(CONST_STRPTR, name, D1),
22 AROS_LHA(SIPTR, dest, D2),
23 AROS_LHA(LONG , soft, D3),
25 /* LOCATION */
26 struct DosLibrary *, DOSBase, 74, Dos)
28 /* FUNCTION
29 MakeLink() will create a link between two files or directories.
30 A link is a filesystem object that refers to another file.
32 A soft link refers to another file or directory by name, and is
33 resolved by the filesystem and the caller. Soft links are not
34 restricted to the same volume and the target does not have to exist.
36 A hard link refers to another file by the location on a disk, and
37 is resolved by the filesystem. Hard links are restricted to files
38 or directories on the same volume.
40 INPUTS
41 name - The name of the link to create
42 dest - If 'soft' is TRUE this must be a filename; if it is FALSE a lock
43 pointing to the file to be hard-linked must be provided
44 soft - TRUE, if a soft link is to be created, FALSE for a hard link
46 RESULT
47 boolean - DOSTRUE or DOSFALSE. On error, IoErr() will contain more
48 information.
50 NOTES
52 EXAMPLE
54 BUGS
56 SEE ALSO
57 ReadLink()
59 INTERNALS
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 struct PacketHelperStruct phs;
66 LONG status;
68 status = DOSFALSE;
69 if (getpacketinfo(DOSBase, name, &phs))
71 status = dopacket4(DOSBase, NULL, phs.port, ACTION_MAKE_LINK,
72 phs.lock, phs.name, (SIPTR)dest, soft ? LINK_SOFT: LINK_HARD);
73 freepacketinfo(DOSBase, &phs);
76 return status;
78 AROS_LIBFUNC_EXIT
79 } /* MakeLink */