Well, here's where we're getting...


int loadConfig () {
int fdConfigIni;
int iBytesRead = -1;
char szConfigIni[ 8193 ];
char *pszSection;
char *pszTemp;
char *pszEnd;
char szActive[8];
int errorflag = 0;
int iLen;

fprintf(stderr, "opening config file...\n");
fdConfigIni = open( "/empeg/var/config.ini", O_RDONLY );
fprintf(stderr, "fd: %d\n", fdConfigIni);
if (fdConfigIni != -1) {
iBytesRead = read( fdConfigIni, szConfigIni, 8193 );
fprintf(stderr, "bytes read: %d\n", iBytesRead);

szConfigIni[iBytesRead] = '\0';
close (fdConfigIni);
pszSection = strstr(szConfigIni, "[empwake]");
if ( pszSection != NULL) {
pszTemp = strstr(pszSection, "\n[");
*pszTemp = '\0';

pszTemp = strstr(pszSection, "\nfid=");
if ( pszTemp != NULL) {
pszTemp +=5;
pszEnd = strchr(pszTemp, '\n');
iLen = pszEnd - pszTemp;
strncpy(szFid, pszTemp, iLen);
printf("fid: %s\n", szFid);
} else {
printf("EmpWake warning: fid not specified in config.ini. Using the currently selected playlist for alarm.\n");
strncpy(szFid, "\01", sizeof(szFid) );
}
pszTemp = strstr(pszSection, "\nactive=");
if ( pszTemp != NULL) {
pszTemp +=8;
pszEnd = strchr(pszTemp, '\n');
iLen = pszEnd - pszTemp;
strncpy(szActive, pszTemp, iLen);
if ( strcasecmp(szActive, "true") == 0 ) {
g_iAlarmEnabled = 1;
} else {
g_iAlarmEnabled = 0;
}
} else {
printf("empwake: parse error line %d\n", __LINE__);
g_iAlarmEnabled = 0;
}
pszTemp = strstr(pszSection, "\ntime=");
if ( pszTemp != NULL) {
pszTemp +=6;
pszEnd = strchr(pszTemp, '\n');
iLen = pszEnd - pszTemp;
strncpy(szAlarmTime, pszTemp, iLen);
printf("time: %s\n", szAlarmTime);
pszTemp = szAlarmTime;
pszEnd = strchr(szAlarmTime, ':');
if ( pszEnd != NULL) {
*pszEnd = '\0';
stcAlarmTime.tm_hour = atoi(pszTemp);
} else {
printf("empwake: parse error line %d\n", __LINE__);
}
pszTemp = pszEnd + 1;
pszEnd = strchr(pszTemp, ':');
if ( pszEnd != NULL) {
*pszEnd = '\0';
stcAlarmTime.tm_min = atoi(pszTemp);
} else {
printf("empwake: parse error line %d\n", __LINE__);
}
pszTemp = pszEnd + 1;
stcAlarmTime.tm_sec = atoi(pszTemp);
} else {
printf("empwake: parse error line %d\n", __LINE__);
stcAlarmTime.tm_sec = stcAlarmTime.tm_min = stcAlarmTime.tm_hour = 0;
}
}
else {
printf("empwake: parse error line %d\n", __LINE__);
}

} else {
printf("empwake: could not read config.ini: errno %d\n", errno);
}
fprintf(stderr, "-loadConfig()\n");
return 0;
}


.

I pretty much have debug statements *everywhere* that should be showing up somewhere. I looked for fall-through cases but I'm really confused as to why there's no other output happening somewhere. If it fails to parse the config.ini, it should be complaining somewhere...
_________________________
- Tony C
my empeg stuff