XINU
fprintf.c
Go to the documentation of this file.
1 /* fprintf.c - _fdoprnt */
2 
3 #include <xinu.h>
4 #include <stdarg.h>
5 
6 extern void _fdoprnt(char *, va_list, int (*)(did32, char), int);
7 
8 /*------------------------------------------------------------------------
9  * fprintf - Print a formatted message on specified device (file).
10  * Return 0 if the output was printed successfully,
11  * and -1 if an error occurred.
12  *------------------------------------------------------------------------
13  */
14 int fprintf(
15  int dev, /* device to write to */
16  char *fmt, /* format string */
17  ...
18  )
19 {
20  va_list ap;
21  int putc(did32, char);
22 
23  va_start(ap, fmt);
24  _fdoprnt(fmt, ap, putc, dev);
25  va_end(ap);
26 
27  return 0;
28 }
全てのシステムヘッダファイルをインクルードする。
void _fdoprnt(char *, va_list, int(*)(did32, char), int)
#define va_start(last, va)
va_list型を初期化し、可変長引数の使用を開始する。
Definition: stdarg.h:25
syscall putc(did32, char)
デバイスへ文字1Byteを送信する。
Definition: putc.c:18
#define va_end(va)
可変長引数の処理を終了する。
Definition: stdarg.h:42
可変長引数を実現するための宣言およびマクロ
int32 did32
デバイスID
Definition: kernel.h:28
__builtin_va_list va_list
可変個の実引数を扱うための情報を保持するための型(__builtin_va_listはGCCに定義された型) ...
Definition: stdarg.h:7
int fprintf(int dev, char *fmt,...)
Definition: fprintf.c:14