aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjozan <jozan@noemail.net>2020-11-04 19:38:06 +0000
committerjozan <jozan@noemail.net>2020-11-04 19:38:06 +0000
commitce1e4beee7a7f881363648deb663c00e38078563 (patch)
treecb7af0b3b42b6bef4d0465b9b5b8140bafe49587
parentCorrectly parsed options (diff)
downloadunixize-ce1e4beee7a7f881363648deb663c00e38078563.tar.gz
unixize-ce1e4beee7a7f881363648deb663c00e38078563.tar.bz2
unixize-ce1e4beee7a7f881363648deb663c00e38078563.tar.xz
unixize-ce1e4beee7a7f881363648deb663c00e38078563.tar.zst
unixize-ce1e4beee7a7f881363648deb663c00e38078563.zip
Now getting directory files
FossilOrigin-Name: 1875ab7cf0cbb651b8b45271cb5cd5b5c01974caa0128856aa1fd64c26480a7c
-rw-r--r--src/c_opts.c6
-rw-r--r--src/c_opts.h15
-rw-r--r--src/c_unixize.c23
-rw-r--r--src/c_unixize.h17
4 files changed, 29 insertions, 32 deletions
diff --git a/src/c_opts.c b/src/c_opts.c
index b029916..3884250 100644
--- a/src/c_opts.c
+++ b/src/c_opts.c
@@ -80,9 +80,9 @@ c_ask_confirm(const char dir[])
}
void
-c_get_opts(struct opts_s* opts,
- int argc,
- const char* argv[])
+c_get_opts(struct opts_s* opts,
+ int argc,
+ const char* argv[])
{
int opt;
bool_t confirm;
diff --git a/src/c_opts.h b/src/c_opts.h
index 27bacb0..5cbe4c0 100644
--- a/src/c_opts.h
+++ b/src/c_opts.h
@@ -46,26 +46,11 @@
#ifndef __C_OPTS_H__
#define __C_OPTS_H__
-#ifdef __linux__
-#include <linux/limits.h>
-#else
-#include <limits.h>
-#endif
-
#include "c_unixize.h"
#define C_OPTS "ahinpRv"
#define C_USAGE_FMT "usage: unixize [-%s] [directory]\n"
-struct opts_s {
- bool_t hidden;
- bool_t hyphen;
- bool_t pretend;
- bool_t recursive;
- bool_t verbose;
- char dir[PATH_MAX];
-};
-
void c_get_opts(struct opts_s*, int, const char*[]);
#endif /* ifndef __C_OPTS_H__ */
diff --git a/src/c_unixize.c b/src/c_unixize.c
index 7f3495d..c78af26 100644
--- a/src/c_unixize.c
+++ b/src/c_unixize.c
@@ -45,27 +45,22 @@
* This is the main function and entrypoint of the program.
*/
-#include <stdio.h>
-
#include "c_opts.h"
+void
+c_init(struct opts_s* opts)
+{
+ (void)opts;
+}
+
int
-main(int argc,
- const char* argv[])
+main(int argc,
+ const char* argv[])
{
struct opts_s opts;
c_get_opts(&opts, argc, argv);
- if (opts.recursive == TRUE)
- printf("Recursive\n");
- if (opts.verbose == TRUE)
- printf("Verbose\n");
- if (opts.pretend == TRUE)
- printf("Pretend\n");
- if (opts.hidden == TRUE)
- printf("Hidden\n");
- if (opts.hyphen == TRUE)
- printf("Hyphen\n");
+ c_init(&opts);
return (0);
}
diff --git a/src/c_unixize.h b/src/c_unixize.h
index 77a9ce0..2583af2 100644
--- a/src/c_unixize.h
+++ b/src/c_unixize.h
@@ -46,9 +46,26 @@
#ifndef __C_UNIXIZE_H__
#define __C_UNIXIZE_H__
+#ifdef __linux__
+#include <linux/limits.h>
+#else
+#include <limits.h>
+#endif
+
typedef enum bool_e {
FALSE,
TRUE
} bool_t;
+struct opts_s {
+ bool_t hidden;
+ bool_t hyphen;
+ bool_t pretend;
+ bool_t recursive;
+ bool_t verbose;
+ char dir[PATH_MAX];
+};
+
+void c_init(struct opts_s*);
+
#endif /* ifndef __C_UNIXIZE_H__ */