~ubuntu-branches/ubuntu/dapper/gnats/dapper

« back to all changes in this revision

Viewing changes to libiberty/vsprintf.c

  • Committer: Bazaar Package Importer
  • Author(s): Chad Walstrom
  • Date: 2005-03-07 17:56:31 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050307175631-agtm10dvjbemuc64
Tags: 4.1.0-0
* New upstream version
* debian/rules: now uses '--with-lispdir' option instead of environment
  variable overloading. Re-enabled optimization.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Simple implementation of vsprintf for systems without it.
2
 
   Highly system-dependent, but should work on most "traditional"
3
 
   implementations of stdio; newer ones should already have vsprintf.
4
 
   Written by Per Bothner of Cygnus Support.
5
 
   Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu).
6
 
   Copyright (C) 1991, 1995 Free Software Foundation, Inc.
7
 
 
8
 
This file is part of the libiberty library.  This library is free
9
 
software; you can redistribute it and/or modify it under the
10
 
terms of the GNU General Public License as published by the
11
 
Free Software Foundation; either version 2, or (at your option)
12
 
any later version.
13
 
 
14
 
This library is distributed in the hope that it will be useful,
15
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
GNU General Public License for more details.
18
 
 
19
 
You should have received a copy of the GNU General Public License
20
 
along with GNU CC; see the file COPYING.  If not, write to
21
 
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
 
 
23
 
As a special exception, if you link this library with files
24
 
compiled with a GNU compiler to produce an executable, this does not cause
25
 
the resulting executable to be covered by the GNU General Public License.
26
 
This exception does not however invalidate any other reasons why
27
 
the executable file might be covered by the GNU General Public License. */
28
 
 
29
 
#include <varargs.h>
30
 
#include <stdio.h>
31
 
#include <ansidecl.h>
32
 
#undef vsprintf
33
 
 
34
 
int
35
 
vsprintf (buf, format, ap)
36
 
     char *buf;
37
 
     const char *format;
38
 
     va_list ap;
39
 
{
40
 
  FILE b;
41
 
  int ret;
42
 
#ifdef VMS
43
 
  b->_flag = _IOWRT|_IOSTRG;
44
 
  b->_ptr = buf;
45
 
  b->_cnt = 12000;
46
 
#else
47
 
  b._flag = _IOWRT|_IOSTRG;
48
 
  b._ptr = buf;
49
 
  b._cnt = 12000;
50
 
#endif
51
 
  ret = _doprnt(format, ap, &b);
52
 
  putc('\0', &b);
53
 
  return ret;
54
 
 
55
 
}