ReactOS 0.4.15-dev-7928-g68a8619
jssnprintf.c File Reference
#include <schily/mconfig.h>
#include <schily/unistd.h>
#include <schily/stdio.h>
#include <schily/stdlib.h>
#include <schily/varargs.h>
#include <schily/standard.h>
#include <schily/schily.h>
Include dependency graph for jssnprintf.c:

Go to the source code of this file.

Classes

struct  BUF
 

Typedefs

typedef struct BUF _BUF
 

Functions

EXPORT int js_snprintf __PR ((char *, size_t maxcnt, const char *,...))
 
static void _cput (char c, void *l)
 
EXPORT int js_snprintf (char *buf, unsigned maxcnt, char *form, va_alist)
 

Typedef Documentation

◆ _BUF

typedef struct BUF _BUF

Function Documentation

◆ __PR()

EXPORT int js_snprintf __PR ( (char *, size_t maxcnt, const char *,...)  )

◆ _cput()

static void _cput ( char  c,
void l 
)
static

Definition at line 39 of file jssnprintf.c.

43{
44 register BUF bp = (BUF)l;
45
46 if (--bp->count > 0) {
47 *bp->ptr++ = c;
48 } else {
49 /*
50 * Make sure that there will never be a negative overflow.
51 */
52 bp->count++;
53 }
54}
r l[0]
Definition: byte_order.h:168
#define c
Definition: ke_i.h:80
Definition: jssnprintf.c:29
int count
Definition: jssnprintf.c:31
char * ptr
Definition: jssnprintf.c:30

Referenced by js_snprintf().

◆ js_snprintf()

EXPORT int js_snprintf ( char buf,
unsigned  maxcnt,
char form,
va_alist   
)

Definition at line 62 of file jssnprintf.c.

68{
70 int cnt;
71 _BUF bb;
72
73 bb.ptr = buf;
74 bb.count = maxcnt;
75
76#ifdef PROTOTYPES
78#else
80#endif
81 cnt = format(_cput, &bb, form, args);
82 va_end(args);
83 if (maxcnt > 0)
84 *(bb.ptr) = '\0';
85 if (bb.count < 0)
86 return (-1);
87
88 return (cnt);
89}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
int form
Definition: main.c:89
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void _cput(char c, void *l)
Definition: jssnprintf.c:39
#define args
Definition: format.c:66
Definition: match.c:390

Referenced by _comerr(), and set_de_path().