Go to the documentation of this file.00001
00002
00003 #undef _XOPEN_SOURCE
00004 #define _XOPEN_SOURCE 1 // necessary on alpha and on SGI since otherwise
00005 #undef _XOPEN_SOURCE_EXTENDED
00006 #define _XOPEN_SOURCE_EXTENDED 1 // usleep is not declared
00007 extern "C" {
00008 #include <unistd.h>
00009 #include <sys/types.h>
00010 #include <sys/stat.h>
00011 #include <stdlib.h>
00012 #include <string.h>
00013 }
00014 #include <vxl_config.h>
00015
00016 char *
00017 vpl_getcwd( char *buf, vcl_size_t buf_size )
00018 {
00019 return getcwd( buf, buf_size );
00020 }
00021
00022 int
00023 vpl_mkdir( const char *dir, unsigned short mode )
00024 {
00025 return mkdir( dir, (mode_t)mode );
00026 }
00027
00028 int
00029 vpl_rmdir( const char *dir )
00030 {
00031 return rmdir( dir );
00032 }
00033
00034 int
00035 vpl_chdir( const char *dir )
00036 {
00037 return chdir( dir );
00038 }
00039
00040 int
00041 vpl_unlink( const char *file )
00042 {
00043 return unlink( file );
00044 }
00045
00046 unsigned int
00047 vpl_sleep( unsigned int t )
00048 {
00049 return sleep( t );
00050 }
00051
00052 int
00053 vpl_usleep( unsigned int t )
00054 {
00055
00056 if (t > 1000000) sleep( t/1000000 ); t %= 1000000;
00057 #if VXL_UNISTD_HAS_USLEEP
00058 #if VXL_UNISTD_USLEEP_IS_VOID
00059 usleep( t ); return 0;
00060 #else
00061 return usleep( t );
00062 #endif
00063 #else
00064 return 0;
00065 #endif
00066 }
00067
00068
00069
00070 unsigned
00071 vpl_getpid( )
00072 {
00073 #if VXL_UNISTD_HAS_GETPID
00074 return getpid();
00075 #else
00076 return 0;
00077 #endif
00078 }
00079
00080
00081 int vpl_putenv ( const char * envvar )
00082 {
00083 char * storage_space = strdup(envvar);
00084
00085
00086
00087
00088
00089
00090 return putenv(storage_space);
00091 }