MCPcopy Index your code
hub / github.com/RsyncProject/rsync / read_line_old

Function read_line_old

io.c:2402–2423  ·  view source on GitHub ↗

Read a line of up to bufsiz-1 characters into buf. Strips * the (required) trailing newline and all carriage returns. * Returns 1 for success; 0 for I/O error or truncation. */

Source from the content-addressed store, hash-verified

2400 * the (required) trailing newline and all carriage returns.
2401 * Returns 1 for success; 0 for I/O error or truncation. */
2402int read_line_old(int fd, char *buf, size_t bufsiz, int eof_ok)
2403{
2404 assert(fd != iobuf.in_fd);
2405 bufsiz--; /* leave room for the null */
2406 while (bufsiz > 0) {
2407 if (safe_read(fd, buf, 1) == 0) {
2408 if (eof_ok)
2409 break;
2410 return 0;
2411 }
2412 if (*buf == '\0')
2413 return 0;
2414 if (*buf == '\n')
2415 break;
2416 if (*buf != '\r') {
2417 buf++;
2418 bufsiz--;
2419 }
2420 }
2421 *buf = '\0';
2422 return bufsiz > 0;
2423}
2424
2425void io_printf(int fd, const char *format, ...)
2426{

Callers 5

auth_serverFunction · 0.85
exchange_protocolsFunction · 0.85
start_inband_exchangeFunction · 0.85
namecvt_callFunction · 0.85
start_daemonFunction · 0.85

Calls 1

safe_readFunction · 0.70

Tested by

no test coverage detected