gphoto2-port-portability.h File Reference

#include <time.h>
#include <strings.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>

Include dependency graph for gphoto2-port-portability.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define _XOPEN_SOURCE   500
#define _POSIX_C_SOURCE   199309
#define GP_SYSTEM_SLEEP(_ms)
#define gp_system_dir   DIR *
#define gp_system_dirent   struct dirent *
#define gp_system_dir_delim   '/'

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


Define Documentation

#define gp_system_dir   DIR *

A system directory handle

#define gp_system_dir_delim   '/'

The directory delimiter character on this platform.

#define gp_system_dirent   struct dirent *

A system directory entry

#define GP_SYSTEM_SLEEP ( _ms   ) 

Value:

do {                                                  \
    const struct timespec req = {                     \
      0,                                              \
      1000*1000*((long)(_ms))                         \
    };                                                \
    nanosleep(&req, NULL);                            \
  } while (0)
Sleep passed amount of milliseconds.


Function Documentation

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

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

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.

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.

int gp_system_mkdir ( const char *  dirname  ) 

mkdir UNIX functionality

Parameters:
dirname directory to create
Creates a new directory.

Returns:
a gphoto error code

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_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

int gp_system_rmdir ( const char *  dirname  ) 

rmdir UNIX functionality

Parameters:
dirname directory to remove
Removes a empty directory.

Returns:
a gphoto error code


Generated on Sun Jul 22 19:29:39 2007 for libgphoto2 photo camera library (libgphoto2) by  doxygen 1.5.0