GRASS 8 Programmer's Manual 8.6.0dev(2026)-c83afef6d3
Loading...
Searching...
No Matches
ascii_chk.c
Go to the documentation of this file.
1/*!
2 * \file lib/gis/ascii_chk.c
3 *
4 * \brief GIS Library - Remove non-ascii characters
5 *
6 * SPDX-FileCopyrightText: 2001-2014 GRASS Development Team
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 *
9 * \author GRASS Development Team
10 *
11 * \date 1999-2014
12 */
13
14#include <grass/gis.h>
15
16#define TAB 011
17#define SPACE 040
18
19/**
20 * \brief Removes non-ascii characters from buffer.
21 *
22 * Updates <b>string</b> with non_ascii characters removed, except for
23 * tabs, which are turned into spaces.
24 *
25 * \param[in,out] string buffer to have non-ascii characters removed
26 * \return
27 */
28void G_ascii_check(char *string)
29{
30 char *ptr1, *ptr2;
31
32 ptr1 = string;
33 ptr2 = string;
34
35 while (*ptr1) {
36 if ((*ptr1 >= 040) && (*ptr1 <= 0176))
37 *ptr2++ = *ptr1;
38 else if (*ptr1 == TAB)
39 *ptr2++ = SPACE;
40 ptr1++;
41 }
42 *ptr2 = 0;
43}
void G_ascii_check(char *string)
Removes non-ascii characters from buffer.
Definition ascii_chk.c:28
#define SPACE
Definition ascii_chk.c:17
#define TAB
Definition ascii_chk.c:16