Changeset 8e3498b in mainline for uspace/app/bdsh/cmds/modules/cat/cat.c
- Timestamp:
- 2017-12-04T18:44:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bde5c04
- Parents:
- 40feeac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r40feeac r8e3498b 180 180 off64_t head, off64_t tail, bool tail_first) 181 181 { 182 int fd, bytes = 0, count = 0, reads = 0; 182 int fd, count = 0, reads = 0; 183 size_t bytes; 183 184 char *buff = NULL; 184 int i;185 size_t i; 185 186 size_t offset = 0, copied_bytes = 0; 186 187 off64_t file_size = 0, length = 0; 187 188 aoff64_t pos = 0; 189 int rc; 188 190 189 191 bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0); … … 250 252 } 251 253 252 bytes = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read); 254 rc = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read, 255 &bytes); 253 256 copied_bytes = 0; 254 257 255 if ( bytes > 0) {258 if (rc == EOK && bytes > 0) { 256 259 buff[bytes] = '\0'; 257 260 offset = 0; … … 284 287 if (reading_stdin) 285 288 fflush(stdout); 286 } while ( bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));289 } while (rc == EOK && bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE)); 287 290 288 291 vfs_put(fd); 289 if ( bytes == -1) {292 if (rc != EOK) { 290 293 printf("Error reading %s\n", fname); 291 294 free(buff);
Note:
See TracChangeset
for help on using the changeset viewer.