Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / rexxsupport / statef.c
blob84084b7f1c6708fe5703a64cf4f1fb97c1dd50cc
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Rexx stub for AllocMem system function
6 Lang: English
7 */
9 #include <proto/alib.h>
10 #include <proto/exec.h>
11 #include <proto/dos.h>
12 #include <proto/rexxsyslib.h>
13 #include <exec/types.h>
14 #include <exec/memory.h>
15 #include <dos/exall.h>
16 #include <rexx/storage.h>
17 #include <rexx/errors.h>
19 #include <ctype.h>
20 #include <string.h>
22 #include "rexxsupport_intern.h"
23 #include "rxfunctions.h"
25 AROS_UFH2(void, __putChr,
26 AROS_UFHA(UBYTE, chr, D0),
27 AROS_UFHA(STRPTR *, p, A3))
29 AROS_USERFUNC_INIT;
31 *(*p)++ = chr;
33 AROS_USERFUNC_EXIT;
36 void my_sprintf(struct Library *RexxSupportBase, UBYTE *buffer, UBYTE *format, ...)
38 AROS_SLOWSTACKFORMAT_PRE(format);
39 RawDoFmt(format, AROS_SLOWSTACKFORMAT_ARG(format), (VOID_FUNC)__putChr, &buffer);
40 AROS_SLOWSTACKFORMAT_POST(format);
43 LONG rxsupp_statef(struct Library *RexxSupportBase, struct RexxMsg *msg, UBYTE **argstring)
45 BPTR lock;
46 UBYTE *string;
48 lock = Lock(RXARG(msg,1), ACCESS_READ);
49 if (lock == BNULL)
51 *argstring = CreateArgstring("", 0);
52 return RC_OK;
54 else
56 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
57 if (fib == NULL)
59 *argstring = NULL;
60 return ERR10_003;
62 Examine(lock, fib);
63 string = AllocMem(1024, MEMF_ANY);
64 my_sprintf(RexxSupportBase, string, "%s %ld %ld %s%s%s%s%s%s%s%s %ld %ld %ld",
65 fib->fib_DirEntryType<0 ? "FILE" : "DIR",
66 fib->fib_Size,
67 fib->fib_NumBlocks,
68 fib->fib_Protection & 1<<8 ? "H" : "-",
69 fib->fib_Protection & FIBF_SCRIPT ? "S" : "-",
70 fib->fib_Protection & FIBF_PURE ? "P" : "-",
71 fib->fib_Protection & FIBF_ARCHIVE ? "A" : "-",
72 fib->fib_Protection & FIBF_READ ? "-" : "R",
73 fib->fib_Protection & FIBF_WRITE ? "-" : "W",
74 fib->fib_Protection & FIBF_EXECUTE ? "-" : "E",
75 fib->fib_Protection & FIBF_DELETE ? "-" : "D",
76 fib->fib_Date.ds_Days,
77 fib->fib_Date.ds_Minute,
78 fib->fib_Date.ds_Tick);
79 FreeDosObject(DOS_FIB, fib);
82 *argstring = CreateArgstring(string, strlen(string));
83 FreeMem(string, 1024);
84 return RC_OK;