GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
rename.c File Reference

GIS Library - Rename file functions. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <grass/gis.h>
Include dependency graph for rename.c:

Go to the source code of this file.

Functions

int G_rename_file (const char *oldname, const char *newname)
 Rename a file or a directory in the filesystem. More...
 
int G_rename (const char *element, const char *oldname, const char *newname)
 Rename a database file. More...
 

Detailed Description

GIS Library - Rename file functions.

(C) 2001-2015 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 rename.c.

Function Documentation

◆ G_rename()

int G_rename ( const char *  element,
const char *  oldname,
const char *  newname 
)

Rename a database file.

The file or directory oldname under the database element directory in the current mapset is renamed to newname.

Bug:
This routine does not check to see if the newname name is a valid database file name.
Parameters
elementelement name
oldnamecurrent name
newnamenew name
Returns
0 if oldname does not exist
1 if successful
-1 on error

Definition at line 70 of file rename.c.

References G_file_name(), G_mapset(), G_name_is_fully_qualified(), G_rename_file(), GMAPSET_MAX, GNAME_MAX, and GPATH_MAX.

Referenced by M_do_rename().

◆ G_rename_file()

int G_rename_file ( const char *  oldname,
const char *  newname 
)

Rename a file or a directory in the filesystem.

The file or directory oldname is renamed to newname.

Parameters
oldnamecurrent name
newnamenew name
Returns
0 if successful
-1 on error

Definition at line 32 of file rename.c.

References G_copy_file().

Referenced by G_rename(), and PS_Graph_close().