ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/ihost/libukcprog/strf.c
Revision: 1.2
Committed: Sat Mar 29 18:05:09 2003 UTC (21 years, 8 months ago) by tdb
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
State: FILE REMOVED
Log Message:
ihost now makes use of an external copy of libukcprog. This is
available as a seperate download. All files updated accordingly to make
this version 1.5.4.

File Contents

# User Rev Content
1 tdb 1.1 /* strf.c -- formatted strings, storage allocated from malloc */
2    
3     /* Copyright 1992 Godfrey Paul, University of Kent at Canterbury.
4     *
5     * You can do what you like with this source code as long as
6     * you don't try to make money out of it and you include an
7     * unaltered copy of this message (including the copyright).
8     */
9    
10 tdb 1.2 char ukcprog_strf_sccsid[] = "$Id: strf.c,v 1.1 2002/03/08 14:37:29 tdb Exp $ UKC";
11 tdb 1.1
12     #ifdef __STDC__
13     #include <stdarg.h>
14     #else
15     #include <varargs.h>
16     #endif
17    
18     #include <stdio.h>
19     #include <stdlib.h>
20    
21     #include "ukcprog.h"
22    
23    
24     #ifdef __STDC__
25     char *
26     strf(const char *fmt, ...)
27     {
28    
29     #else /* !__STDC__ */
30     char *
31     strf(va_alist)
32     va_dcl
33     {
34     char *fmt;
35     #endif /* !__STDC__ */
36     va_list args;
37     char buffer[100];
38     char *s;
39    
40     #ifdef __STDC__
41     va_start(args, fmt);
42     #else
43     va_start(args);
44     fmt = va_arg(args, char *);
45     #endif
46    
47     s = formf(buffer, sizeof(buffer), fmt, args);
48    
49     va_end(args);
50    
51     if (s == buffer) /* not obtained from malloc */
52     s = strsave(s);
53    
54     return s;
55     }