GRASS GIS 8 Programmer's Manual 8.2.1RC1(2022)-exported
ascii_chk.c
Go to the documentation of this file.
1
2/*!
3 * \file lib/gis/ascii_chk.c
4 *
5 * \brief GIS Library - Remove non-ascii characters
6 *
7 * (C) 2001-2014 by the GRASS Development Team
8 *
9 * This program is free software under the GNU General Public License
10 * (>=v2). Read the file COPYING that comes with GRASS for details.
11 *
12 * \author GRASS GIS Development Team
13 *
14 * \date 1999-2014
15 */
16
17#include <grass/gis.h>
18
19
20#define TAB 011
21#define SPACE 040
22
23
24/**
25 * \brief Removes non-ascii characters from buffer.
26 *
27 * Updates <b>string</b> with non_ascii characters removed, except for
28 * tabs, which are turned into spaces.
29 *
30 * \param[in,out] string buffer to have non-ascii characters removed
31 * \return
32 */
33
34void G_ascii_check(char *string)
35{
36 char *ptr1, *ptr2;
37
38 ptr1 = string;
39 ptr2 = string;
40
41 while (*ptr1) {
42 if ((*ptr1 >= 040) && (*ptr1 <= 0176))
43 *ptr2++ = *ptr1;
44 else if (*ptr1 == TAB)
45 *ptr2++ = SPACE;
46 ptr1++;
47 }
48 *ptr2 = 0;
49}
void G_ascii_check(char *string)
Removes non-ascii characters from buffer.
Definition: ascii_chk.c:34
#define SPACE
Definition: ascii_chk.c:21
#define TAB
Definition: ascii_chk.c:20