Go to the documentation of this file.
25 signed int len,lp,lPath,lNameOnly,lName,lSuffix,lExt,slashPos,dotPos,prot;
39 while((slashPos>=0)&&(name[slashPos]!= '/'))
42 dotPos=(slashPos>0?slashPos:0);
43 while((dotPos<len)&&(name[dotPos]!= '.'))
50 while((!found)&&(prot<slashPos-1))
52 found=((name[prot]== ':')&&(name[prot+1]== '/')&&(name[prot+2]== '/'));
68 memcpy(fn-> path,&(name[prot]),(slashPos-prot)* sizeof( char));
82 lPath=lp+(slashPos-prot)+2;
84 Error( "Empty file path");
86 memcpy(fn-> path,p,lp* sizeof( char));
88 if ((slashPos-prot)>=0)
89 memcpy(&(fn-> path[lp+1]),&(name[prot]),(slashPos-prot)* sizeof( char));
93 if (fn-> path[lPath-2]!= '/')
95 fn-> path[lPath-1]= '/';
105 lSuffix=strlen(suffix);
106 lNameOnly=dotPos-slashPos-1;
107 lName=lNameOnly+lSuffix;
109 Error( "Empty file name");
111 memcpy(fn-> name,&(name[slashPos+1]),lNameOnly* sizeof( char));
113 memcpy(&(fn-> name[lNameOnly]),suffix,lSuffix* sizeof( char));
133 memcpy(fn-> ext,e,lExt* sizeof( char));
209 if (fn-> ext!=NULL) free(fn-> ext);
Definition of the boolean type.
char * GetFileName(Tfilename *fn) Gets the file name.
#define NEW(_var, _n, _type) Allocates memory space.
char * GetFileBaseName(Tfilename *fn) Gets the file base name (paht+name) .
Data structure to hold the information about the name of a file.
Definition of the Tfilename type and the associated functions.
char * GetFilePath(Tfilename *fn) Gets the file path.
void Error(const char *s) General error function.
Error and warning functions.
void DeleteFileName(Tfilename *fn) Destructor.
Definitions of constants and macros used in several parts of the cuik library.
void CreateFileName(char *path, char *name, char *suffix, char *ext, Tfilename *fn) Constructor.
char * GetFileFullName(Tfilename *fn) Gets the file full name (paht+name+extension).
void LinkFileNmeWithExtension(Tfilename *fn1, char *ext, Tfilename *fn2) Creates a link to a given filename.
char * GetFileExtension(Tfilename *fn) Gets the file extension.
|
Follow us!