stdio_h.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * Copyright (c) 2004, Bull SA. All rights reserved.
  3. * Created by: Laurent.Vivier@bull.net
  4. * This file is licensed under the GPL license. For the full content
  5. * of this license, see the COPYING file at the top level of this
  6. * source tree.
  7. */
  8. /* test if stdio.h exists and can be included */
  9. // #define _POSIX_C_SOURCE 2
  10. #include <stdio.h>
  11. #include <stdarg.h>
  12. void (*test_clearerr)(FILE *);
  13. int (*test_fclose)(FILE *);
  14. FILE * (*test_fdopen)(int, const char *);
  15. int (*test_feof)(FILE *);
  16. int (*test_ferror)(FILE *);
  17. int (*test_fflush)(FILE *);
  18. int (*test_fgetc)(FILE *);
  19. char * (*test_fgets)(char *__restrict, int, FILE *__restrict);
  20. int (*test_fileno)(FILE *);
  21. void (*test_flockfile)(FILE *);
  22. FILE * (*test_fopen)(const char *__restrict _name, const char *__restrict _type);
  23. int (*test_fprintf)(FILE *__restrict, const char *__restrict, ...);
  24. int (*test_fputc)(int, FILE *);
  25. int (*test_fputs)(const char *__restrict, FILE *__restrict);
  26. size_t (*test_fread)(void *__restrict, size_t _size, size_t _n, FILE *__restrict);
  27. FILE * (*test_freopen)(const char *__restrict, const char *__restrict, FILE *__restrict);
  28. int (*test_fscanf)(FILE *__restrict, const char *__restrict, ...);
  29. int (*test_ftrylockfile)(FILE *);
  30. void (*test_funlockfile)(FILE *);
  31. size_t (*test_fwrite)(const void *__restrict , size_t _size, size_t _n, FILE *);
  32. int (*test_getc)(FILE *);
  33. int (*test_getc_unlocked)(FILE *);
  34. int (*test_getchar)(void);
  35. int (*test_getchar_unlocked)(void);
  36. char * (*test_gets)(char *);
  37. void (*test_perror)(const char *);
  38. int (*test_printf)(const char *__restrict, ...);
  39. int (*test_putc)(int, FILE *);
  40. int (*test_putc_unlocked)(int, FILE *);
  41. int (*test_putchar)(int);
  42. int (*test_putchar_unlocked)(int);
  43. int (*test_puts)(const char *);
  44. int (*test_scanf)(const char *__restrict, ...);
  45. void (*test_setbuf)(FILE *__restrict, char *__restrict);
  46. int (*test_setvbuf)(FILE *__restrict, char *__restrict, int, size_t);
  47. int (*test_snprintf)(char *__restrict, size_t, const char *__restrict, ...);
  48. int (*test_sprintf)(char *__restrict, const char *__restrict, ...);
  49. int (*test_sscanf)(const char *__restrict, const char *__restrict, ...);
  50. int (*test_ungetc)(int, FILE *);
  51. FILE *test_stderr;
  52. FILE *test_stdin;
  53. FILE *test_stdout;
  54. int (*test_vfprintf)(FILE *restrict, const char *restrict, va_list);
  55. int (*test_vfscanf)(FILE *restrict, const char *restrict, va_list);
  56. int (*test_vprintf)(const char *restrict, va_list);
  57. int (*test_vscanf)(const char *restrict, va_list);
  58. int (*test_vsnprintf)(char *restrict, size_t, const char *restrict, va_list);
  59. int (*test_vsprintf)(char *restrict, const char *restrict, va_list);
  60. int (*test_vsscanf)(const char *restrict, const char *restrict, va_list);
  61. __attribute__((unused)) static int test_defined()
  62. {
  63. test_clearerr = clearerr;
  64. test_fclose = fclose;
  65. // test_fdopen = fdopen;
  66. test_feof = feof;
  67. test_ferror = ferror;
  68. test_fflush = fflush;
  69. test_fgetc = fgetc;
  70. test_fgets = fgets;
  71. // test_fileno = fileno;
  72. // test_flockfile = flockfile;
  73. test_fopen = fopen;
  74. test_fprintf = fprintf;
  75. test_fputc = fputc;
  76. test_fputs = fputs;
  77. test_fread = fread;
  78. test_freopen = freopen;
  79. test_fscanf = fscanf;
  80. // test_ftrylockfile = ftrylockfile;
  81. // test_funlockfile = funlockfile;
  82. test_fwrite = fwrite;
  83. test_getc = getc;
  84. // test_getc_unlocked = getc_unlocked;
  85. test_getchar = getchar;
  86. test_gets = gets;
  87. test_perror = perror;
  88. test_printf = printf;
  89. test_putc = putc;
  90. // test_putc_unlocked = putc_unlocked;
  91. test_putchar = putchar;
  92. // test_putchar_unlocked = putchar_unlocked;
  93. test_puts = puts;
  94. test_scanf = scanf;
  95. test_setbuf = setbuf;
  96. test_setvbuf = setvbuf;
  97. test_snprintf = snprintf;
  98. test_sprintf = sprintf;
  99. test_sscanf = sscanf;
  100. test_ungetc = ungetc;
  101. test_stderr = stderr;
  102. test_stdin = stdin;
  103. test_stdout = stdout;
  104. test_vfprintf = vfprintf;
  105. test_vfscanf = vfscanf;
  106. test_vprintf = vprintf;
  107. test_vscanf = vscanf;
  108. test_vsnprintf = vsnprintf;
  109. test_vsprintf = vsprintf;
  110. test_vsscanf = vsscanf;
  111. return 0;
  112. }