delint
[AROS.git] / rom / dos / nil.c
blob98c6f99a0d96a0e1f879f58080535bd2d8df4786
1 /*
2 Copyright © 2014, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Special handling for NIL: locks and file handles
6 Lang: English
7 */
9 #include "dos_intern.h"
11 SIPTR handleNIL(LONG action, SIPTR arg1, SIPTR arg2, SIPTR arg3)
13 switch(action)
15 case(ACTION_FINDUPDATE):
16 case(ACTION_FINDINPUT):
17 case(ACTION_FINDOUTPUT):
19 struct FileHandle * fh = BADDR(arg1);
20 fh->fh_Type = BNULL;
21 fh->fh_Interactive = DOSFALSE;/* NIL: is not considered interactive */
22 return (SIPTR)MKBADDR(fh);
24 case(ACTION_INFO): return (SIPTR)0;
25 case(ACTION_FREE_LOCK):
27 FreeMem((APTR)arg1, sizeof(struct FileLock));
28 return (SIPTR)0;
30 case(ACTION_COPY_DIR_FH):
32 struct FileLock *fl = AllocMem(sizeof(struct FileLock), MEMF_PUBLIC | MEMF_CLEAR);
33 fl->fl_Access = SHARED_LOCK;
34 return (SIPTR)MKBADDR(fl);
36 case(ACTION_FH_FROM_LOCK):
38 struct FileHandle * fh = BADDR(arg2);
39 fh->fh_Interactive = DOSFALSE;
40 FreeMem((APTR)arg3, sizeof(struct FileLock));
41 return (SIPTR)DOSTRUE;
43 case(ACTION_WRITE): return (SIPTR)arg3;
44 case(ACTION_PARENT_FH): return (SIPTR)BNULL;
45 default: return TRUE;