2 /* Just a small example how to read the settings file. */
4 #include <devices/ahi.h>
6 #include <libraries/iffparse.h>
7 #include <prefs/prefhdr.h>
10 #include <proto/iffparse.h>
12 int main(int argc
, char *argv
[])
14 struct IFFHandle
*iff
;
15 struct StoredProperty
*ahig
;
16 struct CollectionItem
*ci
;
21 Printf("Usage: %s FILE UNIT\n", argv
[0]);
25 StrToLong(argv
[2], &unit
);
29 iff
->iff_Stream
= Open(argv
[1], MODE_OLDFILE
);
33 if(!OpenIFF(iff
, IFFF_READ
))
35 if(!(PropChunk(iff
,ID_PREF
,ID_AHIG
)
36 || CollectionChunk(iff
,ID_PREF
,ID_AHIU
)
37 || StopOnExit(iff
,ID_PREF
,ID_FORM
)))
39 if(ParseIFF(iff
, IFFPARSE_SCAN
) == IFFERR_EOC
)
42 ahig
= FindProp(iff
,ID_PREF
,ID_AHIG
);
45 struct AHIGlobalPrefs
*globalprefs
;
46 globalprefs
= (struct AHIGlobalPrefs
*)ahig
->sp_Data
;
48 if(globalprefs
->ahigp_DebugLevel
!= AHI_DEBUG_NONE
)
50 Printf("Debugging is turned on.\n");
55 ci
= FindCollection(iff
,ID_PREF
,ID_AHIU
);
58 struct AHIUnitPrefs
*unitprefs
;
59 unitprefs
= (struct AHIUnitPrefs
*)ci
->ci_Data
;
61 if(unitprefs
->ahiup_Unit
== unit
)
63 if(unitprefs
->ahiup_Channels
< 2)
65 Printf("There are less than 2 channels selected for unit %ld.\n", unit
);
76 Close(iff
->iff_Stream
);