8 void file_build1( PATHNAME * f, string * file )
12 printf("build file: ");
14 printf( "root = '%.*s' ", f->f_root.len, f->f_root.ptr );
16 printf( "dir = '%.*s' ", f->f_dir.len, f->f_dir.ptr );
18 printf( "base = '%.*s' ", f->f_base.len, f->f_base.ptr );
22 /* Start with the grist. If the current grist isn't */
23 /* surrounded by <>'s, add them. */
27 if ( f->f_grist.ptr[0] != '<' )
28 string_push_back( file, '<' );
30 file, f->f_grist.ptr, f->f_grist.ptr + f->f_grist.len );
31 if ( file->value[file->size - 1] != '>' )
32 string_push_back( file, '>' );
36 static struct hash * filecache_hash = 0;
37 static file_info_t filecache_finfo;
39 file_info_t * file_info(char * filename)
41 file_info_t *finfo = &filecache_finfo;
43 if ( !filecache_hash )
44 filecache_hash = hashinit( sizeof( file_info_t ), "file_info" );
46 finfo->name = filename;
52 if ( hashenter( filecache_hash, (HASHDATA**)&finfo ) )
54 /* printf( "file_info: %s\n", filename ); */
55 finfo->name = newstr( finfo->name );
61 static LIST * files_to_remove = L0;
63 static void remove_files_atexit(void)
65 /* we do pop front in case this exit function is called
67 while ( files_to_remove )
69 remove( files_to_remove->string );
70 files_to_remove = list_pop_front( files_to_remove );
76 remove_files_atexit();
77 hashdone( filecache_hash );
80 void file_remove_atexit( const char * path )
82 files_to_remove = list_new( files_to_remove, newstr((char*)path) );