GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-b4187339ee
legal_name.c File Reference

GIS Library - Functions to handle file name legality. More...

#include <stdio.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/glocale.h>
Include dependency graph for legal_name.c:

Go to the source code of this file.

Functions

int G_legal_filename (const char *s)
 Check for legal database file name. More...
 
int G_check_input_output_name (const char *input, const char *output, int error)
 Check input and output file names. More...
 

Detailed Description

GIS Library - Functions to handle file name legality.

(C) 2001-2009, 2013 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.

Author
Original author CERL

Definition in file legal_name.c.

Function Documentation

◆ G_check_input_output_name()

int G_check_input_output_name ( const char *  input,
const char *  output,
int  error 
)

Check input and output file names.

Check: 1) output is legal map name, 2) if can find input map, and 3) if input was found in current mapset, check if input != output.

Parameters
inputinput map name
outputoutput map name
errorerror type: G_FATAL_EXIT, G_FATAL_PRINT, G_FATAL_RETURN
Returns
0 OK
1 error

Definition at line 71 of file legal_name.c.

◆ G_legal_filename()

int G_legal_filename ( const char *  s)

Check for legal database file name.

Legal file names will not begin with '.' or NULL and must not contain the characters, ' ' (space), '/', '"'. '\'' (single quote), '@', ',', '=', '*', and all other non-alphanumeric characters within.

The function prints a warning on error.

Parameters
sfile name to check
Returns
1 success
-1 failure

Definition at line 34 of file legal_name.c.

Referenced by G_make_mapset().