summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am22
-rw-r--r--Makefile.in22
-rw-r--r--copy.c10
-rw-r--r--copy.h8
-rw-r--r--e2tools.h86
-rw-r--r--ln.h10
-rw-r--r--ls.c5
-rw-r--r--ls.h7
-rw-r--r--mkdir.h11
-rw-r--r--mv.h10
-rw-r--r--progress.h6
-rw-r--r--read.c5
-rw-r--r--read.h13
-rw-r--r--rm.c12
-rw-r--r--rm.h7
-rw-r--r--tail.h7
-rw-r--r--util.c6
-rw-r--r--util.h20
-rw-r--r--write.h9
19 files changed, 156 insertions, 120 deletions
diff --git a/Makefile.am b/Makefile.am
index f297ff2..f99a099 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,19 +4,19 @@ INCLUDES = -I@includedir@
$(COMPILE) -c $<
bin_PROGRAMS = e2cp
-e2cp_SOURCES = copy.c \
+e2cp_SOURCES = copy.c copy.h \
e2tools.c e2tools.h \
elist.c elist.h \
- ln.c \
- ls.c \
- mkdir.c \
- mv.c \
- progress.c \
- read.c \
- rm.c \
- tail.c \
- util.c \
- write.c
+ ln.c ln.h \
+ ls.c ls.h \
+ mkdir.c mkdir.h \
+ mv.c mv.h \
+ progress.c progress.h \
+ read.c read.h \
+ rm.c rm.h \
+ tail.c tail.h \
+ util.c util.h \
+ write.c write.h
e2cp_LDADD = -L@libdir@ -lext2fs -lcom_err
EXTRA_DIST = README TODO e2tools.spec
diff --git a/Makefile.in b/Makefile.in
index d9481b0..54f85f4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -163,19 +163,19 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INCLUDES = -I@includedir@
-e2cp_SOURCES = copy.c \
+e2cp_SOURCES = copy.c copy.h \
e2tools.c e2tools.h \
elist.c elist.h \
- ln.c \
- ls.c \
- mkdir.c \
- mv.c \
- progress.c \
- read.c \
- rm.c \
- tail.c \
- util.c \
- write.c
+ ln.c ln.h \
+ ls.c ls.h \
+ mkdir.c mkdir.h \
+ mv.c mv.h \
+ progress.c progress.h \
+ read.c read.h \
+ rm.c rm.h \
+ tail.c tail.h \
+ util.c util.h \
+ write.c write.h
e2cp_LDADD = -L@libdir@ -lext2fs -lcom_err
EXTRA_DIST = README TODO e2tools.spec
diff --git a/copy.c b/copy.c
index afeeb50..59bffda 100644
--- a/copy.c
+++ b/copy.c
@@ -7,10 +7,6 @@
*
*/
-#ifndef COPY_C
-#define COPY_C
-#endif
-
/* Description */
/*
* This module contains functions used to copy files to and from an ext2fs
@@ -106,15 +102,9 @@ typedef struct
elist_t *link_list = NULL;
static char cur_out_dir[BUF_SIZE];
-/* External Prototypes */
-
-extern void init_progress(char *file, struct stat *sbuf);
-
/* Local Prototypes */
long
-copy(int argc, char *argv[]);
-long
open_destination(char **dest_dir, char **cur_filesys, ext2_filsys *fs,
ext2_ino_t *root, ext2_ino_t *cwd, char *outfile,
int *absolute, FS_CAT_T *dst_cat, int *allow_non_dir,
diff --git a/copy.h b/copy.h
new file mode 100644
index 0000000..b4c3bda
--- /dev/null
+++ b/copy.h
@@ -0,0 +1,8 @@
+#ifndef E2TOOLS_COPY_H
+#define E2TOOLS_COPY_H
+
+/* from copy.c */
+extern long copy(int argc, char *argv[]);
+extern int my_strcmp(const void *n1, const void *n2);
+
+#endif /* !E2TOOLS_COPY_H */
diff --git a/e2tools.h b/e2tools.h
index d270e16..19ec030 100644
--- a/e2tools.h
+++ b/e2tools.h
@@ -64,74 +64,22 @@ extern int optreset; /* defined by BSD, but not others */
#define E2T_FORCE 1
#define E2T_DO_MV 2
-/* from copy.c */
-extern long copy(int argc, char *argv[]);
-extern int my_strcmp(const void *n1, const void *n2);
-
-
-/* from 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);
-
-
-/* from ls.c */
-extern long do_list_dir(int argc, char *argv[]);
-
-
-/* from 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);
-extern long change_cwd(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd,
- char *dirname);
-
-
-/* from 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);
-
-
-/* from 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,
- char *dest_name, int keep, ext2_off_t offset,
- 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);
-
-
-/* from rm.c */
-extern long e2rm(int argc, char *argv[]);
+#include "copy.h"
+#include "util.h"
+#include "write.h"
+#include "mkdir.h"
+#include "progress.h"
+#include "read.h"
+#include "ln.h"
+#include "mv.h"
+#include "rm.h"
+#include "tail.h"
+#include "ls.h"
+
+#if __GNUC__ >= 4
+# define UNUSED_PARM(foo) foo __attribute__((unused))
+#else
+# define UNUSED_PARM(foo) foo ## __UNUSED
#endif
-/* from tail.c */
-extern long do_tail(int argc, char *argv[]);
-
-
-/* from 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
- rw_mode);
-extern long read_inode(ext2_filsys fs, ext2_ino_t file, struct ext2_inode
- *inode);
-extern long write_inode(ext2_filsys fs, ext2_ino_t file, struct ext2_inode
- *inode);
-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);
-extern int is_file_regexp(char *ptr);
-extern regex_t *make_regexp(char *shell);
-
-/* from 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
diff --git a/ln.h b/ln.h
new file mode 100644
index 0000000..16f568c
--- /dev/null
+++ b/ln.h
@@ -0,0 +1,10 @@
+#ifndef E2TOOLS_LN_H
+#define E2TOOLS_LN_H
+
+/* from 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 /* !E2TOOLS_LN_H */
diff --git a/ls.c b/ls.c
index a742a93..35c9ee3 100644
--- a/ls.c
+++ b/ls.c
@@ -143,7 +143,8 @@ remove_ls_dups(elist_t *list);
*/
static int
list_dir_proc(ext2_ino_t dir, int entry, struct ext2_dir_entry *dirent,
- int offset, int blocksize, char *buf, void *private)
+ int UNUSED_PARM(offset), int UNUSED_PARM(blocksize),
+ char UNUSED_PARM(*buf), void *private)
{
char name[EXT2_NAME_LEN];
struct list_dir_struct *ls = (struct list_dir_struct *) private;
@@ -619,7 +620,7 @@ do_list_dir(int argc, char *argv[])
* 04/06/04 K.Sheffield Modified to show entries with an inode of 0
* as deleted.
*/
-void long_disp(ls_file_t *info, int *col, int options)
+void long_disp(ls_file_t *info, int UNUSED_PARM(*col), int options)
{
char lbr, rbr;
char datestr[80];
diff --git a/ls.h b/ls.h
new file mode 100644
index 0000000..75963c9
--- /dev/null
+++ b/ls.h
@@ -0,0 +1,7 @@
+#ifndef E2TOOLS_LS_H
+#define E2TOOLS_LS_H
+
+/* from ls.c */
+extern long do_list_dir(int argc, char *argv[]);
+
+#endif /* !E2TOOLS_LS_H */
diff --git a/mkdir.h b/mkdir.h
new file mode 100644
index 0000000..32a86f7
--- /dev/null
+++ b/mkdir.h
@@ -0,0 +1,11 @@
+#ifndef E2TOOLS_MKDIR_H
+#define E2TOOLS_MKDIR_H
+
+/* from 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);
+extern long change_cwd(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd,
+ char *dirname);
+
+#endif /* !E2TOOLS_MKDIR_H */
diff --git a/mv.h b/mv.h
new file mode 100644
index 0000000..4e09816
--- /dev/null
+++ b/mv.h
@@ -0,0 +1,10 @@
+#ifndef E2TOOLS_MV_H
+#define E2TOOLS_MV_H
+
+/* from 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 /* !E2TOOLS_MV_H */
diff --git a/progress.h b/progress.h
new file mode 100644
index 0000000..1978601
--- /dev/null
+++ b/progress.h
@@ -0,0 +1,6 @@
+#ifndef E2TOOLS_PROGRESS_H
+#define E2TOOLS_PROGRESS_H
+
+void init_progress(char *file, struct stat *sbuf);
+
+#endif /* !E2TOOLS_PROGRESS_H */
diff --git a/read.c b/read.c
index d745c8f..1d408f1 100644
--- a/read.c
+++ b/read.c
@@ -11,9 +11,6 @@
static char __attribute__ ((used)) copyright[] = "Copyright 2002 Keith W Sheffield";
-#ifndef READ_C
-#define READ_C
-#endif
/* Description */
/*
@@ -309,7 +306,7 @@ read_to_eof(ext2_file_t infile, int dest_fd, ext2_off_t offset,
while (bytes_read > 0 &&
bytes_read == (bytes_written = write(dest_fd, buf, bytes_read)));
- if (bytes_read)
+ if (bytes_read != 0)
{
perror("read_to_eof");
return(-1);
diff --git a/read.h b/read.h
new file mode 100644
index 0000000..bd55113
--- /dev/null
+++ b/read.h
@@ -0,0 +1,13 @@
+#ifndef E2TOOLS_READ_H
+#define E2TOOLS_READ_H
+
+/* from 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,
+ char *dest_name, int keep, ext2_off_t offset,
+ 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 /* !E2TOOLS_READ_H */
diff --git a/rm.c b/rm.c
index 4ccd047..eaa94f4 100644
--- a/rm.c
+++ b/rm.c
@@ -10,10 +10,6 @@
* as well as portions of the ext2fs library (C) 1993-1995 Theodore Ts'o
*/
-#ifndef RM_C
-#define RM_C
-#endif
-
/* Description */
/*
* This file contains function used to remove files in an ext2fs filesystem.
@@ -288,9 +284,9 @@ e2rm(int argc, char *argv[])
} /* end of e2rm */
-static int rm_dir_proc(ext2_ino_t dir, int entry,
- struct ext2_dir_entry *dirent, int offset,
- int blocksize, char *buf, void *verbose)
+static int rm_dir_proc(ext2_ino_t UNUSED_PARM(dir), int entry,
+ struct ext2_dir_entry *dirent, int UNUSED_PARM(offset),
+ int UNUSED_PARM(blocksize), char UNUSED_PARM(*buf), void *verbose)
{
char name[EXT2_NAME_LEN];
int thislen;
@@ -354,7 +350,7 @@ recursive_rm(ext2_ino_t dir, char *name, struct ext2_dir_entry *dirent,
static int
rm_regex_proc(ext2_ino_t dir, int entry, struct ext2_dir_entry *dirent,
- int offset, int blocksize, char *buf, void *arg)
+ int UNUSED_PARM(offset), int UNUSED_PARM(blocksize), char *UNUSED_PARM(buf), void *arg)
{
long retval;
char name[EXT2_NAME_LEN];
diff --git a/rm.h b/rm.h
new file mode 100644
index 0000000..dd89821
--- /dev/null
+++ b/rm.h
@@ -0,0 +1,7 @@
+#ifndef E2TOOLS_RM_H
+#define E2TOOLS_RM_H
+
+/* from rm.c */
+extern long e2rm(int argc, char *argv[]);
+
+#endif /* !E2TOOLS_RM_H */
diff --git a/tail.h b/tail.h
new file mode 100644
index 0000000..7b6eec3
--- /dev/null
+++ b/tail.h
@@ -0,0 +1,7 @@
+#ifndef E2TOOLS_TAIL_H
+#define E2TOOLS_TAIL_H
+
+/* from tail.c */
+extern long do_tail(int argc, char *argv[]);
+
+#endif /* !E2TOOLS_TAIL_H */
diff --git a/util.c b/util.c
index 0031a45..30cf777 100644
--- a/util.c
+++ b/util.c
@@ -9,10 +9,6 @@
* and modified by Robert Sanders <gt8134b@prism.gatech.edu>
*/
-#ifndef UTIL_C
-#define UTIL_C
-#endif
-
/* Description */
/*
* Misc. utility functions
@@ -229,7 +225,7 @@ delete_file(ext2_filsys fs, ext2_ino_t inode)
static int
release_blocks_proc(ext2_filsys fs, blk_t *blocknr,
- int blockcnt, void *private)
+ int UNUSED_PARM(blockcnt), void UNUSED_PARM(*private))
{
blk_t block;
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..7987ecc
--- /dev/null
+++ b/util.h
@@ -0,0 +1,20 @@
+#ifndef E2TOOLS_UTIL_H
+#define E2TOOLS_UTIL_H
+
+/* from 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
+ rw_mode);
+extern long read_inode(ext2_filsys fs, ext2_ino_t file, struct ext2_inode
+ *inode);
+extern long write_inode(ext2_filsys fs, ext2_ino_t file, struct ext2_inode
+ *inode);
+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);
+extern int is_file_regexp(char *ptr);
+extern regex_t *make_regexp(char *shell);
+
+#endif /* !E2TOOLS_UTIL_H */
diff --git a/write.h b/write.h
new file mode 100644
index 0000000..3a0f08a
--- /dev/null
+++ b/write.h
@@ -0,0 +1,9 @@
+#ifndef E2TOOLS_WRITE_H
+#define E2TOOLS_WRITE_H
+
+/* from 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 /* !E2TOOLS_WRITE_H */