2 Unix SMB/Netbios implementation.
5 Copyright (C) Andrew Tridgell 1998
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 extern int DEBUGLEVEL
;
27 /* this is like vsnprintf but the 'n' limit does not include
28 the terminating null. So if you have a 1024 byte buffer then
30 int vslprintf(char *str
, int n
, char *format
, va_list ap
)
32 int ret
= vsnprintf(str
, n
, format
, ap
);
33 if (ret
> n
|| ret
< 0) {
42 int slprintf(char *str
, int n
, char *format
, ...)
45 int slprintf(va_alist
)
58 str
= va_arg(ap
,char *);
60 format
= va_arg(ap
,char *);
63 ret
= vslprintf(str
,n
,format
,ap
);
68 /* this is rather line fprintf, except that it works on a file descriptor
69 and is limited to one pstring of output */
71 int fdprintf(int fd
, char *format
, ...)
74 int fdprintf(va_alist
)
88 format
= va_arg(ap
,char *);
92 vslprintf(str
,sizeof(str
),format
,ap
);
94 return write(fd
, str
, strlen(str
));