summaryrefslogtreecommitdiff
path: root/csrc/util.c
blob: 05dadd243117150142aaa9b8124d3b1afa27db4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (C)  2018 Iru Cai <mytbk920423@gmail.com>
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <string.h>

void strcpy_without_spaces(char * a1, const char * a2)
{
	size_t j = 0;
	size_t L = strlen(a2);

	for (size_t i = 0; i < L; i++) {
		if (a2[i] == ' ') {
			continue;
		}
		a1[j] = a2[i];
		j++;
	}
	a1[j] = 0;
}