1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
fix various missing prototype warnings
--- a/e2tools.h
+++ b/e2tools.h
@@ -63,38 +63,33 @@
#define E2T_FORCE 1
#define E2T_DO_MV 2
-#ifndef COPY_C
+/* copy.c */
extern long copy(int argc, char *argv[]);
extern int my_strcmp(const void *n1, const void *n2);
-#endif
-#ifdef LN_C
+/* ln.c */
extern long do_ln(int argc, char *argv[]);
extern long create_hard_link(ext2_filsys fs, ext2_ino_t cwd, ext2_ino_t
new_file_ino, char *newfile, int ln_flags);
-#endif
-#ifndef LS_C
+/* ls.c */
extern long do_list_dir(int argc, char *argv[]);
-#endif
-#ifndef MKDIR_C
+/* mkdir.c */
extern long e2mkdir(int argc, char *argv[]);
extern long create_dir(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd,
char *dirname, struct stat *def_stat);
-#endif
+extern long change_cwd(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd,
+ char *dirname);
-#ifdef MV_C
+/* mv.c */
extern long do_mv(int argc, char *argv[]);
extern long get_file_parts(ext2_filsys fs, ext2_ino_t root, char *pathname,
ext2_ino_t *dir_ino, char **dir_name,
char **base_name);
-#endif
-
-
-#ifndef READ_C
+/* read.c */
extern long get_file(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
char *infile, char *outfile, int keep);
extern long retrieve_data(ext2_filsys fs, ext2_ino_t src, int dest_fd,
@@ -102,17 +97,14 @@ extern long retrieve_data(ext2_filsys fs, ext2_ino_t src, int dest_fd,
ext2_off_t *ret_pos);
extern long read_to_eof(ext2_file_t infile, int dest_fd, ext2_off_t offset,
ext2_off_t *ret_pos);
-#endif
-#ifndef RM_C
+/* rm.c */
extern long e2rm(int argc, char *argv[]);
-#endif
-#ifndef TAIL_C
+/* tail.c */
extern long do_tail(int argc, char *argv[]);
-#endif
-#ifndef UTIL_C
+/* util.c */
extern mode_t ext2_mode_xlate(__u16 lmode);
extern __u16 host_mode_xlate(mode_t hmode);
extern long open_filesystem(char *name, ext2_filsys *fs, ext2_ino_t *root, int
@@ -125,13 +117,14 @@ extern long rm_file(ext2_filsys fs, ext2_ino_t cwd, char *outfile, ext2_ino_t
delfile);
extern long delete_file(ext2_filsys fs, ext2_ino_t inode);
extern void init_stat_buf(struct stat *buf);
-#endif
+#include <regex.h>
+extern regex_t *make_regexp(char *shell);
+extern int is_file_regexp(char *ptr);
-#ifndef WRITE_C
+/* write.c */
extern long
put_file(ext2_filsys fs, ext2_ino_t cwd, char *infile, char *outfile,
ext2_ino_t *outfile_ino, int keep, struct stat *def_stat);
-#endif
#endif
--- a/elist.c
+++ b/elist.c
@@ -41,12 +41,9 @@
/* Feature Test Switches */
/* Headers */
#include <memory.h>
+#include <stdlib.h>
#include "elist.h"
-#ifndef NULL
-#define NULL ((void *)0)
-#endif
-
elist_t *
elist_new()
{
--- a/ls.c
+++ b/ls.c
@@ -703,7 +703,7 @@ void short_disp(ls_file_t *info, int *col, int options)
char lbr, rbr;
char tmp[300];
int thislen;
- static max_col_size = 0;
+ static int max_col_size = 0;
if (max_col_size == 0)
{
--- a/mkdir.c
+++ b/mkdir.c
@@ -357,7 +357,7 @@ create_dir(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd,
def_stat)))
{
fprintf(stderr,
- "create_dir: error creating directory %s/%s:%d\n",
+ "create_dir: error creating directory %s/%s:%ld\n",
dirname, dname, retval);
ext2fs_free_mem((void **) &buf);
return(retval);
@@ -415,7 +415,7 @@ create_dir(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd,
if ((retval = create_subdir(fs, root, cwd, dirname, def_stat)))
{
fprintf(stderr,
- "create_dir: error creating directory %s:%d\n",
+ "create_dir: error creating directory %s:%ld\n",
dirname, retval);
return(retval);
}
--- a/progress.c
+++ b/progress.c
@@ -26,6 +26,8 @@
/* Feature Test Switches */
/* System Headers */
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -154,7 +156,7 @@ void update_progress(unsigned long num_bytes)
if (prog_sbuf != NULL && prog_time != tv.tv_sec)
{
prog_time = tv.tv_sec;
- fprintf(stderr, "%s %10d / %10d\r", prog_file, num_bytes,
+ fprintf(stderr, "%s %10lu / %10jd\r", prog_file, num_bytes,
prog_sbuf->st_size);
fflush(stderr);
}
--- a/rm.c
+++ b/rm.c
@@ -244,7 +244,6 @@ e2rm(int argc, char *argv[])
retval = ext2fs_dir_iterate2(gbl_fs, curr_ino,
DIRENT_FLAG_INCLUDE_EMPTY, 0,
rm_dir_proc,
- (void *)
(verbose) ? &verbose : NULL);
}
else
|