libgphoto2 photo camera library (libgphoto2) API: libgphoto2_port/libgphoto2_port/gphoto2-port-portability.c File Reference

libgphoto2 photo camera library (libgphoto2) API 2.5.32

Loading...
Searching...
No Matches
gphoto2-port-portability.c File Reference
`#include "config.h"`
`#include <stdio.h>`
`#include <gphoto2/gphoto2-port.h>`
`#include <gphoto2/gphoto2-port-result.h>`
`#include <gphoto2/gphoto2-port-portability.h>`
Include dependency graph for gphoto2-port-portability.c:

## Functions
int | gp_system_mkdir (const char *dirname)
| mkdir UNIX functionality
int | gp_system_rmdir (const char *dirname)
| rmdir UNIX functionality
gp_system_dir | gp_system_opendir (const char *dirname)
| opendir UNIX functionality
gp_system_dirent | gp_system_readdir (gp_system_dir d)
| readdir UNIX functionality
const char * | gp_system_filename (gp_system_dirent de)
| retrieve UNIX filename out of a directory entry
int | gp_system_closedir (gp_system_dir dir)
| closedir UNIX functionality
int | gp_system_is_file (const char *filename)
| check if passed filename is a file
int | gp_system_is_dir (const char *dirname)
| check if passed filename is a directory

## Detailed Description

Author
  Copyright 2001 Lutz Mueller lutz@.nosp@m.user.nosp@m.s.sf..nosp@m.net
  Copyright 1999 Scott Fritzinger scott.nosp@m.f@un.nosp@m.r.edu

License
  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

This file contains various portability functions that make non UNIX (Windows) ports easier.

## Function Documentation

## ◆ gp_system_closedir()

int gp_system_closedir | ( | gp_system_dir | dir | ) |

closedir UNIX functionality

Parameters

  dir | directory to close

Closes a directory after readdir operations.

Returns
  a gphoto error code

References GP_OK.

## ◆ gp_system_filename()

const char * gp_system_filename | ( | gp_system_dirent | de | ) |

retrieve UNIX filename out of a directory entry

Parameters

  de | directory entry as returned from gp_system_readdir()

Extracts a filename out of the passed directory entry.

Returns
  the filename of the directory entry

## ◆ gp_system_is_dir()

int gp_system_is_dir | ( | const char * | dirname | ) |

check if passed filename is a directory

Parameters

  dirname | file name to check

Checks whether the passed in dirname is a directory and returns this as boolean.

Returns
  boolean flag whether passed filename is a directory.

## ◆ gp_system_is_file()

int gp_system_is_file | ( | const char * | filename | ) |

check if passed filename is a file

Parameters

  filename | file name to check

Checks whether the passed in filename is a file and returns this as boolean.

Returns
  boolean flag whether passed filename is a file.

## ◆ gp_system_mkdir()

int gp_system_mkdir | ( | const char * | dirname | ) |

mkdir UNIX functionality

Parameters

  dirname | directory to create

Creates a new directory.

Returns
  a gphoto error code

References GP_ERROR, and GP_OK.

## ◆ gp_system_opendir()

gp_system_dir gp_system_opendir | ( | const char * | dirname | ) |

opendir UNIX functionality

Parameters

  dirname | directory to open

Opens a directory for readdir and later closedir operations, to enumerate its contents.

Returns
  a directory handle for use in gp_system_readdir() and gp_system_closedir()

## ◆ gp_system_readdir()

gp_system_dirent gp_system_readdir | ( | gp_system_dir | d | ) |

readdir UNIX functionality

Parameters

  d | directory to enumerate

Reads one directory entry from the specified directory handle as returned from gp_system_opendir(). Use gp_system_filename() to extract the filename from the returned value.

Returns
  a new gp_system_dirent or NULL

## ◆ gp_system_rmdir()

int gp_system_rmdir | ( | const char * | dirname | ) |

rmdir UNIX functionality

Parameters

  dirname | directory to remove

Removes a empty directory.

Returns
  a gphoto error code

References GP_ERROR, and GP_OK.