diff options
-rw-r--r-- | Makefile.am | 22 | ||||
-rw-r--r-- | Makefile.in | 22 | ||||
-rw-r--r-- | copy.c | 10 | ||||
-rw-r--r-- | copy.h | 8 | ||||
-rw-r--r-- | e2tools.h | 86 | ||||
-rw-r--r-- | ln.h | 10 | ||||
-rw-r--r-- | ls.c | 5 | ||||
-rw-r--r-- | ls.h | 7 | ||||
-rw-r--r-- | mkdir.h | 11 | ||||
-rw-r--r-- | mv.h | 10 | ||||
-rw-r--r-- | progress.h | 6 | ||||
-rw-r--r-- | read.c | 5 | ||||
-rw-r--r-- | read.h | 13 | ||||
-rw-r--r-- | rm.c | 12 | ||||
-rw-r--r-- | rm.h | 7 | ||||
-rw-r--r-- | tail.h | 7 | ||||
-rw-r--r-- | util.c | 6 | ||||
-rw-r--r-- | util.h | 20 | ||||
-rw-r--r-- | write.h | 9 |
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 @@ -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, @@ -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 */ @@ -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 @@ -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 */ @@ -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]; @@ -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 */ @@ -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 */ @@ -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 */ @@ -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); @@ -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 */ @@ -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]; @@ -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 */ @@ -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 */ @@ -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; @@ -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 */ @@ -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 */ |