Skip to content

Next #21

Merged
merged 2 commits into from
Mar 7, 2025
Merged

Next #21

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 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 @@ -865,7 +869,7 @@ static void slave(char *slave_path) {
fileop_chmod(fi_want->perm, filename);
}
} else if (fi_want->type== 'S') {
warn("%s: is a socket(ignored)\n", filename);
; // silently ignore sockets
} else if (fi_want->type == 'C' || fi_want->type == 'B') {
if (!fi_is || fi_is->type != fi_want->type || fi_is->rdev != fi_want->rdev) {
if (fi_is)
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