libgphoto2 photo camera library (libgphoto2) API  2.5.13
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>

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@users.sf.net>
Copyright 1999 Scott Fritzinger <scottf@unr.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

int gp_system_closedir ( gp_system_dir  dir)

closedir UNIX functionality

Parameters:
dirdirectory to close

Closes a directory after readdir operations.

Returns:
a gphoto error code

References GP_OK.

const char* gp_system_filename ( gp_system_dirent  de)

retrieve UNIX filename out of a directory entry

Parameters:
dedirectory entry as returned from gp_system_readdir()

Extracts a filename out of the passed directory entry.

Returns:
the filename of the directory entry
int gp_system_is_dir ( const char *  dirname)

check if passed filename is a directory

Parameters:
dirnamefile 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.
int gp_system_is_file ( const char *  filename)

check if passed filename is a file

Parameters:
filenamefile 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.
int gp_system_mkdir ( const char *  dirname)

mkdir UNIX functionality

Parameters:
dirnamedirectory to create

Creates a new directory.

Returns:
a gphoto error code

References GP_ERROR, and GP_OK.

gp_system_dir gp_system_opendir ( const char *  dirname)

opendir UNIX functionality

Parameters:
dirnamedirectory 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_dirent gp_system_readdir ( gp_system_dir  d)

readdir UNIX functionality

Parameters:
ddirectory 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
int gp_system_rmdir ( const char *  dirname)

rmdir UNIX functionality

Parameters:
dirnamedirectory to remove

Removes a empty directory.

Returns:
a gphoto error code

References GP_ERROR, and GP_OK.