summaryrefslogtreecommitdiff
path: root/lib/cvtuns.c
blob: a0a686a64b9fad0502d5c97f0fee1ca19ad8e11e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
** @file	cvtuns.c
**
** @author	Numerous CSCI-452 classes
**
** @brief	C implementations of common library functions
*/

#ifndef CVTUNS_SRC_INC
#define CVTUNS_SRC_INC

#include <common.h>

#include <lib.h>

/**
** cvtuns(buf,value)
**
** Convert a 32-bit unsigned value into a NUL-terminated character string
**
** @param buf    Result buffer
** @param value  Value to be converted
**
** @return Length of the resulting buffer
**
** NOTE:  assumes buf is large enough to hold the resulting string
*/
int cvtuns( char *buf, uint32_t value ) {
	char    *bp = buf;

	bp = cvtuns0( bp, value );
	*bp = '\0';

	return bp - buf;
}

#endif