diff --git a/Makefile b/Makefile
index cf3c282..031f31a 100755
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ include Makefile.vars Makefile.msg
# Build everything.
-all: all-lib all-utils
+all: all-lib all-utils $(if $(INSTALL_MANPAGES),all-man)
# Mostly clean everything (remove everything but the end results).
@@ -33,12 +33,15 @@ mrproper: clean
$(call qcmd,$(RM) $(INCDIR)/lib$(NAME)/config.h)
# Remake everything (clean and build).
+
re: clean all
# Install everything.
-install: install-lib
-# Make a distribution tarball
+install: install-lib install-utils $(if $(INSTALL_MANPAGES),install-man)
+
+# Make a distribution tarball.
+
dist: mrproper
$(call bcmd,mkdir,lib$(NAME)-$(VERSION),\
$(MD) .dist)
@@ -145,61 +148,60 @@ $(eval $(call make-obj-rule,$(src))))
$(if $(FOR_WINDOWS),,y)))
IWINDLL := $(if $(FOR_WINDOWS),$(if $(STATIC),,y))
- install-lib: all-lib $(if $(INSTALL_DEVEL),install-cfgtool)
- $(call imsg,Installing the library.)
- $(call qcmd,$(INST) -m 755 -d "$(ILIBDIR)")
- $(call qcmd,$(INST) -m 755 -t "$(ILIBDIR)" $(if $(STATIC),\
- $(if $(FOR_WINDOWS),lib$(L_NAME).lib,lib$(L_NAME).a),\
- $(if $(FOR_WINDOWS),lib$(NAME).dll.a,$(SONAME))))
-
- $(if $(IWINDLL),$(call qcmd,$(INST) -m 755 -d "$(IBINDIR)"))
- $(if $(IWINDLL),$(call qcmd,$(INST) -m 755 -t "$(IBINDIR)" \
- lib$(NAME).dll))
-
- $(if $(LINK_TO_MAJOR),\
- $(call imsg,Linking lib$(NAME).so to lib$(NAME).so.$(MAJOR).))
- $(if $(LINK_TO_MAJOR),\
- $(call qcmd,$(LN) lib$(NAME).so.$(MAJOR) "$(ILIBDIR)/lib$(NAME).so"))
-
- $(if $(INSTALL_DEVEL),\
- $(call imsg,Installing development files.))
- $(if $(INSTALL_DEVEL),\
- $(call qcmd,$(INST) -m 755 -d $(patsubst %,\
- "$(IINCDIR)/lib$(NAME)-$(VERSION)/%", $(sort $(dir $(INCp))))))
- $(if $(INSTALL_DEVEL),$(foreach i,$(INCp),\
- $(call qcmd,$(INST) -m 644 $(INCDIR)/$(i) \
- "$(IINCDIR)/lib$(NAME)-$(VERSION)/$(i)"$(\n))))
-
-.PHONY: all-lib install-lib
-
-# ---
-# Configuration tools related.
-# ---
-
- install-cfgtool: $(CHECKCFG)
+ install-lib-cfgtool:
$(call imsg,Installing the configuration tool.)
$(call qcmd,$(INST) -m 755 -d "$(IBINDIR)")
$(call qcmd,tools/write-config \
- --name=$(NAME) --version=$(VERSION) --target="$(TARGET)" \
+ --name=$(LIB) --version=$(VERSION) --target="$(TARGET)" \
--maintainer="$(MAINTAINER_NAME) <$(MAINTAINER_MAIL)>" \
- >"$(IBINDIR)/lib$(NAME)-config" \
- && chmod 755 "$(IBINDIR)/lib$(NAME)-config")
+ >"$(IBINDIR)/lib$(LIB)-config" \
+ && chmod 755 "$(IBINDIR)/lib$(LIB)-config")
$(if $(TARGET),$(call qcmd,$(INST) -m 755 -d "$(HBINDIR)"))
$(if $(TARGET),$(call qcmd,$(LN) -r \
- "$(IBINDIR)/lib$(NAME)-config" \
- "$(HBINDIR)/$(TARGET)lib$(NAME)-config"))
-
+ "$(IBINDIR)/lib$(LIB)-config" \
+ "$(HBINDIR)/$(TARGET)lib$(LIB)-config"))
+
+ install-lib-pkgconfig:
$(call imsg,Installing the pkg-config configuration.)
$(call qcmd,$(INST) -m 755 -d "$(IPKGDIR)")
$(call qcmd,tools/write-pkg-config \
- --name=$(NAME) --version=$(VERSION) \
+ --name=$(LIB) --version=$(VERSION) \
--deps="$(DEPS)" --deps.private="$(DEPS_PRIV)" \
--description="$(DESCRIPTION)" \
- --incdir="$(OIINCDIR)/lib$(NAME)-$(VERSION)" --libdir="$(OILIBDIR)" \
- >"$(IPKGDIR)/lib$(NAME).pc" \
- && chmod 644 "$(IPKGDIR)/lib$(NAME).pc")
+ --incdir="$(OIINCDIR)/lib$(LIB)-$(VERSION)" --libdir="$(OILIBDIR)" \
+ >"$(IPKGDIR)/lib$(LIB).pc" \
+ && chmod 644 "$(IPKGDIR)/lib$(LIB).pc")
-.PHONY: install-cfgtool
+ install-lib-shared:
+ $(call imsg,Installing the library.)
+ $(call qcmd,$(INST) -m 755 -d "$(ILIBDIR)")
+ $(call qcmd,$(INST) -m 755 -t "$(ILIBDIR)" $(if $(STATIC),\
+ ./build/$(if $(FOR_WINDOWS),lib$(LIB).lib,lib$(LIB).a),\
+ ./build/$(if $(FOR_WINDOWS),lib$(LIB).dll.a,$(L_SONAME))))
+
+ install-lib-dll:
+ $(call qcmd,$(INST) -m 755 -d "$(IBINDIR)")
+ $(call qcmd,$(INST) -m 755 -t "$(IBINDIR)" lib$(LIB).dll)
+
+ install-lib-link:
+ $(call imsg,Linking lib$(LIB).so to lib$(LIB).so.$(MAJOR).)
+ $(call qcmd,$(LN) lib$(LIB).so.$(MAJOR) "$(ILIBDIR)/lib$(LIB).so")
+
+ install-lib-headers:
+ $(call imsg,Installing development files.)
+ $(foreach d,$(sort $(dir $(patsubst %,lib$(LIB)-$(VERSION)/%, \
+ $(L_INCp)))),$(call qcmd,$(INST) -m 755 -d "$(IINCDIR)/$(d)"$(\n)))
+ $(foreach i,$(L_INCp),$(call qcmd,$(INST) -m 644 $(L_INCDIR)/$(i) \
+ "$(IINCDIR)/lib$(LIB)-$(VERSION)/$(i)"$(\n)))
+
+ install-lib: $(CHECKCFG) all-lib install-lib-shared \
+ $(if $(LINK_TO_MAJOR),install-lib-link) $(if $(IWINDLL),install-lib-dll) \
+ $(if $(INSTALL_DEVEL),install-lib-cfgtool install-lib-pkgconfig \
+ install-lib-headers)
+
+.PHONY: all-lib install-lib install-lib-shared install-lib-link
+.PHONY: install-lib-dll install-lib-cfgtool install-lib-pkgconfig
+.PHONY: install-lib-headers
# ---
# Utilities related.
@@ -207,7 +209,7 @@ $(eval $(call make-obj-rule,$(src))))
# Make the utilities.
- all-utils: $(CHECKCFG) $(DEFAULT_UTILS:%=all-%)
+ all-utils: $(CHECKCFG) $(DEFAULT_UTILS:%=all-%.exe)
# Make a utility.
@@ -216,7 +218,7 @@ define make-util-rules
$(if $(filter libcasio,$(U_DEPS_$1)),$(L_AS_DEP)) | ./build/
$(call bcmd,ld,$$@,$(LD) -o $$@ $(U_OBJ_$1) $(U_LDFLAGS_$1))
- all-$1: ./build/$1$(if $(FOR_WINDOWS),.exe)
+ all-$1 all-$1.exe: ./build/$1$(if $(FOR_WINDOWS),.exe)
endef
$(foreach util,$(UTILS),\
$(eval $(call make-util-rules,$(util))))
@@ -234,17 +236,24 @@ $(foreach util,$(UTILS),\
$(foreach src,$(U_SRC_$(util)),\
$(eval $(call make-util-obj-rules,$(util),$(src)))))
+# Install utils.
+
+ install-utils: $(DEFAULT_UTILS:%=install-%)
+
# Install a utility.
define make-util-install-rule
- install-$1 install-$1.exe: $(CHECKCFG)
+ install-$1 install-$1.exe: $(CHECKCFG) all-$1.exe
$(call imsg,Installing $1$(if $(FOR_WINDOWS),.exe).)
- $(call qcmd,$(INSTALL) -m 755 -d "$(IBINDIR)")
- $(call qcmd,$(INSTALL) -m 755 -t "$(IBINDIR)" $1$(if $(FOR_WINDOWS),.exe))
+ $(call qcmd,$(INST) -m 755 -d "$(IBINDIR)")
+ $(call qcmd,$(INST) -m 755 -t "$(IBINDIR)" \
+ ./build/$1$(if $(FOR_WINDOWS),.exe))
endef
+$(foreach util,$(UTILS),\
+$(eval $(call make-util-install-rule,$(util))))
-.PHONY: all-utils $(foreach util,$(UTILS),all-$(util) install-$(util) \
- install-$(util).exe)
+.PHONY: all-utils install-utils $(foreach util,$(UTILS),\
+ all-$(util) all-$(util).exe install-$(util) install-$(util).exe)
# ---
# Manpages related.
@@ -253,7 +262,7 @@ endef
# Produce the manpages.
all-man: $(foreach sec,$(M_SECTIONS),\
- $(M_PAGES_$(sec):%=$(M_MANDIR)/man$(sec)/%.$(sec).gz))
+ $(M_PAGES_$(sec):%=$(M_MANDIR)/man$(sec)/%.$(sec)))
# Produce one page.
@@ -268,6 +277,19 @@ $(foreach sec,$(M_SECTIONS),\
$(foreach pg,$(M_PAGES_$(sec)),\
$(eval $(call make-manpage-rules,$(sec),$(pg)))))
+# Install the manpages.
+
+ install-man: $(CHECKCFG) all-man
+ $(call imsg,Installing manpages.)
+ $(foreach s,$(M_SECTIONS),$(call qcmd,$(INST) -m 755 \
+ -d "$(IMANDIR)/man$(s)"$(\n)))
+ $(foreach s,$(M_SECTIONS),$(foreach p,$(M_PAGES_$(s)),\
+ $(call qcmd,$(INST) -m 644 $(M_MANDIR)/man$(s)/$(p).$(s) \
+ "$(IMANDIR)/man$(s)/$(p).$(s)" && \
+ $(GZIP) "$(IMANDIR)/man$(s)/$(p).$(s)"$(\n))))
+
+.PHONY: all-man install-man
+
# ---
# Documentation-related targets.
# ---
diff --git a/Makefile.vars b/Makefile.vars
index e745314..da9fa6d 100755
--- a/Makefile.vars
+++ b/Makefile.vars
@@ -90,7 +90,7 @@ endif
RM := rm -f
A2X := a2x
INST := install
- GZIP := gzip -k -f
+ GZIP := gzip -f
# ---
# Dependencies definitions.
@@ -156,7 +156,7 @@ endif
L_OBJDIRS := $(sort $(dir $(L_OBJ)))
L_INCp := $(patsubst $(L_INCDIR)/%,%,$(wildcard $(L_INCDIR)/*.h \
- $(L_INCDIR)/**/*.h))
+ $(L_INCDIR)/**/*.h $(L_INCDIR)/**/**/*.h $(L_INCDIR)/**/**/**/*.h))
L_INC := $(L_INCp:%=$(L_INCDIR)/%) \
$(wildcard $(L_SRCDIR)/*.h $(L_SRCDIR)/**/*.h)
@@ -217,10 +217,11 @@ define get-util-source
$(U_SRCDIR)/$1/**/*.h))
U_CFLAGS_$1 := $(CFLAGS) $(foreach dep,$(U_DEPS_$1),$(DEP_$(dep)_CFLAGS)) \
- -D BIN="$1$(if $(FOR_WINDOWS),.exe)" \
- -D MAINTAINER="$(MAINTAINER_NAME) <$(MAINTAINER_MAIL)>" \
- -D DEFAULT_STORAGE="$(DEFAULT_STORAGE)" \
- -D DEFAULT_ZOOM="$(DEFAULT_ZOOM)"
+ -D BIN="\"$1$(if $(FOR_WINDOWS),.exe)\"" \
+ -D NAME="\"p7utils\"" -D VERSION="\"$(VERSION)\"" \
+ -D MAINTAINER="\"$(MAINTAINER_NAME) <$(MAINTAINER_MAIL)>\"" \
+ -D DEFAULT_STORAGE="\"$(DEFAULT_STORAGE)\"" \
+ -D DEFAULT_ZOOM="\"$(DEFAULT_ZOOM)\""
U_LIBS_$1 := $(foreach dep,$(U_DEPS_$1),$(DEP_$(dep)_LIBS))
U_LDFLAGS_$1 := $(foreach dep,$(U_DEPS_$1),$(DEP_$(dep)_LIBS))
diff --git a/configure b/configure
index 34d7a81..16a0b58 100755
--- a/configure
+++ b/configure
@@ -51,10 +51,12 @@ hbindir='${hprefix}/bin'
libdir='${prefix}/lib'"$platform"
includedir='${prefix}/include'"$platform"
pkgdir='${libdir}/pkgconfig'
+mandir='${prefix}/share/man'
# Installation options.
install_devel=yes
+install_manpages=yes
# Tweaks.
@@ -93,7 +95,8 @@ Build options:
--default-storage=STOR the default storage device for p7 [$default_storage]
Installation options:
- --no-devel should not install developement files
+ --no-devel do not install developement files
+ --no-manpages do not install manpages
Installation directories:
--root=ROOT installation root [$root]
@@ -106,6 +109,7 @@ Fine tuning of the installation directories:
--pkgdir=PKGDIR pkg-config configurations directory [$pkgdir]
--libdir=LIBDIR library files of the linker [$libdir]
--includedir=INCDIR include files for the compiler [$includedir]
+ --mandir=MANDIR man root [$mandir]
Other tweaks:
CFLAGS=CFLAGS some more compilation flags
@@ -191,6 +195,7 @@ got '$level'"
# then set
default_storage="$storage" ;;
--no-devel) install_devel= ;;
+--no-manpages) install_manpages= ;;
--root=*) root="${arg#*=}" ;;
--hprefix=*) hprefix="${arg#*=}" ;;
--prefix=*) prefix="${arg#*=}"; prefix_set=y ;;
@@ -199,6 +204,7 @@ got '$level'"
--pkgdir=*) pkgdir="${arg#*=}" ;;
--libdir=*) libdir="${arg#*=}" ;;
--includedir=*) includedir="${arg#*=}" ;;
+--mandir=*) mandir="${arg#*=}" ;;
CFLAGS=*) cflags="${arg#*=}" ;;
LDFLAGS=*) ldflags="${arg#*=}" ;;
*) echo "$arg: didn't read" ;;
@@ -223,7 +229,7 @@ fi;; esac
# Evaluate variables.
-vars="prefix bindir libdir pkgdir includedir hprefix hbindir"
+vars="prefix bindir libdir pkgdir includedir hprefix hbindir mandir"
for var in $vars; do
eval $var'='$(eval 'echo $'$var)
done
@@ -313,9 +319,11 @@ cat <.
+Read more at .
SEE ALSO
--------
diff --git a/src/cafix/args.c b/src/cafix/args.c
new file mode 100644
index 0000000..dc1ae23
--- /dev/null
+++ b/src/cafix/args.c
@@ -0,0 +1,262 @@
+/* ****************************************************************************
+ * cafix/args.c -- cafix command-line argument parsing.
+ * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey
+ *
+ * This file is part of p7utils.
+ * p7utils is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2.0 of the License,
+ * or (at your option) any later version.
+ *
+ * p7utils is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with p7utils; if not, see .
+ * ************************************************************************* */
+#include "main.h"
+#include
+
+/* Version message. */
+
+static const char version_message[] =
+BIN " - from " NAME " v" VERSION
+ " (licensed under GPLv2)\n"
+"Maintained by " MAINTAINER ".\n"
+"\n"
+"This is free software; see the source for copying conditions.\n"
+"There is NO warranty; not even for MERCHANTABILITY or\n"
+"FITNESS FOR A PARTICULAR PURPOSE.";
+
+static void put_version(void)
+{
+ fputs(version_message, stderr);
+}
+
+/* Help message. */
+
+static const char help_begin[] =
+"Usage: " BIN " [OPTIONS]... [SOURCE | DESTPATH]\n"
+"\n"
+"Remake of the 90s utility known as the Calculator File-Xferer, made by\n"
+"Tom Lynn, and which used to work with the CFX-9850 GB PLUS and the \n"
+"CFX-9990GT, \"maybe other as well\".\n"
+"\n"
+"Available options:\n"
+" -h, --help Display this help page and exit.\n"
+" -v, --version Display the version message and exit.\n";
+
+static const char help_loglevel_init[] =
+" --log The library log level (default: %s).\n"
+" One of: %s";
+
+static const char help_end[] =
+" -r, --receive Try to receive data.\n"
+" -s, --send Send a file.\n"
+" -rn, --rename Prompts for filename (must be combined with -s or -r).\n"
+" -c, --control Remote control mode.\n"
+"\n"
+"Report bugs to " MAINTAINER ".\n";
+
+/**
+ * put_loglevel:
+ * Put a loglevel (for listing).
+ *
+ * @arg initialized if the list was initialized.
+ * @arg level the level string.
+ */
+
+static void put_loglevel(char **first, const char *level)
+{
+ if (!*first) {
+ *first = malloc(strlen(level) + 2);
+ if (!*first)
+ return ;
+ strcpy(*first + 1, level);
+ **first = 'F';
+ return ;
+ }
+
+ if (**first == 'F') {
+ fprintf(stderr, help_loglevel_init, casio_getlog(), *first + 1);
+ **first = 'N';
+ }
+
+ fprintf(stderr, ", %s", level);
+}
+
+/**
+ * put_help:
+ * Put the help message on standard output.
+ */
+
+static void put_help(void)
+{
+ char *first;
+
+ /* Put the beginning. */
+
+ fputs(help_begin, stderr);
+
+ /* Put the loglevels. */
+
+ first = NULL;
+ casio_listlog((casio_log_list_t*)&put_loglevel, (void*)&first);
+ if (first && *first == 'N')
+ fputc('\n', stderr);
+ free(first);
+
+ /* Put the end. */
+
+ fputs(help_end, stderr);
+}
+
+/* ---
+ * Main argument parsing function.
+ * --- */
+
+/**
+ * parse_args:
+ * Args parsing main function.
+ *
+ * Was my very first experiment with getopt.
+ * Then I took an arrow in the knee.
+ *
+ * @arg ac the arguments count
+ * @arg av the arguments values
+ * @arg args the parsed args pointer
+ * @return if it was successfully parsed
+ */
+
+int parse_args(int ac, char **av, args_t *args)
+{
+ int c, help = 0, pm;
+ const char *s_log = NULL;
+ char **pv;
+ char short_opts[] = "hvrsc";
+ struct option long_opts[] = {
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'v'},
+ {"log", required_argument, NULL, 'L'},
+ {"receive", no_argument, NULL, 'r'},
+ {"send", no_argument, NULL, 's'},
+ {"rn", no_argument, NULL, 'R'},
+ {"rename", no_argument, NULL, 'R'},
+ {"control", no_argument, NULL, 'c'},
+
+ /* sentinel */
+
+ {NULL, 0, NULL, 0}
+ };
+
+ /* Initialize the arguments. */
+
+ args->mode = 0; /* unknown menu. */
+ args->should_rename = 0;
+ args->filename = NULL;
+
+ /* Gather the options. */
+
+ opterr = 0;
+ while ((c = getopt_long_only(ac, av, short_opts, long_opts, NULL)) != -1)
+ switch (c) {
+ /* Help and version message. */
+
+ case 'h':
+ help = 1;
+ break;
+ case 'v':
+ put_version();
+ return (1);
+
+ /* Log level. */
+
+ case 'L':
+ s_log = optarg;
+ break;
+
+ /* Command. */
+
+ case 'r':
+ if (args->mode != MODE_CONTROL)
+ args->mode = MODE_RECEIVE;
+ break;
+ case 's':
+ if (args->mode != MODE_CONTROL)
+ args->mode = MODE_SEND;
+ break;
+ case 'c':
+ args->mode = MODE_CONTROL;
+ break;
+
+ case 'R':
+ args->should_rename = 1;
+ break;
+
+ /* In case of error. */
+
+ case '?':
+ if (optopt == 'L')
+ fprintf(stderr, "--log: expected an argument\n");
+ else
+ break;
+ return (1);
+ }
+
+ /* Get the parameters. */
+
+ pm = ac - optind;
+ pv = &av[optind];
+
+ if (help) {
+ put_help();
+ return (1);
+ }
+
+ if (args->mode == 0) {
+ fprintf(stderr, "error: no command specified\n");
+ return (1);
+ }
+
+ switch (args->mode) {
+ case MODE_SEND:
+ if (pm != 1) {
+ fprintf(stderr, "error: path of the file to send required\n");
+ return (1);
+ }
+ args->filename = *pv;
+ break;
+
+ case MODE_RECEIVE:
+ if (pm != 1) {
+ fprintf(stderr, "error: path of the file to receive required\n");
+ return (1);
+ }
+ args->filename = *pv;
+ break;
+
+ case MODE_CONTROL:
+ if (pm) {
+ fprintf(stderr, "error: too many parameters\n");
+ return (1);
+ }
+ if (args->should_rename) {
+ fprintf(stderr, "error: cannot rename and control\n");
+ return (1);
+ }
+ break;
+ }
+
+ args->filename = *pv;
+
+ /* Set the log level. */
+
+ if (s_log)
+ casio_setlog(s_log);
+
+ /* Everything went well. */
+
+ return (0);
+}
diff --git a/src/p7servtest/client.c b/src/cafix/main.c
similarity index 53%
rename from src/p7servtest/client.c
rename to src/cafix/main.c
index 8d8cd80..c55d781 100644
--- a/src/p7servtest/client.c
+++ b/src/cafix/main.c
@@ -1,5 +1,5 @@
-/* *****************************************************************************
- * p7servtest/client.c -- p7servtest virtual client.
+/* ****************************************************************************
+ * cafix/main.c -- cafix main function.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey
*
* This file is part of p7utils.
@@ -15,37 +15,33 @@
*
* You should have received a copy of the GNU General Public License
* along with p7utils; if not, see .
- * ************************************************************************** */
+ * ************************************************************************* */
#include "main.h"
-int run_client(int in, int out)
+/**
+ * main:
+ * Entry point.
+ */
+
+int main(int ac, char **av)
{
- int err; casio_link_t *link = NULL;
- casio_stream_t *stream = NULL;
+ args_t args;
- /* make the stream */
- err = casio_open_stream_fd(&stream, in, out, 1, 1);
- if (err) {
- fprintf(stderr, "Client stream initialization has encountered "
- "an error: %s\n", casio_strerror(err));
+ if (parse_args(ac, av, &args))
+ return (1);
+
+ switch (args.mode) {
+ case MODE_CONTROL:
+ fprintf(stderr,
+ "This mode prints \"doesn't work yet, sorry\" in the original\n"
+ "cafix, so I don't know what the original author meant...\n"
+ "sorry if you were expecting something cool to happen!\n");
+ return (1);
+
+ default:
+ fprintf(stderr, "Temporarily unmanaged mode.\n");
return (1);
}
- /* make the handle */
- err = casio_open_link(&link,
- CASIO_LINKFLAG_ACTIVE | CASIO_LINKFLAG_CHECK | CASIO_LINKFLAG_TERM,
- stream, NULL);
- if (err) {
- fprintf(stderr, "Client initialization has encountered an error: %s\n",
- casio_strerror(err));
- return (1);
- }
-
- /* change working directory. */
- casio_seven_send_cmdfls_cwd(link, "oui", "fls0");
- casio_seven_send_cmdfls_cwd(link, "non", "fls0");
-
- /* we're done. */
- casio_close_link(link);
return (0);
}
diff --git a/src/p7servtest/main.h b/src/cafix/main.h
similarity index 62%
rename from src/p7servtest/main.h
rename to src/cafix/main.h
index 9196d57..5af7a16 100644
--- a/src/p7servtest/main.h
+++ b/src/cafix/main.h
@@ -1,5 +1,5 @@
-/* *****************************************************************************
- * p7servtest/main.h -- p7servtest main header.
+/* ****************************************************************************
+ * cafix/main.h -- cafix internals.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey
*
* This file is part of p7utils.
@@ -15,15 +15,30 @@
*
* You should have received a copy of the GNU General Public License
* along with p7utils; if not, see .
- * ************************************************************************** */
-#ifndef MAIN_H
-# define MAIN_H
-# include
+ * ************************************************************************* */
+#ifndef MAIN_H
+# define MAIN_H 2018042501
+# include
+# include
+# include
+# include
# include
-int parse_args(int ac, char **av);
+/* Command-line arguments. */
-int run_server(int in, int out);
-int run_client(int in, int out);
+# define MODE_SEND 1 /* send a file */
+# define MODE_RECEIVE 2 /* receive data */
+# define MODE_CONTROL 3 /* remote control */
+
+typedef struct {
+ int mode;
+ int should_rename; /* should prompt to rename file */
+
+ const char *filename;
+} args_t;
+
+/* Utilities. */
+
+extern int parse_args(int ac, char **av, args_t *args);
#endif /* MAIN_H */
diff --git a/src/p7servtest/vars.mk b/src/cafix/vars.mk
old mode 100644
new mode 100755
similarity index 100%
rename from src/p7servtest/vars.mk
rename to src/cafix/vars.mk
diff --git a/src/g1a-wrapper/args.c b/src/g1a-wrapper/args.c
index 12e2d4c..d8c7895 100644
--- a/src/g1a-wrapper/args.c
+++ b/src/g1a-wrapper/args.c
@@ -23,22 +23,25 @@
#include
#include
-/* ************************************************************************** */
-/* Help and version messages */
-/* ************************************************************************** */
-/* Version message */
+/* ---
+ * Help and version messages.
+ * --- */
+
+/* Version message. */
+
static const char version_message[] =
-QUOTE(BIN) " - from " QUOTE(NAME) " v" QUOTE(VERSION)
+BIN " - from " NAME " v" VERSION
" (licensed under GPLv2)\n"
-"Maintained by " QUOTE(MAINTAINER) ".\n"
+"Maintained by " MAINTAINER ".\n"
"\n"
"This is free software; see the source for copying conditions.\n"
"There is NO warranty; not even for MERCHANTABILITY or\n"
"FITNESS FOR A PARTICULAR PURPOSE.";
-/* Main help message */
+/* Main help message. */
+
static const char help_message[] =
-"Usage: " QUOTE(BIN) " [-v] [--help|-h] \n"
+"Usage: " BIN " [-v] [--help|-h] \n"
" [-o