sprintf.c (a82bbc730e20fe9dec4abeb1d949b2d02869032a) sprintf.c (e74101e4eff767325553039def89de70b70f36d3)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 37 unchanged lines hidden (view full) ---

46#include "local.h"
47
48int
49sprintf(char *str, char const *fmt, ...)
50{
51 int ret;
52 va_list ap;
53 FILE f;
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 37 unchanged lines hidden (view full) ---

46#include "local.h"
47
48int
49sprintf(char *str, char const *fmt, ...)
50{
51 int ret;
52 va_list ap;
53 FILE f;
54 struct __sFILEX ext;
54
55 f._file = -1;
56 f._flags = __SWR | __SSTR;
57 f._bf._base = f._p = (unsigned char *)str;
58 f._bf._size = f._w = INT_MAX;
55
56 f._file = -1;
57 f._flags = __SWR | __SSTR;
58 f._bf._base = f._p = (unsigned char *)str;
59 f._bf._size = f._w = INT_MAX;
60 f._extra = &ext;
61 INITEXTRA(&f);
59 va_start(ap, fmt);
60 ret = __vfprintf(&f, fmt, ap);
61 va_end(ap);
62 *f._p = 0;
63 return (ret);
64}
62 va_start(ap, fmt);
63 ret = __vfprintf(&f, fmt, ap);
64 va_end(ap);
65 *f._p = 0;
66 return (ret);
67}