arch/ppc-sam440: oops - found my missing KrnCli/KrnSti implementations
[AROS.git] / rom / dos / makelink.c
blob0847c5c8cd3fd31189384be955584a6ef2fb5099
1 /*
2 Copyright © 1995-2008, 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(APTR, 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
55 Soft links were not working in the ROM filesystem before version
56 37.
58 SEE ALSO
59 ReadLink()
61 INTERNALS
62 This function calls either FSA_CREATE_HARDLINK or FSA_CREATE_SOFTLINK
63 on the filesystem of `name`.
65 *****************************************************************************/
67 AROS_LIBFUNC_INIT
69 struct PacketHelperStruct phs;
70 LONG status;
72 status = DOSFALSE;
73 if (getpacketinfo(DOSBase, name, &phs)) {
74 status = dopacket4(DOSBase, NULL, phs.port, ACTION_MAKE_LINK, phs.lock, phs.name, (SIPTR)name, (IPTR)soft);
75 freepacketinfo(DOSBase, &phs);
78 return status;
80 AROS_LIBFUNC_EXIT
81 } /* MakeLink */