Aus der tuxbox/apps/tuxbox/enigma/src/enigma_ipkg.cpp
Code: Alles auswählen
[...]
void ePackageSettings::SaveSettings()
{
eListBoxEntryText * e;
e = IPKGInstallOption->getCurrent();
eConfig::getInstance()->setKey("/elitedvb/ipkg/install", (char *)e->getKey());
char tagValue[300];
sprintf(tagValue, "%s", path->getText().c_str());
eConfig::getInstance()->setKey("/elitedvb/ipkg/target", tagValue);
FILE *fd_conf;
if (!(fd_conf = fopen("/etc/ipkg.conf" , "wb")))
{
return;
}
fprintf(fd_conf,"src lists %s\n", lServer->getText().c_str());
fclose(fd_conf);
eConfig::getInstance()->flush();
close(1);
}
[...]
void ePackageSettings::LoadSettings()
{
char* install="install";
eConfig::getInstance()->getKey("/elitedvb/ipkg/install", install);
IPKGInstallOption->forEachEntry(selectComboEntry(install, IPKGInstallOption));
char* target="/tmp/";
eConfig::getInstance()->getKey("/elitedvb/ipkg/target", target);
path->setText(target);
char line_buffer[256], c_server[256]="http://192.168.178.34/package";
char *ptr;
FILE *fp;
if(fp = fopen("/etc/ipkg.conf", "r+"))
{
while(fgets(line_buffer, sizeof(line_buffer), fp))
{
if((ptr = strstr(line_buffer, "src lists ")))
{
sscanf(ptr + 10, "%s", c_server);
}
}
fclose (fp);
}
lServer->setText(c_server);
[...]