Change from getopt to popt.
[rsync/rsync.git] / options.c
index 4176b32..a58df93 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1,5 +1,6 @@
-/* 
-   Copyright (C) Andrew Tridgell 1998
+/*  -*- c-file-style: "linux" -*-
+    
+    Copyright (C) 1998-2000 by Andrew Tridgell 
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -95,10 +96,35 @@ static int modify_window_set;
 
 struct in_addr socket_address = {INADDR_ANY};
 
+
+static void print_rsync_version(void)
+{
+        char const *got_socketpair = "no ";
+
+#ifdef HAVE_SOCKETPAIR
+        got_socketpair = "";
+#endif
+        
+        rprintf(FINFO, "rsync version %s  protocol version %d\n",
+                VERSION, PROTOCOL_VERSION);
+        rprintf(FINFO, "Configuration: %d-bit files, %ssocketpairs\n\n",
+                sizeof(int64) * 8,
+                got_socketpair);
+        rprintf(FINFO, "Written by Andrew Tridgell and Paul Mackerras "
+                "<http://rsync.samba.org/>\n\n");
+#ifdef NO_INT64
+        rprintf(FINFO, "WARNING: no 64-bit integers on this platform!\n");
+#endif
+}
+
+
 void usage(enum logcode F)
 {
   rprintf(F,"rsync version %s Copyright Andrew Tridgell and Paul Mackerras\n\n",
          VERSION);
+#ifdef NO_INT64
+  rprintf(F, "WARNING: no 64-bit integers on this platform!\n");
+#endif
 
   rprintf(F,"rsync is a file transfer program capable of efficient remote update\nvia a fast differencing algorithm.\n\n");
 
@@ -317,9 +343,7 @@ int parse_arguments(int argc, char *argv[], int frommain)
 
                switch (opt) {
                case OPT_VERSION:
-                       rprintf(FINFO,"rsync version %s  protocol version %d\n\n",
-                               VERSION,PROTOCOL_VERSION);
-                       rprintf(FINFO,"Written by Andrew Tridgell and Paul Mackerras\n");
+                        print_rsync_version();
                        exit_cleanup(0);
                        
                case OPT_SUFFIX:
@@ -597,6 +621,17 @@ int parse_arguments(int argc, char *argv[], int frommain)
                        break;
 
                default:
+                        /* FIXME: This can be confusing when the error message
+                         * is coming from a remote server which has an older
+                         * rsync version than the local version.  The user
+                         * sees the option documented in the local --help, but
+                         * then the program seems to refuse to execute it.  So
+                         * perhaps the message should give the hostname or
+                         * something.
+                         * 
+                         * In rsync 3.x, it might be nice if options which
+                         * only affect one end didn't have to bother the
+                         * remote end. */
                        slprintf(err_buf,sizeof(err_buf),"unrecognised option\n");
                        return 0;
                }