Initial attempt of AROS port of
[cake.git] / test / dosvartest.c
blobf207e8e935d03a557c7e1259bbc145a588e6d975
1 #include <string.h>
2 #include <stdio.h>
4 #include <proto/dos.h>
5 #include <proto/exec.h>
6 #include <proto/utility.h>
7 #include <dos/var.h>
10 #define DefCheckVar(VarName, Flags, Expected) \
11 CopyMem("!!!", Buffer, 4); \
12 printf("Checking Variable %s with Flags %x \n",VarName,(int)Flags); \
13 Bytes = GetVar(VarName, Buffer, (LONG)0x17, Flags); \
14 printf(" GetVar: res=0x%x %s (IOErr=%i, len=%i)\n", Bytes, Buffer,(int)IoErr(),(int)strlen(Buffer)); \
15 printf("expected: %s\n",Expected); \
16 printf("---\n");
18 #define DefSetVar(VarName,Value,Flags) \
19 printf("Setting Variable %s:=`%s` with Flags %x \n",VarName,Value,(int)Flags); \
20 SetVar(VarName,Value,(LONG)-1,Flags);
22 #define DefDeleteVar(VarName, Flags) \
23 printf("Deleting Variable %s Flags %x\n",VarName,(int)Flags); \
24 DeleteVar(VarName, Flags); \
25 printf("---\n");
27 int main(void)
29 int Bytes;
30 char * Buffer = AllocMem(0x1000,0x0);
32 DefCheckVar("S:Startup-Sequence", GVF_GLOBAL_ONLY, "first line of startup-sequence");
33 DefCheckVar("S:Startup-Sequence", (LONG)(GVF_GLOBAL_ONLY|GVF_BINARY_VAR), "whole startup-sequence");
35 DefSetVar("AROS","Amiga R. OS\n1995-1997\n",GVF_LOCAL_ONLY);
36 DefCheckVar("AROS", GVF_LOCAL_ONLY, "Amiga R. OS");
37 DefCheckVar("AROS", (LONG)(GVF_LOCAL_ONLY|GVF_BINARY_VAR), "Amiga R. OS\n1995-1997\n");
38 DefCheckVar("AROS", (LONG)(GVF_LOCAL_ONLY|GVF_BINARY_VAR|GVF_DONT_NULL_TERM), "Amiga R. OS\n1995-1997\n(+garbage)\n");
39 DefDeleteVar("AROS", GVF_LOCAL_ONLY);
40 DefCheckVar("AROS", GVF_LOCAL_ONLY, "no output as var is deleted");
42 DefSetVar("AROS","Amiga R. OS\n1995-1997\n",(LONG)(GVF_LOCAL_ONLY|LVF_IGNORE));
43 DefCheckVar("aros", GVF_LOCAL_ONLY, "no output");
44 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE), "Amiga R. OS");
45 DefCheckVar("aRoS", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|GVF_BINARY_VAR), "Amiga R. OS\n1995-1997\n");
46 DefCheckVar("aRoS", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|GVF_BINARY_VAR|GVF_DONT_NULL_TERM), "Amiga R. OS\n1995-1997\n (+garbage)\n");
47 DefDeleteVar("AROS", GVF_LOCAL_ONLY);
48 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE), "Amiga R. OS");
49 DefDeleteVar("AROS", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE));
50 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE), "no output as var is deleted");
52 DefSetVar("AROS","Amiga R. OS\n1995-1997\n",(LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|LV_ALIAS));
53 DefCheckVar("aros", GVF_LOCAL_ONLY, "no output");
54 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE), "no output");
55 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LV_ALIAS), "no output");
56 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|LV_ALIAS), "Amiga R. OS");
57 DefCheckVar("aRoS", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|GVF_BINARY_VAR|LV_ALIAS), "Amiga R. OS\n1995-1997\n");
58 DefDeleteVar("AROS", GVF_LOCAL_ONLY);
59 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|LV_ALIAS), "Amiga R. OS");
60 DefDeleteVar("AROS", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE));
61 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|LV_ALIAS), "Amiga R. OS");
62 DefDeleteVar("AROS", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE));
63 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|LV_ALIAS), "Amiga R. OS");
64 DefDeleteVar("AROS", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|LV_ALIAS));
65 DefCheckVar("aros", (LONG)(GVF_LOCAL_ONLY|LVF_IGNORE|LV_ALIAS), "no output as var is deleted");
68 DefSetVar("AROS","Amiga R. OS\n1995-1997\n",GVF_GLOBAL_ONLY);
69 DefCheckVar("aros", GVF_LOCAL_ONLY, "no output");
70 DefCheckVar("aros", GVF_GLOBAL_ONLY, "Amiga R. OS");
71 DefDeleteVar("AROS", GVF_LOCAL_ONLY);
72 DefCheckVar("aros", GVF_GLOBAL_ONLY, "Amiga R. OS");
73 DefDeleteVar("aROS", GVF_GLOBAL_ONLY);
74 DefCheckVar("AROS", GVF_GLOBAL_ONLY, "no output as var is deleted");
76 DefSetVar("AROS","Amiga R. OS\n1995-1997\n",(LONG)(GVF_GLOBAL_ONLY|GVF_SAVE_VAR));
77 DefCheckVar("aros", GVF_LOCAL_ONLY, "no output");
78 DefCheckVar("aros_", GVF_GLOBAL_ONLY, "no output");
79 DefCheckVar("aros", GVF_GLOBAL_ONLY, "Amiga R. OS");
80 DefCheckVar("aRoS", (LONG)(GVF_GLOBAL_ONLY|GVF_BINARY_VAR), "Amiga R. OS\n1995-1997\n");
81 DefCheckVar("aRoS", (LONG)(GVF_GLOBAL_ONLY|GVF_BINARY_VAR|GVF_DONT_NULL_TERM), "Amiga R. OS\n1995-1997\n");
82 DefDeleteVar("AROS", GVF_LOCAL_ONLY);
83 DefCheckVar("aros", GVF_GLOBAL_ONLY, "Amiga R. OS");
84 DefDeleteVar("AROS", GVF_GLOBAL_ONLY);
85 DefCheckVar("aros", GVF_GLOBAL_ONLY, "no output as var is deleted");
88 FreeMem(Buffer,0x1000);
90 return 0;