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