Esempio n. 1
0
struct Entry * parse_row(char row[1024]) {
    struct Entry *entry = malloc(sizeof(struct Entry));
    char *col = strtok_c(row, '\t'), col_num = 0;

    do {
        switch (col_num++) {
        case 0:
            entry->locid	= atoi(col);
            break;
        case 1:
            entry->ags	= strallocpy(col);
            break;
        case 2:
            entry->ascii	= strallocpy(col);
            break;
        case 3:
            entry->name	= strallocpy(col);
            break;
        case 4:
            entry->lat	= atof(col);
            break;
        case 5:
            entry->lon	= atof(col);
            break;
        case 6:
            entry->amt	= strallocpy(col);
            break;
        case 7:
            entry->plz	= strallocpy(col);
            break;
        case 8:
            entry->vorwahl	= strallocpy(col);
            break;
        case 9:
            entry->einwohner	= atoi(col);
            break;
        case 10:
            entry->flaeche	= atof(col);
            break;
        case 11:
            entry->kz	= strallocpy(col);
            break;
        case 12:
            entry->typ	= strallocpy(col);
            break;
        case 13:
            entry->level	= atoi(col);
            break;
        case 14:
            entry->of	= atoi(col);
            break;
        case 15:
            entry->invalid	= atoi(col);
            break;
        }
    } while ((col = strtok_c(NULL, '\t')));

    return entry;
}
Esempio n. 2
0
void CommandLineParser_Parse(const char* szInputCommandLine)
{
	CommandLineParser_iNoOfCommandLineEntries =  0 ;
	CommandLineParser_iNoOfParamters =  0 ;
	CommandLineParser_iNoOfOptions =  0 ;

	strtok_c(szInputCommandLine, 
			&CommandLineParser_TokenCompare, 
			&CommandLineParser_GroupToken,
			&CommandLineParser_Copy, 
			&CommandLineParser_iNoOfCommandLineEntries) ;

	CommandLineParser_ExpandCommandLine() ;

	CommandLineParser_LoadParameters() ;
	CommandLineParser_LoadOptions() ;
}