summaryrefslogtreecommitdiff
path: root/src/MSL_C.PPCEABI.bare.H/wchar_io.c
blob: 87da4af79daef7ab675d3645d42a6bc2f8c15189 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>

int fwide(FILE* stream, int mode) {
  int orientation;
  int result;

  if ((stream == NULL) || (stream->mode.file_kind == __closed_file))
    return 0;
  orientation = stream->mode.file_orientation;
  switch (orientation) {
  case __unoriented:
    if (mode > 0)
      stream->mode.file_orientation = __wide_oriented;
    else if (mode < 0)
      stream->mode.file_orientation = __char_oriented;
    result = mode;
    break;

  case __wide_oriented:
    result = 1;
    break;

  case __char_oriented:
    result = -1;
    break;
  }
  return result;
}