view libutil/decimal_incr.c @ 83:3055d5c9e7a3

fc-simtool update-rec* commands: check curfile_record_len and error out if it is not set
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 11 Apr 2021 02:38:31 +0000
parents 9c9f6adbaedb
children
line wrap: on
line source

/*
 * This module implements a function for incrementing decimal strings,
 * to be used in producing ranges of ICCID and IMSI numbers.
 */

#include <sys/types.h>

void
decimal_string_increment(str, ndigits)
	u_char *str;
	unsigned ndigits;
{
	u_char *p;

	for (p = str + ndigits; p > str; ) {
		--p;
		(*p)++;
		if (*p < 10)
			return;
		*p = 0;
	}
}