void ReadTextureSurfaceAssignments() { char filename[MAX_OSPATH]; char *footstep_data; char *parsedata; char line[80]; num_texsurfs = 0; Com_sprintf (filename, sizeof(filename), "texsurfs.txt"); FS_LoadFile (filename, (void **)&footstep_data); parsedata = footstep_data; if (!footstep_data) return; while (buf_gets(line, sizeof(line), &parsedata) && num_texsurfs < MAX_TEX_SURF) { sscanf(line,"%d %s",&tex_surf[num_texsurfs].step_id,tex_surf[num_texsurfs].tex); //Com_Printf("%d %s\n",tex_surf[num_texsurfs].step_id,tex_surf[num_texsurfs].tex); num_texsurfs++; } FS_FreeFile (footstep_data); }
extern int lxpanel_get_line(char**fp, line *s) { gchar *tmp, *tmp2; s->type = LINE_NONE; if (!fp) RET(s->type); while (buf_gets(s->str, s->len, fp)) { g_strstrip(s->str); if (s->str[0] == '#' || s->str[0] == 0) { continue; } if (!g_ascii_strcasecmp(s->str, "}")) { s->type = LINE_BLOCK_END; break; } s->t[0] = s->str; for (tmp = s->str; isalnum(*tmp); tmp++); for (tmp2 = tmp; isspace(*tmp2); tmp2++); if (*tmp2 == '=') { for (++tmp2; isspace(*tmp2); tmp2++); s->t[1] = tmp2; *tmp = 0; s->type = LINE_VAR; } else if (*tmp2 == '{') { *tmp = 0; s->type = LINE_BLOCK_START; } else { ERR( "parser: unknown token: '%c'\n", *tmp2); } break; } return s->type; }