MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / read_line

Function read_line

cdb2api/cdb2api.c:1248–1267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1246}
1247
1248static int read_line(char *line, int maxlen, SBUF2 *s, const char *buf,
1249 int *chrno)
1250{
1251 int ch = get_char(s, buf, chrno);
1252 while (ch == ' ' || ch == '\n')
1253 ch = get_char(s, buf, chrno); // consume empty lines
1254
1255 int count = 0;
1256 while ((ch != '\n') && (ch != EOF) && (ch != '\0')) {
1257 line[count] = ch;
1258 count++;
1259 if (count >= maxlen)
1260 return count;
1261 ch = get_char(s, buf, chrno);
1262 }
1263 if (count == 0)
1264 return -1;
1265 line[count + 1] = '\0';
1266 return count + 1;
1267}
1268
1269int is_valid_int(const char *str)
1270{

Callers 1

read_comdb2db_cfgFunction · 0.70

Calls 1

get_charFunction · 0.85

Tested by

no test coverage detected