1 | /* |
---|
2 | * $Id: directories.h,v 1.16 1999-01-22 23:08:57 ghudson Exp $ |
---|
3 | * |
---|
4 | * This file is part of a package including delete, undelete, |
---|
5 | * lsdel, expunge and purge. The software suite is meant as a |
---|
6 | * replacement for rm which allows for file recovery. |
---|
7 | * |
---|
8 | * Copyright (c) 1989 by the Massachusetts Institute of Technology. |
---|
9 | * For copying and distribution information, see the file "mit-copying.h." |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef __DELETE_DIRECTORIES_H__ |
---|
13 | #define __DELETE_DIRECTORIES_H__ |
---|
14 | |
---|
15 | #include "mit-copying.h" |
---|
16 | #include <dirent.h> |
---|
17 | |
---|
18 | typedef short Boolean; |
---|
19 | #define True (Boolean) 1 |
---|
20 | #define False (Boolean) 0 |
---|
21 | |
---|
22 | char *bytes_to_friendly(off_t); |
---|
23 | |
---|
24 | #define specs_to_space(x) ((x).st_size) |
---|
25 | #define space_to_friendly(x) bytes_to_friendly((x)) |
---|
26 | #define specs_to_friendly(x) space_to_friendly((x).st_size) |
---|
27 | |
---|
28 | #define FOLLOW_LINKS 1 |
---|
29 | #define DONT_FOLLOW_LINKS 0 |
---|
30 | |
---|
31 | #define DIR_MATCH 1 |
---|
32 | #define DIR_NO_MATCH 0 |
---|
33 | |
---|
34 | typedef struct mystat { |
---|
35 | dev_t st_dev; |
---|
36 | ino_t st_ino; |
---|
37 | unsigned short st_mode; |
---|
38 | off_t st_size; |
---|
39 | time_t st_ctim; |
---|
40 | long st_blocks; |
---|
41 | } mystat; |
---|
42 | |
---|
43 | |
---|
44 | typedef struct filrec { |
---|
45 | char name[MAXNAMLEN]; |
---|
46 | struct filrec *previous; |
---|
47 | struct filrec *parent; |
---|
48 | struct filrec *dirs; |
---|
49 | struct filrec *files; |
---|
50 | struct filrec *next; |
---|
51 | Boolean specified; |
---|
52 | Boolean freed; |
---|
53 | struct mystat specs; |
---|
54 | } filerec; |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | int add_directory_to_parent(); |
---|
59 | int add_file_to_parent(); |
---|
60 | int add_path_to_tree(); |
---|
61 | int find_child(); |
---|
62 | int change_path(); |
---|
63 | filerec *first_in_directory(); |
---|
64 | filerec *first_specified_in_directory(); |
---|
65 | filerec *get_cwd_tree(); |
---|
66 | int initialize_tree(void); |
---|
67 | filerec *get_root_tree(); |
---|
68 | filerec *next_directory(); |
---|
69 | filerec *next_in_directory(); |
---|
70 | filerec *next_leaf(); |
---|
71 | filerec *next_specified_directory(); |
---|
72 | filerec *next_specified_in_directory(); |
---|
73 | filerec *next_specified_leaf(); |
---|
74 | |
---|
75 | int get_leaf_path(filerec *leaf, char leaf_buf[]); |
---|
76 | int accumulate_names(); |
---|
77 | |
---|
78 | void free_leaf(); |
---|
79 | |
---|
80 | #endif /* ! __DELETE_DIRECTORIES_H__ */ |
---|