/* $Header: /CVSROOT/tinolib/old/filetool.h,v 1.3 2005/04/25 23:07:01 tino Exp $ * * Additionally file helpers * * $Log: filetool.h,v $ * Revision 1.3 2005/04/25 23:07:01 tino * some new routines * * Revision 1.2 2005/04/24 13:44:11 tino * tino_file_notdir * * Revision 1.1 2005/04/24 12:55:38 tino * started GAT support and filetool added * */ #ifndef tino_INC_filetool_h #define tino_INC_filetool_h #include "alloc.h" #include "str.h" /* well, be prepared for windows */ #define DRIVE_SEP_CHAR 0 /* untested */ #define PATH_SEP_CHAR '/' /* Glue some path and name together. * If buffer is NULL it is allocated. * * This is intelligent: * If name is a full path, path is ignored. * Else only parts of path are taken for name. * * With windows it must become magic: * The drive prefix must be choosen from path and name. */ static char * tino_file_glue_path(char *buf, size_t max, const char *path, const char *name) { #if DRIVE_SEP_CHAR int drive; #endif int offset; size_t len; if (!buf) { if (maxoffset) max = offset+1; return tino_strxcpy(buf, name, max); } static char * tino_file_filename(char *buf, size_t max, const char *name) { int offset; offset = tino_file_dirfileoffset(name, 1); if (!buf) { if (max