# vsprintf.c File Reference

`#include <stdarg.h>`
`#include <lib/string.h>`

Include dependency graph for vsprintf.c:

Go to the source code of this file.

## Defines

#define | do_div(n, base)
#define | is_digit(c) ((c) >= '0' && (c) <= '9')
#define | LEFT 16
#define | PLUS 4
#define | SIGN 2
#define | SMALL 64
#define | SPACE 8
#define | SPECIAL 32
#define | ZEROPAD 1

## Functions

static char * | number (char *str, int num, int base, int size, int precision, int type)
static int | skip_atoi (const char **s)
int | vsprintf (char *buf, const char *fmt, vaList args)

## Define Documentation

#define do_div | ( | n,
|  | base |  | ) |

Value:

    ({ \
    int __res; \
    __asm__("divl %4":"=a" (n),"=d" (__res):"0" (n),"1" (0),"r" (base)); \
    __res; })

Definition at line 79 of file vsprintf.c.

Referenced by number().

#define is_digit | ( | c |  | ) | ((c) >= '0' && (c) <= '9')

Definition at line 60 of file vsprintf.c.

Referenced by skip_atoi(), and vsprintf().

#define LEFT 16

Definition at line 75 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define PLUS 4

Definition at line 73 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define SIGN 2

Definition at line 72 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define SMALL 64

Definition at line 77 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define SPACE 8

Definition at line 74 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define SPECIAL 32

Definition at line 76 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define ZEROPAD 1

Definition at line 71 of file vsprintf.c.

Referenced by number(), and vsprintf().

## Function Documentation

static char* number | ( | char * | str,
|  | int | num,
|  | int | base,
|  | int | size,
|  | int | precision,
|  | int | type |
| ) |  |  | `[static]`

Definition at line 84 of file vsprintf.c.

References do_div, LEFT, PLUS, SIGN, SMALL, SPACE, SPECIAL, and ZEROPAD.

Referenced by vsprintf().

static int skip_atoi | ( | const char ** | s | ) | `[static]`

Definition at line 62 of file vsprintf.c.

References is_digit.

Referenced by vsprintf().

int vsprintf | ( | char * | buf,
|  | const char * | fmt,
|  | vaList | args |
| ) |  |  |

Definition at line 139 of file vsprintf.c.

References is_digit, LEFT, number(), PLUS, SIGN, skip_atoi(), SMALL, SPACE, SPECIAL, strlen, vaArg, and ZEROPAD.

Referenced by kpanic(), kprintf(), and sprintf().

Here is the call graph for this function: