1 /* inv.h: file inventories 2 * 3 **************************************************************** 4 * Copyright (C) 2002, 2003 Tom Lord 5 * 6 * See the file "COPYING" for further information about 7 * the copyright and warranty status of this work. 8 */ 9 10 #ifndef INCLUDE__FILE_UTILS__INV_H 11 #define INCLUDE__FILE_UTILS__INV_H 12 13 #include "hackerlab/os/sys/stat.h" 14 #include "hackerlab/machine/types.h" 15 #include "hackerlab/rx-posix/regex.h" 16 #include "tla/libawk/relational.h" 17 #include "tla/libarch/inv-ids.h" 18 19 20 21 struct arch_inventory_regexps 22 { 23 regex_t excludes_pattern; 24 regex_t junk_pattern; 25 regex_t backup_pattern; 26 regex_t precious_pattern; 27 regex_t unrecognized_pattern; 28 regex_t source_pattern; 29 }; 30 31 struct arch_inventory_options 32 { 33 t_uint categories; /* set of enum inv_category */ 34 35 int want_ids; /* go to the expense of computing file ids? */ 36 int treat_unrecognized_source_as_source; /* report source-named files that are missing ids? */ 37 enum arch_id_tagging_method method; /* id tagging method */ 38 enum arch_inventory_category untagged_source_category; /* what are untagged files matching source? */ 39 40 int nested; /* search in nested trees? */ 41 int include_excluded; /* ignore the `excludes_pattern'? */ 42 int override_method; /* override tree's id tagging methods? */ 43 44 struct arch_inventory_regexps regexps; 45 }; 46 47 typedef void (*inv_callback) (const t_uchar * path, 48 struct stat * stat_buf, 49 enum arch_inventory_category category, 50 const t_uchar * id, 51 int has_source_name, 52 void * closure, 53 int escape_classes); 54 55 56 57 /* automatically generated __STDC__ prototypes */ 58 extern rel_table arch_source_inventory (const t_uchar * tree_root, 59 int include_ctl, 60 int include_precious, 61 int include_nested); 62 extern rel_table arch_source_files_inventory (const t_uchar * tree_root, 63 int include_ctl, 64 int include_precious); 65 extern rel_table arch_source_files_file_list(const t_uchar * tree_root, 66 int include_ctl, 67 int include_precious); 68 extern t_uchar * arch_default_naming_conventions_regexp (enum arch_inventory_category cat); 69 extern t_uchar * arch_ancient_default_naming_conventions_regexp (enum arch_inventory_category cat); 70 extern t_uchar * arch_null_default_naming_conventions_regexp (enum arch_inventory_category cat); 71 extern void arch_get_inventory_naming_conventions (struct arch_inventory_options * options, 72 const char * tree_root); 73 extern void arch_free_inventory_naming_conventions (struct arch_inventory_options * options); 74 extern void arch_inventory_traversal (struct arch_inventory_options * options, 75 const t_uchar * root, 76 inv_callback callback, 77 void * closure, 78 int escape_classes); 79 extern int arch_is_control_file (const char * rel_file, const char * filename); 80 81 extern t_uchar * normal_from_path (t_uchar const *path); 82 extern t_uchar * prefix_from_path (t_uchar const *path); 83 84 #endif /* INCLUDE__FILE_UTILS__INV_H */ 85 86 87 /* tag: Tom Lord Wed May 14 11:10:28 2003 (invent.h) 88 */ 89