summaryrefslogtreecommitdiff
path: root/apps/tagdb/unique.c
blob: 471f59e67f89772655e7e22a685ce12da0dad0cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "unique.h"

#include <string.h>
#include <stdio.h>

char *create_unique_name(char *buffer, const char *prefix, const char *suffix, int digits) {
	static unsigned long i=0;

	strcpy(buffer, prefix);
	sprintf(buffer+strlen(prefix), "%05lu", i);
	strcat(buffer, suffix);

	i++;

	return buffer;
}