|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T a
Length: 1630 (0x65e)
Types: TextFile
Names: »asprintf.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
└─⟦eba4602b1⟧ »./isode-5.0.tar.Z«
└─⟦d3ac74d73⟧
└─⟦this⟧ »isode-5.0/compat/asprintf.c«
/* asprintf.c - sprintf with errno */
#ifndef lint
static char *rcsid = "$Header: /f/osi/compat/RCS/asprintf.c,v 6.0 89/03/18 23:24:54 mrose Rel $";
#endif
/*
* $Header: /f/osi/compat/RCS/asprintf.c,v 6.0 89/03/18 23:24:54 mrose Rel $
*
*
* $Log: asprintf.c,v $
* Revision 6.0 89/03/18 23:24:54 mrose
* Release 5.0
*
*/
/*
* NOTICE
*
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
* this agreement.
*
*/
/* LINTLIBRARY */
#include <stdio.h>
#include <varargs.h>
#include "general.h"
#include "manifest.h"
/* \f
DATA */
extern int errno;
/* \f
*/
void asprintf (bp, ap) /* what, fmt, args, ... */
char *bp;
va_list ap;
{
char *what;
what = va_arg (ap, char *);
_asprintf (bp, what, ap);
}
void _asprintf (bp, what, ap) /* fmt, args, ... */
register char *bp;
char *what;
va_list ap;
{
register int eindex;
char *fmt;
eindex = errno;
*bp = NULL;
fmt = va_arg (ap, char *);
if (fmt) {
#ifndef VSPRINTF
struct _iobuf iob;
#endif
#ifndef VSPRINTF
iob._flag = _IOWRT | _IOSTRG;
#ifndef vax
iob._ptr = (unsigned char *) bp;
#else
iob._ptr = bp;
#endif
iob._cnt = BUFSIZ;
_doprnt (fmt, ap, &iob);
putc (NULL, &iob);
#else
(void) vsprintf (bp, fmt, ap);
#endif
bp += strlen (bp);
}
if (what) {
if (*what) {
(void) sprintf (bp, " %s: ", what);
bp += strlen (bp);
}
(void) strcpy (bp, sys_errname (eindex));
bp += strlen (bp);
}
errno = eindex;
}