rem: NewSettings(ENVFILE);
add: NewSettings(args.from);
context: void EventLoop(void) {  ULONG signal  = NULL, rc;  BOOL  running = TRUE;  GetAttr( WINDOW_SigMask, WO_Window, &signal );  if(signal) {    do {      if(Wait(signal | SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C ) {        running=FALSE;      }      while (( rc = HandleEvent( WO_Window )) != WMHI_NOMORE ) {        switch(rc) {          case WMHI_CLOSEWINDOW:            running=FALSE;            break;          case ACTID_OPEN:          {            if(DoMethod( openreq, FRM_DOREQUEST ) == FRQ_OK) {              char *file = NULL;              GetAttr( FRQ_Path, openreq, (ULONG *) &file);              NewSettings(file);              GUINewSettings();            }            break;          }          case ACTID_SAVEAS:          {            FillUnit();            if(DoMethod( savereq, FRM_DOREQUEST ) == FRQ_OK) {              char *file = NULL;              GetAttr( FRQ_Path, savereq, (ULONG *) &file);              SaveSettings(file, UnitList);              if(SaveIcons) {                WriteIcon(file);              }            }            break;                    }                    case ACTID_ABOUT:            Req( (char *) msgButtonOK,                (char *) msgTextCopyright,                ISEQ_C,  msgTextProgramName,                "1997 Martin Blom" );            break;          case ACTID_SAVE:            FillUnit();            SaveSettings(ENVFILE, UnitList);            SaveSettings(ENVARCFILE, UnitList);            running=FALSE;            break;          case ACTID_USE:            FillUnit();            SaveSettings(ENVFILE, UnitList);            running=FALSE;            break;          case ACTID_QUIT:            running=FALSE;            break;          case ACTID_DEFAULT:            NewSettings(NULL);            GUINewSettings();            break;          case ACTID_LASTSAVED:            NewSettings(ENVARCFILE);            GUINewSettings();            break;          case ACTID_RESTORE:            NewSettings(ENVFILE);            GUINewSettings();            break;          case ACTID_ICONS:          {            struct MenuItem *item;            item = FindMenuItem(ACTID_ICONS);            if(item) {              if(item->Flags & CHECKED)                SaveIcons = TRUE;              else                SaveIcons = FALSE;            }            break;          }          case ACTID_HELP: {            APTR lock = BGUI_LockWindow(window);            if(!BGUI_Help( window, HELPFILE, "AHI", NULL)) {              Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);            }            BGUI_UnlockWindow(lock);            break;          }          case ACTID_GUIDE: {            APTR lock = BGUI_LockWindow(window);            if(!BGUI_Help( window, HELPFILE, NULL, NULL)) {              Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);            }            BGUI_UnlockWindow(lock);            break;          }          case ACTID_HELPINDEX: {            APTR lock = BGUI_LockWindow(window);            if(!BGUI_Help( window, HELPFILE, "Concept Index", 0)) {              Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);            }            BGUI_UnlockWindow(lock);            break;          }          case ACTID_UNIT: {            ULONG unit;            FillUnit();            GetAttr( CYC_Active, Window_Objs[rc], &unit);            NewUnit(unit);            GUINewUnit();            break;          }          case ACTID_MODE: {            ULONG mode;            FillUnit();            GetAttr( LISTV_LastClickedNum, Window_Objs[rc], &mode);            NewMode(mode);            GUINewMode();            break;          }          case ACTID_DEBUG:          case ACTID_SURROUND:          case ACTID_ECHO:          case ACTID_CPULIMIT:          {            ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90;            GetAttr( CYC_Active,   Window_Objs[ACTID_DEBUG],    &debug);            GetAttr( CYC_Active,   Window_Objs[ACTID_SURROUND], &surround);            GetAttr( CYC_Active,   Window_Objs[ACTID_ECHO],     &echo);            GetAttr( SLIDER_Level, Window_Objs[ACTID_CPULIMIT], &cpu);            globalprefs.ahigp_DebugLevel      = debug;            globalprefs.ahigp_DisableSurround = surround;            globalprefs.ahigp_DisableEcho     = (echo == 2);            globalprefs.ahigp_FastEcho        = (echo == 1);            globalprefs.ahigp_MaxCPU = (cpu << 16) / 100;            break;          }        }      }    } while(running);  }}