summaryrefslogtreecommitdiff
path: root/lib/cvtuns.c
blob: b535b34c96e23537745270d297132ab1dedc7848 (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
38
/**
** @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