rem: ((struct UnitNode *) n)->prefs, p, sizeof p ); CopyIfValid( struct AHIUnitPrefs, ahiup_ScaleMode,
context: BOOL SaveSettings(char *name, struct List *list) {  struct IFFHandle  *iff;  struct PrefHeader  header = { 0, 0, 0 };  struct Node       *n;  BOOL               success = FALSE;  if(name && (iff = AllocIFF())) {    iff->iff_Stream = (ULONG) Open(name, MODE_NEWFILE);    if(iff->iff_Stream) {      InitIFFasDOS(iff);      if(!OpenIFF(iff, IFFF_WRITE)) {        if(! PushChunk(iff, ID_PREF, ID_FORM, IFFSIZE_UNKNOWN)) {          success = TRUE;          // Prefs header          if(! PushChunk(iff, ID_PREF, ID_PRHD, sizeof header)) {	    EndianSwap( sizeof (UBYTE), &header.ph_Version );	    EndianSwap( sizeof (UBYTE), &header.ph_Type );	    EndianSwap( sizeof (ULONG), &header.ph_Flags );            WriteChunkBytes(iff, &header, sizeof header);            PopChunk(iff);          }          else success = FALSE;          // Global prefs          if(! PushChunk(iff, ID_PREF, ID_AHIG, sizeof globalprefs)) {	    struct AHIGlobalPrefs p;	    	    CopyIfValid( struct AHIGlobalPrefs, ahigp_DebugLevel,			 globalprefs, p, sizeof p );	    CopyIfValid( struct AHIGlobalPrefs, ahigp_DisableSurround,			 globalprefs, p, sizeof p );	    CopyIfValid( struct AHIGlobalPrefs, ahigp_DisableEcho,			 globalprefs, p, sizeof p );	    CopyIfValid( struct AHIGlobalPrefs, ahigp_FastEcho,			 globalprefs, p, sizeof p );	    CopyIfValid( struct AHIGlobalPrefs, ahigp_MaxCPU,			 globalprefs, p, sizeof p );	    CopyIfValid( struct AHIGlobalPrefs, ahigp_ClipMasterVolume, 			 globalprefs, p, sizeof p );	    CopyIfValid( struct AHIGlobalPrefs, ahigp_Pad,			 globalprefs, p, sizeof p );	    CopyIfValid( struct AHIGlobalPrefs, ahigp_AntiClickTime,			 globalprefs, p, sizeof p );		            WriteChunkBytes(iff, &p, sizeof p);            PopChunk(iff);          }          else success = FALSE;          // Units          if(list != NULL) {                for(n = list->lh_Head; n->ln_Succ; n = n->ln_Succ) {              if(! PushChunk(iff, ID_PREF, ID_AHIU, sizeof(struct AHIUnitPrefs))) {		struct AHIUnitPrefs p;		CopyIfValid( struct AHIUnitPrefs, ahiup_Unit,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		CopyIfValid( struct AHIUnitPrefs, ahiup_ScaleMode,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		CopyIfValid( struct AHIUnitPrefs, ahiup_Channels,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		CopyIfValid( struct AHIUnitPrefs, ahiup_AudioMode,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		CopyIfValid( struct AHIUnitPrefs, ahiup_Frequency,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		CopyIfValid( struct AHIUnitPrefs, ahiup_MonitorVolume,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		CopyIfValid( struct AHIUnitPrefs, ahiup_InputGain,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		CopyIfValid( struct AHIUnitPrefs, ahiup_OutputVolume,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		CopyIfValid( struct AHIUnitPrefs, ahiup_Input,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		CopyIfValid( struct AHIUnitPrefs, ahiup_Output,			     ((struct UnitNode *) n)->prefs, p, sizeof p );		                WriteChunkBytes(iff, &p, sizeof p);                PopChunk(iff);              }              else success = FALSE;            }          }        }        CloseIFF(iff);      }      Close((BPTR) iff->iff_Stream);    }    FreeIFF(iff);  }  return success;}