Changeset 4f4b4e7 in mainline for uspace/lib/posix/stdio.c
- Timestamp:
- 2011-06-15T23:38:45Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b08ef1fd
- Parents:
- ab547063
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdio.c
rab547063 r4f4b4e7 1 1 /* 2 2 * Copyright (c) 2011 Jiri Zarevucky 3 * Copyright (c) 2011 Petr Koupy 3 4 * All rights reserved. 4 5 * … … 36 37 37 38 #include <assert.h> 38 #include "errno.h" 39 #include <errno.h> 40 39 41 #include "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 filename 53 * @param mode 54 * @param stream 55 * @return 56 */ 57 FILE *posix_freopen( 58 const char *restrict filename, 59 const char *restrict mode, 60 FILE *restrict stream) 49 61 { 50 62 assert(mode != NULL); … … 55 67 56 68 /* 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"); 69 * with buggy apps that expect this to work 70 */ 71 fprintf(stderr, 72 "ERROR: Application wants to use freopen() to change mode of opened stream.\n" 73 " libposix does not support that yet, the application may function improperly.\n"); 60 74 errno = ENOTSUP; 61 75 return NULL; … … 68 82 } 69 83 memcpy(copy, stream, sizeof(FILE)); 70 fclose(copy); 84 fclose(copy); /* copy is now freed */ 71 85 72 copy = fopen(filename, mode); 86 copy = fopen(filename, mode); /* open new stream */ 73 87 if (copy == NULL) { 74 88 /* fopen() sets errno */ … … 87 101 } 88 102 103 /** 104 * 105 * @param s 106 */ 89 107 void posix_perror(const char *s) 90 108 { … … 95 113 /** @} 96 114 */ 97
Note:
See TracChangeset
for help on using the changeset viewer.