Changes in uspace/app/bdsh/cmds/modules/cat/cat.c [f77c1c9:582a0b8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
rf77c1c9 r582a0b8 180 180 off64_t head, off64_t tail, bool tail_first) 181 181 { 182 int fd, count = 0, reads = 0; 183 size_t bytes; 182 int fd, bytes = 0, count = 0, reads = 0; 184 183 char *buff = NULL; 185 size_t i;184 int i; 186 185 size_t offset = 0, copied_bytes = 0; 187 186 off64_t file_size = 0, length = 0; 188 187 aoff64_t pos = 0; 189 int rc;190 188 191 189 bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0); … … 195 193 /* Allow storing the whole UTF-8 character. */ 196 194 blen = STR_BOUNDS(1); 197 } else { 198 int rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd); 199 if (rc != EOK) { 200 fd = -1; 201 } 202 } 195 } else 196 fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ); 203 197 204 198 if (fd < 0) { … … 256 250 } 257 251 258 rc = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read, 259 &bytes); 252 bytes = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read); 260 253 copied_bytes = 0; 261 254 262 if ( rc == EOK &&bytes > 0) {255 if (bytes > 0) { 263 256 buff[bytes] = '\0'; 264 257 offset = 0; … … 291 284 if (reading_stdin) 292 285 fflush(stdout); 293 } while ( rc == EOK &&bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));286 } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE)); 294 287 295 288 vfs_put(fd); 296 if ( rc != EOK) {289 if (bytes == -1) { 297 290 printf("Error reading %s\n", fname); 298 291 free(buff);
Note:
See TracChangeset
for help on using the changeset viewer.