some fixes to accented characters
[tangerine.git] / rom / dos / samelock.c
blob8e0ecd84dc38e49229025137cc3469f158bf42cd
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include "dos_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/dos.h>
15 AROS_LH2(LONG, SameLock,
17 /* SYNOPSIS */
18 AROS_LHA(BPTR, lock1, D1),
19 AROS_LHA(BPTR, lock2, D2),
21 /* LOCATION */
22 struct DosLibrary *, DOSBase, 70, Dos)
24 /* FUNCTION
25 Compares two locks.
27 INPUTS
28 lock1, lock2 - locks
30 RESULT
31 LOCK_SAME - locks points to the same object
32 LOCK_SAME_VOLUME - locks are on the same volume
33 LOCK_DIFFERENT - locks are different
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
43 INTERNALS
45 *****************************************************************************/
47 AROS_LIBFUNC_INIT
49 struct IOFileSys iofs;
50 struct FileHandle *fh1;
51 struct FileHandle *fh2;
53 if(!SameDevice(lock1, lock2))
54 return LOCK_DIFFERENT;
56 fh1 = (struct FileHandle *)BADDR(lock1);
57 fh2 = (struct FileHandle *)BADDR(lock2);
59 /* Check if it is the same lock */
61 /* Prepare I/O request. */
62 InitIOFS(&iofs, FSA_SAME_LOCK, DOSBase);
64 iofs.IOFS.io_Device = fh1->fh_Device;
65 iofs.IOFS.io_Unit = fh1->fh_Unit;
66 iofs.io_Union.io_SAME_LOCK.io_Lock[0] = fh1->fh_Unit;
67 iofs.io_Union.io_SAME_LOCK.io_Lock[1] = fh2->fh_Unit;
68 iofs.io_Union.io_SAME_LOCK.io_Same = LOCK_DIFFERENT;
70 /* Send the request. */
71 DosDoIO(&iofs.IOFS);
73 /* Set error code and return */
74 SetIoErr(iofs.io_DosError);
76 if(iofs.io_DosError != 0)
77 return LOCK_DIFFERENT;
78 else
80 if(iofs.io_Union.io_SAME_LOCK.io_Same == LOCK_SAME)
81 return LOCK_SAME;
82 else
83 return LOCK_SAME_VOLUME;
86 return 0;
88 AROS_LIBFUNC_EXIT
89 } /* SameLock */