home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / MUI / MUIBuilder22.lha / MUIBuilder / MB / Developer / C / Sources_GenCodeC / file.c next >
Encoding:
C/C++ Source or Header  |  1994-07-10  |  771 b   |  46 lines

  1. #include <string.h>
  2. #include <clib/dos_protos.h>
  3.  
  4. void extract_dir( char *filename )
  5. {
  6.     char *aux;
  7.  
  8.     aux = strrchr( filename, '/' );
  9.     if (!aux) aux = strrchr( filename, ':' );
  10.     if (aux)
  11.     {
  12.         aux++;
  13.         *aux = '\0';
  14.     }
  15.     else filename[0] = '\0';
  16. }
  17.  
  18. void extract_file( char * path, char * filename )
  19. {
  20.     strcpy( filename, FilePart( path ) );
  21. }
  22.  
  23. void add_extend( char *filename, char * extend )
  24. {
  25.     char *aux;
  26.  
  27.     aux = strrchr( filename, '.' );
  28.     if (!aux) strcat( filename, extend );
  29.     else if (strcmp( aux, extend )!=0) strcat( filename, extend );
  30. }
  31.  
  32. void remove_extend( char *filename )
  33. {
  34.     char *aux;
  35.  
  36.     aux = strrchr( filename, '.' );
  37.     if (aux) *aux='\0';
  38. }
  39.  
  40. void change_extend( char *filename, char * extend )
  41. {
  42.     remove_extend( filename );
  43.     add_extend( filename, extend );
  44. }
  45.         
  46.