~vcs-imports/gawk/master

« back to all changes in this revision

Viewing changes to missing.d/vprintf.c

  • Committer: Arnold D. Robbins
  • Date: 2010-07-16 08:58:26 UTC
  • Revision ID: git-v1:765c7494b3dac62207e6cd57fb839997e237f292
Moving to 2.13.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <stdio.h>
2
 
#include <varargs.h>
3
 
 
4
 
#ifndef BUFSIZ
5
 
#include <stdio.h>
6
 
#endif
7
 
 
8
 
#ifndef va_dcl
9
 
#include <varargs.h>
10
 
#endif
11
 
 
12
 
int
13
 
vsprintf(str, fmt, ap)
14
 
        char *str, *fmt;
15
 
        va_list ap;
16
 
{
17
 
        FILE f;
18
 
        int len;
19
 
 
20
 
        f._flag = _IOWRT+_IOSTRG;
21
 
        f._ptr = (char *)str;   /* My copy of BSD stdio.h has this as (char *)
22
 
                                 * with a comment that it should be
23
 
                                 * (unsigned char *).  Since this code is
24
 
                                 * intended for use on a vanilla BSD system,
25
 
                                 * we'll stick with (char *) for now.
26
 
                                 */
27
 
        f._cnt = 32767;
28
 
        len = _doprnt(fmt, ap, &f);
29
 
        *f._ptr = 0;
30
 
        return (len);
31
 
}
32
 
 
33
 
int
34
 
vfprintf(iop, fmt, ap)
35
 
        FILE *iop;
36
 
        char *fmt;
37
 
        va_list ap;
38
 
{
39
 
        int len;
40
 
 
41
 
        len = _doprnt(fmt, ap, iop);
42
 
        return (ferror(iop) ? EOF : len);
43
 
}
44
 
 
45
 
int
46
 
vprintf(fmt, ap)
47
 
        char *fmt;
48
 
        va_list ap;
49
 
{
50
 
        int len;
51
 
 
52
 
        len = _doprnt(fmt, ap, stdout);
53
 
        return (ferror(stdout) ? EOF : len);
54
 
}