Subversion Repositories Kolibri OS

Rev

Rev 6424 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6424 Rev 6433
Line 1... Line 1...
1
#include 
1
#include 
2
#include 
2
#include 
Line -... Line 3...
-
 
3
 
-
 
4
 
3
 
5
 
4
int fprintf(FILE* file, const char* format, ...)
6
int fprintf(FILE* file, const char* format, ...)
5
{
7
{
-
 
8
    va_list		arg;
-
 
9
    va_start (arg, format);
-
 
10
 
-
 
11
    return vfprintf(file, format, arg);
-
 
12
 
-
 
13
}
-
 
14
 
-
 
15
int vfprintf ( FILE * file, const char * format, va_list arg )
6
va_list		arg;
16
{
7
char		*buf;
17
    char		*buf;
-
 
18
    int		printed, rc = 0;
-
 
19
 
-
 
20
    if(!file || !format)
-
 
21
    {
8
int		printed;
22
        errno = E_INVALIDPTR;
-
 
23
        return errno;
Line 9... Line -...
9
//int		data[4];
-
 
10
	
24
    }
-
 
25
 
-
 
26
    buf=malloc(4096*2); //8kb max
-
 
27
    if(!buf)
11
  va_start (arg, format);
28
    {
-
 
29
        errno = E_NOMEM;
Line 12... Line 30...
12
  buf=malloc(4096*2); //8kb max
30
        return errno;
13
  //data[0]=(int)&arg-(int)&format;
31
    }
14
 
32
 
15
  printed=format_print(buf,8191, format,arg);
33
  printed=format_print(buf,8191, format,arg);
16
  if (file == stderr)
34
  if (file == stderr)
17
  	debug_out_str(buf);
35
  	debug_out_str(buf);
Line -... Line 36...
-
 
36
  else
-
 
37
  	rc = fwrite(buf,printed,1,file);
-
 
38
  free(buf);
18
  else
39
 
19
  	fwrite(buf,printed,1,file);
40
  if (rc < 0)