summaryrefslogtreecommitdiff
path: root/fileutil.h
diff options
context:
space:
mode:
authorakiyamn2020-09-07 20:30:10 +1000
committerakiyamn2020-09-07 20:30:10 +1000
commitf45a84a45f0ef074366f3bd88bed9992fe2eab73 (patch)
tree5023566a30610ddd6165abc879df0b7619ed4075 /fileutil.h
parent635be7a4fa2c172a8aeffa788e8cf172f10831dc (diff)
downloadfit2100_ass1-f45a84a45f0ef074366f3bd88bed9992fe2eab73.tar.gz
fit2100_ass1-f45a84a45f0ef074366f3bd88bed9992fe2eab73.zip
Added prototype of argument handling
Diffstat (limited to 'fileutil.h')
-rw-r--r--fileutil.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/fileutil.h b/fileutil.h
index 138f01d..676d3f0 100644
--- a/fileutil.h
+++ b/fileutil.h
@@ -1,12 +1,28 @@
#ifndef _FILEUTIL_H
#define _FILEUTIL_H
+#define FILE_BUF_SIZE 1024
+#define DEFAULT_READ_PATH "logfile.txt"
+#define NEW_FILE_PERMS 0664
+#define MIN_NUM_OF_ARGS 1
+#define MAX_NUM_OF_ARGS 6
+
+typedef enum {false, true} bool;
+typedef struct arguments_t {
+ bool valid;
+ bool move_flag;
+ bool force_flag;
+ bool dir_flag;
+ int src_path_index;
+ int dir_path_index;
+} arguments_t;
+
void to_stdout(char *string);
void to_stderr(char *string);
int open_file(char *path, int flags);
void file_into_file(int source_fd, int dest_fd);
void print_file(char *read_path);
-void copy_file(char *read_path, char *write_path, int overwrite);
+void copy_file(char *read_path, char *write_path, bool overwrite);
char* get_filename(char *full_path);
void copy_into_dir(char *file_path, char *dir_path);
int main(int argc, char *argv[]);