Example #1
0
int get_ini_parms(void) {
   char *mainini = (char*)sto_data(STOKEY_INIDATA);
   u32t     size = sto_size(STOKEY_INIDATA);
   u32t  pciscan = 0;
   int        rc = 0;
   spstr  dbcard;
   // init was saved by pointer, not as data copy
   sto_del(STOKEY_INIDATA);

   /* we have root environment here, so just storing keys for any other
      feature apps */
   u32t htype = hlp_hosttype();
   if (htype>=QSHT_BIOS && htype<=QSHT_EFI) {
      // scan all PCI buses on EFI by default
      if (htype==QSHT_EFI) pciscan = 1;
      setenv("HOSTTYPE", hoststrs[htype], 1);
   }

   u32t btype = hlp_boottype();
   if (btype>QSBT_NONE && btype<=QSBT_SINGLE) {
      setenv("BOOTTYPE", bootstrs[btype-1], 1);
      log_printf("boot type: %s!\n", bootstrs[btype-1]);
   }

   if (mainini) {
      log_printf("ini: %d bytes!\n",size);
      TStrings  ifl;
      ifl.SetText(mainini,size);
      hlp_memfree(mainini);
      if (!ifl.SaveToFile(ini_name)) log_printf("failed to copy ini!\n");

      TINIFile  ini(&ifl);
      dbcard    = ini.ReadStr(cfg_section,"DBCARD");
      pciscan   = ini.ReadInt(cfg_section, "PCISCAN_ALL", pciscan);
      no_tgates = ini.ReadInt(cfg_section,"NOTASK");
      msg_name  = ini.ReadStr(shell_section, "MESSAGES");
      ecmd_name = ini.ReadStr(shell_section, "EXTCOMMANDS");
      mod_delay = ini.ReadInt(cfg_section, "UNZALL", 0) ? 0 : 1;
      ctrln_d0  = ini.ReadInt(cfg_section,"CTRLN");
      rc        = ini.ReadInt(cfg_section,"REIPL");
      if (rc>0) reipltime = rc;
      // disable clock in menu
      rc        = ini.ReadInt(cfg_section,"NOCLOCK");
      if (rc>0 || hlp_insafemode()) setenv("MENU_NO_CLOCK", "YES", 1); else
         if (rc<0) env_setvar("MENU_NO_CLOCK", -1);

      u32t heapflags = ini.ReadInt(cfg_section,"HEAPFLAGS");
      mem_setopts(heapflags&0xF);

      rc = 1;
   } else
      log_printf("no file!\n");
   // save value
   sto_savedword(STOKEY_PCISCAN, pciscan);
   // set default names if no ini file or key in it
   if (!msg_name)  msg_name  = msg_path;
   if (!ecmd_name) ecmd_name = ECMD_PATH;
   // call DBCARD processing (only after pciscan was saved!)
   if (dbcard.length()) {
      rc = shl_dbcard(dbcard, log_printf);
      if (rc) log_printf("DBCARD setup err %d!\n", rc);
   }
   return rc;
}
Example #2
0
str_list* _std str_settext(const char *text, u32t len) {
   TStrings lst;
   lst.SetText(text,len);
   for (int ii=0;ii<=lst.Max();ii++) lst[ii].trimright();
   return str_getlist_local(lst.Str);
}