Loading...
Searching...
No Matches
paths.c File Reference
`#include <grass/config.h>`
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <unistd.h>`
`#include <pwd.h>`
`#include <grass/gis.h>`
`#include <grass/glocale.h>`
Include dependency graph for paths.c:

Go to the source code of this file.

## Functions

int | G_mkdir (const char *path)
| Creates a new directory.
int | G_is_dirsep (char c)
| Checks if a specified character is a valid directory separator character on the host system.
int | G_is_absolute_path (const char *path)
| Checks if a specified path looks like an absolute path on the host system.
char * | G_convert_dirseps_to_host (char *path)
| Converts directory separator characters in a string to the native host separator character (/ on Unix, \ on Windows).
char * | G_convert_dirseps_from_host (char *path)
| Converts directory separator characters in a string from the native host character to the GRASS separator character (/).
int | G_stat (const char *file_name, struct stat *buf)
| Get file status.
int | G_lstat (const char *file_name, struct stat *buf)
| Get file status.
int | G_owner (const char *path)
| Get owner id of path.

## Function Documentation

## G_convert_dirseps_from_host()

char * G_convert_dirseps_from_host | ( | char * | path | ) |

Converts directory separator characters in a string from the native host character to the GRASS separator character (/).

Parameters

  path | String to be converted

Returns
  Pointer to the string

Definition at line 105 of file paths.c.

## G_convert_dirseps_to_host()

char * G_convert_dirseps_to_host | ( | char * | path | ) |

Converts directory separator characters in a string to the native host separator character (/ on Unix, \ on Windows).

Parameters

  path | String to be converted

Returns
  Pointer to the string

Definition at line 83 of file paths.c.

## G_is_absolute_path()

int G_is_absolute_path | ( | const char * | path | ) |

Checks if a specified path looks like an absolute path on the host system.

Parameters

  path | String containing path to check

Returns
  1 if path looks like an absolute path, 0 if not

Definition at line 62 of file paths.c.

References G_is_dirsep().

Referenced by COM_Set_font().

## G_is_dirsep()

int G_is_dirsep | ( | char | c | ) |

Checks if a specified character is a valid directory separator character on the host system.

Parameters

  c | Character to check

Returns
  1 if c is a directory separator character, 0 if not

Definition at line 45 of file paths.c.

Referenced by G_is_absolute_path(), G_parser(), and G_set_program_name().

## G_lstat()

int G_lstat | ( | const char * | file_name,
|  | struct stat * | buf )

Get file status.

Returns information about the specified file.

Parameters

  file_name | file name, in the case of a symbolic link, the link itself is stat-ed, not the file that it refers to
  buf | pointer to structure filled with file information

Returns
  Return value from system lstat function

Definition at line 145 of file paths.c.

Referenced by G_recursive_copy(), and G_recursive_remove().

## G_mkdir()

int G_mkdir | ( | const char * | path | ) |

Creates a new directory.

Creates a new directory with permissions 0777 (on Unix) or default permissions(?) on Windows.

Parameters

  path | String containing path of directory to be created

Returns
  Return value from system mkdir() function

Definition at line 27 of file paths.c.

Referenced by G_config_path(), G_make_location(), G_make_mapset(), and G_recursive_copy().

## G_owner()

int G_owner | ( | const char * | path | ) |

Get owner id of path.

Returns information about the specified file.

Parameters

  path | path to check

Returns
  Return owner id

Definition at line 164 of file paths.c.

References G_fatal_error(), G_stat(), NULL, and TRUE.

## G_stat()

int G_stat | ( | const char * | file_name,
|  | struct stat * | buf )

Get file status.

Returns information about the specified file.

Parameters

  file_name | file name
  buf | pointer to structure filled with file information

Returns
  Return value from system lstat function

Definition at line 128 of file paths.c.

Referenced by G_get_available_mapsets(), G_mapset_permissions(), G_mapset_permissions2(), and G_owner().