1: #define PETSC_DLL 3: #include petsc.h 4: #include petscsys.h 5: #if defined(PETSC_HAVE_PWD_H) 6: #include <pwd.h> 7: #endif 8: #include <ctype.h> 9: #include <sys/types.h> 10: #include <sys/stat.h> 11: #if defined(PETSC_HAVE_UNISTD_H) 12: #include <unistd.h> 13: #endif 14: #if defined(PETSC_HAVE_STDLIB_H) 15: #include <stdlib.h> 16: #endif 17: #if defined(PETSC_HAVE_SYS_UTSNAME_H) 18: #include <sys/utsname.h> 19: #endif 20: #if defined(PETSC_HAVE_SYS_SYSTEMINFO_H) 21: #include <sys/systeminfo.h> 22: #endif 23: #include "petscfix.h" 27: /*@C 28: PetscGetRelativePath - Given a filename, returns the relative path (removes 29: all directory specifiers). 31: Not Collective 33: Input parameters: 34: + fullpath - full pathname 35: . path - pointer to buffer to hold relative pathname 36: - flen - size of path 38: Level: developer 40: Concepts: relative path 41: Concepts: path^relative 43: .seealso: PetscGetFullPath() 44: @*/ 45: PetscErrorCode PetscGetRelativePath(const char fullpath[],char path[],size_t flen) 46: { 47: char *p; 51: /* Find string after last / or entire string if no / */ 52: PetscStrrchr(fullpath,'/',&p); 53: PetscStrncpy(path,p,flen); 54: return(0); 55: }