Changeset 0ffbed9 in mainline for uspace/lib/posix/stdio.c
- Timestamp:
- 2011-06-19T17:49:29Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5974661
- Parents:
- f48b637 (diff), 32fb6944 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdio.c
rf48b637 r0ffbed9 1 1 /* 2 2 * Copyright (c) 2011 Jiri Zarevucky 3 * Copyright (c) 2011 Petr Koupy 3 4 * All rights reserved. 4 5 * … … 33 34 */ 34 35 35 #define POSIX_INTERNAL36 #define LIBPOSIX_INTERNAL 36 37 37 38 #include <assert.h> 38 #include "errno.h" 39 #include "common.h" 39 #include <errno.h> 40 41 #include "internal/common.h" 40 42 #include "stdio.h" 41 43 #include "string.h" 44 42 45 /* not the best of solutions, but freopen will eventually 43 need to be implemented in libc anyway */ 46 * need to be implemented in libc anyway 47 */ 44 48 #include "../c/generic/private/stdio.h" 45 49 46 FILE *posix_freopen(const char *restrict filename, 47 const char *restrict mode, 48 FILE *restrict stream) 50 /** 51 * 52 * @param c 53 * @param stream 54 * @return 55 */ 56 int posix_ungetc(int c, FILE *stream) 57 { 58 // TODO 59 not_implemented(); 60 } 61 62 /** 63 * 64 * @param filename 65 * @param mode 66 * @param stream 67 * @return 68 */ 69 FILE *posix_freopen( 70 const char *restrict filename, 71 const char *restrict mode, 72 FILE *restrict stream) 49 73 { 50 74 assert(mode != NULL); … … 55 79 56 80 /* print error to stderr as well, to avoid hard to find problems 57 with buggy apps that expect this to work */ 58 fprintf(stderr, "ERROR: Application wants to use freopen() to change mode of opened stream.\n" 59 " libposix does not support that yet, the application may function improperly.\n"); 81 * with buggy apps that expect this to work 82 */ 83 fprintf(stderr, 84 "ERROR: Application wants to use freopen() to change mode of opened stream.\n" 85 " libposix does not support that yet, the application may function improperly.\n"); 60 86 errno = ENOTSUP; 61 87 return NULL; … … 68 94 } 69 95 memcpy(copy, stream, sizeof(FILE)); 70 fclose(copy); 96 fclose(copy); /* copy is now freed */ 71 97 72 copy = fopen(filename, mode); 98 copy = fopen(filename, mode); /* open new stream */ 73 99 if (copy == NULL) { 74 100 /* fopen() sets errno */ … … 87 113 } 88 114 115 /** 116 * 117 * @param s 118 */ 89 119 void posix_perror(const char *s) 120 { 121 // TODO 122 not_implemented(); 123 } 124 125 /** 126 * 127 * @param stream 128 * @param offset 129 * @param whence 130 * @return 131 */ 132 int posix_fseeko(FILE *stream, posix_off_t offset, int whence) 133 { 134 // TODO 135 not_implemented(); 136 } 137 138 /** 139 * 140 * @param stream 141 * @return 142 */ 143 posix_off_t posix_ftello(FILE *stream) 144 { 145 // TODO 146 not_implemented(); 147 } 148 149 /** 150 * 151 * @param s 152 * @param format 153 * @param ... 154 * @return 155 */ 156 int posix_sprintf(char *s, const char *format, ...) 157 { 158 // TODO 159 not_implemented(); 160 } 161 162 /** 163 * 164 * @param s 165 * @param format 166 * @param ... 167 * @return 168 */ 169 int posix_sscanf(const char *s, const char *format, ...) 90 170 { 91 171 // TODO … … 95 175 /** @} 96 176 */ 97
Note:
See TracChangeset
for help on using the changeset viewer.