MCPcopy Create free account
hub / github.com/coreutils/coreutils / simple_cat

Function simple_cat

src/cat.c:173–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171 Return true if successful. */
172
173static bool
174simple_cat (char *buf, idx_t bufsize)
175{
176 /* Loop until the end of the file. */
177
178 while (true)
179 {
180 /* Read a block of input. */
181
182 ssize_t n_read = read (input_desc, buf, bufsize);
183 if (n_read < 0)
184 {
185 error (0, errno, "%s", quotef (infile));
186 return false;
187 }
188
189 /* End of this file? */
190
191 if (n_read == 0)
192 return true;
193
194 /* Write this block out. */
195
196 if (full_write (STDOUT_FILENO, buf, n_read) != n_read)
197 write_error ();
198 }
199}
200
201/* Write any pending output to STDOUT_FILENO.
202 Pending is defined to be the *BPOUT - OUTBUF bytes starting at OUTBUF.

Callers 1

mainFunction · 0.85

Calls 1

write_errorFunction · 0.85

Tested by

no test coverage detected