Skip to content

Commit

Permalink
Add cmirror --version
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Mar 7, 2025
1 parent 249d2af commit aca551a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <ctype.h>
#include <getopt.h>

#define CMIRROR_VERSION "v1.7"

// http://owww.molgen.mpg.de/~buczek/glib-doc/

#include <glib.h>
Expand Down Expand Up @@ -570,6 +572,7 @@ static void usage(char *argv0) {
fprintf(stderr,
"usage: %s [options] path [node:]path\n"
" %s --slave [--local-slave] [--socket-name path] [options] path\n"
" %s --version\n"
"\n"
" options:\n"
" --noop dont change anything\n"
Expand All @@ -594,7 +597,7 @@ static void usage(char *argv0) {
" --socket-name PATH EXPERIMENTAL use PATH as name for AF unix sockets\n"
" --noatime don't touch atime on sender\n"
" --ignore-permissions do not attempt to change file permissions\n",
argv0, argv0);
argv0, argv0, argv0);
_exit(1);
}

Expand Down Expand Up @@ -624,6 +627,7 @@ static struct option options[] = {
{ "socket-name", 1, NULL, 104 },
{ "noatime", 0, &noatime, 1 },
{ "ignore-permissions", 0, &ignore_permissions, 1 },
{ "version", 0, NULL, 105 },
{ NULL }
};

Expand Down Expand Up @@ -1478,7 +1482,10 @@ int main(int argc, char **argv) {
g_strv_builder_add(ssh_opts_builder, optarg);
else if (opt == 104)
unix_socket_name = g_strdup(optarg);
else if (opt == '?')
else if (opt == 105) {
printf("cmirror version " CMIRROR_VERSION "\n");
exit(0);
} else if (opt == '?')
usage(argv0);
else
die("internal error: getopt returned %d\n", opt);
Expand Down

0 comments on commit aca551a

Please sign in to comment.