Changeset 777832e in mainline for uspace/lib/c/generic/stdio.c
- Timestamp:
- 2018-06-21T12:27:09Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 296890f3
- Parents:
- 7d7bc09
- git-author:
- Jiri Svoboda <jiri@…> (2018-06-20 19:26:46)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-06-21 12:27:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/stdio.c
r7d7bc09 r777832e 1 1 /* 2 * Copyright (c) 201 7Jiri Svoboda2 * Copyright (c) 2018 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 35 35 #include <errno.h> 36 36 #include <stdio.h> 37 #include <str_error.h> 37 38 #include <vfs/vfs.h> 39 40 /** Get stream position. 41 * 42 * @param stream Stream 43 * @param pos Place to store position 44 * 45 * @return Zero on success, non-zero on failure 46 */ 47 int fgetpos(FILE *stream, fpos_t *pos) 48 { 49 off64_t p; 50 51 p = ftell64(stream); 52 if (p < 0) 53 return -1; 54 55 pos->pos = p; 56 return 0; 57 } 58 59 /** Get stream position. 60 * 61 * @param stream Stream 62 * @param pos Position 63 * 64 * @return Zero on sucess, non-zero on failure 65 */ 66 int fsetpos(FILE *stream, const fpos_t *pos) 67 { 68 int rc; 69 70 rc = fseek64(stream, pos->pos, SEEK_SET); 71 if (rc < 0) 72 return -1; 73 74 return 0; 75 } 38 76 39 77 /** Rename file or directory (C standard) */ … … 65 103 } 66 104 105 /** Print error message and string representation of @c errno. 106 * 107 * @param s Error message 108 */ 109 void perror(const char *s) 110 { 111 if (s != NULL && *s != '\0') 112 fprintf(stderr, "%s: %s\n", s, str_error(errno)); 113 else 114 fprintf(stderr, "%s\n", str_error(errno)); 115 } 116 67 117 /** @} 68 118 */
Note:
See TracChangeset
for help on using the changeset viewer.