Fixed missing fprintf argument.
[AROS.git] / rom / dos / startnotify.c
blob85607a8141aa736d870b7bb4509a59cb3680f2b1
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include "dos_intern.h"
9 #include <string.h>
11 /*****************************************************************************
13 NAME */
15 #include <aros/debug.h>
16 #include <dos/notify.h>
17 #include <proto/dos.h>
19 AROS_LH1(BOOL, StartNotify,
21 /* SYNOPSIS */
22 AROS_LHA(struct NotifyRequest *, notify, D1),
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 148, Dos)
27 /* FUNCTION
29 Send a notification request to a filesystem. You will then be notified
30 whenever the file (or directory) changes.
32 INPUTS
34 notify -- a notification request for the file or directory to monitor
36 RESULT
38 Success/failure indicator.
40 NOTES
42 The file or directory connected to a notification request does not have
43 to exist at the time of calling StartNotify().
44 The NotifyRequest used with this function should not be altered while
45 active.
47 EXAMPLE
49 BUGS
51 SEE ALSO
53 EndNotify(), <dos/notify.h>
55 INTERNALS
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
60 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
62 struct IOFileSys iofs;
63 struct FileHandle *dir;
65 /* Prepare I/O request. */
66 InitIOFS(&iofs, FSA_ADD_NOTIFY, DOSBase);
68 iofs.io_Union.io_NOTIFY.io_NotificationRequest = notify;
70 notify->nr_MsgCount = 0;
72 if (strchr(notify->nr_Name, ':') != NULL)
74 DoName(&iofs, notify->nr_Name, DOSBase);
76 else
78 dir = BADDR(CurrentDir(NULL));
79 CurrentDir(MKBADDR(dir)); /* Set back the current dir */
81 if (dir == NULL)
83 return DOSFALSE;
86 iofs.IOFS.io_Device = dir->fh_Device;
87 iofs.IOFS.io_Unit = dir->fh_Unit;
89 /* Save device for EndNotify() purposes */
90 notify->nr_Device = dir->fh_Device;
92 if (iofs.IOFS.io_Device == NULL)
94 return DOSFALSE;
97 DosDoIO(&iofs.IOFS);
100 SetIoErr(iofs.io_DosError);
102 if (iofs.io_DosError != 0)
104 return DOSFALSE;
107 return DOSTRUE;
109 AROS_LIBFUNC_EXIT
110 } /* StartNotify */