GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
GIS Library - Program basename routines. More...
#include <grass/gis.h>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
Go to the source code of this file.
Functions | |
char * | G_basename (char *filename, const char *desired_ext) |
Truncates filename to the base part (before the last '.') if it matches the extension, otherwise leaves it unchanged. More... | |
size_t | G_get_num_decimals (const char *str) |
Get number of decimals from a string. More... | |
char * | G_double_to_basename_format (double number, size_t ndigits, size_t ndecimals) |
Convert a double to a string substituting the dot with underscore 12.3456 => '12_3456'. More... | |
char * | G_get_basename_separator (void) |
Return the environmental basename variable or the default value. More... | |
char * | G_join_basename_strings (const char **strings, size_t len) |
join an array of strings using the basename separator More... | |
char * | G_generate_basename (const char *basename, double number, size_t ndigits, size_t ndecimals) |
Generate the format string. More... | |
GIS Library - Program basename routines.
(C) 2001-2014 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file basename.c.
char* G_basename | ( | char * | filename, |
const char * | desired_ext | ||
) |
Truncates filename to the base part (before the last '.') if it matches the extension, otherwise leaves it unchanged.
Checks if a filename matches a certain file extension (case insensitive) and if so, truncates the string to the base file name (cf. basename Unix command)
filename | string containing filename |
desired_ext | string containing extension to look for (case insensitive) |
Definition at line 36 of file basename.c.
Referenced by G_parser().
char* G_double_to_basename_format | ( | double | number, |
size_t | ndigits, | ||
size_t | ndecimals | ||
) |
Convert a double to a string substituting the dot with underscore 12.3456 => '12_3456'.
number | the double number that will be convert to string |
ndigits | the number of integer digits in the output string |
ndecimals | the number of decimals in the output string |
Definition at line 76 of file basename.c.
References G_malloc, and GNAME_MAX.
Referenced by G_generate_basename().
char* G_generate_basename | ( | const char * | basename, |
double | number, | ||
size_t | ndigits, | ||
size_t | ndecimals | ||
) |
Generate the format string.
basename | String with the basename |
digits | Number of digits number |
decimals | Number of decimal number |
filler | String used to fill, default is 0 |
Definition at line 162 of file basename.c.
References G_double_to_basename_format(), G_get_basename_separator(), and G_malloc.
char* G_get_basename_separator | ( | void | ) |
Return the environmental basename variable or the default value.
return pointer to basename separator
Definition at line 109 of file basename.c.
References GBASENAME_SEP, and NULL.
Referenced by G_generate_basename(), and G_join_basename_strings().
size_t G_get_num_decimals | ( | const char * | str | ) |
Get number of decimals from a string.
str | String to analyse |
Definition at line 54 of file basename.c.
References NULL.
char* G_join_basename_strings | ( | const char ** | strings, |
size_t | len | ||
) |
join an array of strings using the basename separator
strings | is an array of strings |
len | is the length of the array |
Definition at line 126 of file basename.c.
References G_get_basename_separator(), G_malloc, and strcpy.