Lines Matching refs:line

32 static int  assign_string_if_matches(char const *line, char const *argument,
35 static int assign_long_if_matches(char const *line, char const *argument,
37 static void read_line(PERF_Config *sConfig, char const *line, char const *tag);
38 static char const *get_value_if_matches(char const *line, char const *argument);
103 * Arg2 configuration line (trimmed of trailing white
116 void read_line(PERF_Config *cfg, char const *line, char const *tag)
121 while (*line && isspace(*line)) line++;
124 if (!*line || *line == '#') return;
128 /* find first white-space or . in the line */
129 for (ptr = line; *ptr && !isspace(*ptr) && *ptr != '.' && *ptr != '='; ptr++);
134 if (!tag || strncmp(line, tag, ptr - line)) return;
137 line = ptr + 1;
142 if (!(assign_long_if_matches(line, "mask", &cfg->mask) ||
144 assign_string_if_matches(line, "trace_file", &cfg->trace_file) ||
145 assign_long_if_matches(line, "delayed_open", &cfg->delayed_open) ||
146 assign_long_if_matches(line, "buffer_size", &cfg->buffer_size) ||
148 assign_string_if_matches(line, "log_file", &cfg->log_file) ||
149 assign_long_if_matches(line, "debug", &cfg->debug) ||
150 assign_long_if_matches(line, "detailed_debug",&cfg->detailed_debug) ||
151 assign_long_if_matches(line, "csv", &cfg->csv) ||
153 assign_string_if_matches(line, "replay_file", &cfg->replay_file) ||
155 assign_long_if_matches(line, "realtime", &cfg->realtime) ||
156 assign_long_if_matches(line, "rt_granularity", &cfg->rt_granularity) ||
157 assign_long_if_matches(line, "rt_debug", &cfg->rt_debug) ||
158 assign_long_if_matches(line, "rt_detailed", &cfg->rt_detailed) ||
159 assign_long_if_matches(line, "rt_summary", &cfg->rt_summary) ||
160 assign_string_if_matches(line, "rt_file", &cfg->rt_file)
165 "warning: incorrect line in configuration file:\n%s\n", line);
170 Effects: reads each line of the perf.ini file and processes configuration
171 assignments in linear order. Maximum line length is enforced, and all
172 lines longer than this are ignored. Also, all lines must end in new-line
179 char line[PERF_CONFIG_LINELENGTH];
188 /* read each line */
189 while (fgets(line, PERF_CONFIG_LINELENGTH, config_file))
191 if (/* strlen(line) == PERF_CONFIG_LINELENGTH && */
192 *line && line[strlen(line)-1] != '\n')
199 /* remove new-line and trailing spaces from end of line */
200 while (*line && isspace(line [strlen(line)-1]))
202 line[strlen(line)-1] = 0;
206 read_line(sConfig, line, tag);
227 * Arg1 configuration line
231 * Effects if the configuration line is <variable name> =
236 char const *get_value_if_matches(char const *line,
240 while (*line && isspace(*line)) line++;
243 if (strncasecmp(line, argument, strlen(argument))) return (NULL);
244 line += strlen(argument);
249 while (*line && isspace(*line)) line++;
252 if (*line != '=') return (NULL);
253 line++;
256 while (*line && isspace(*line)) line++;
258 /* if reached the end of line, return NULL; otherwise, return value */
259 return(*line ? line : NULL);
328 * Arg1 configuration line
334 * Effects if the configuration line is <variable name> =
342 int assign_string_if_matches(char const *line, char const *argument,
345 char const *value = get_value_if_matches(line, argument);
351 * Arg1 configuration line
357 * Effects if the configuration line is <variable name> =
368 * line was not an assignment to variable name).
372 int assign_long_if_matches(char const *line, char const *argument,
375 char const *value = get_value_if_matches(line, argument);