Skip to content

Commit dee0993

Browse files
committed
Create usage.c for smaller awk-dep rebuilds.
1 parent 47351c2 commit dee0993

File tree

4 files changed

+264
-240
lines changed

4 files changed

+264
-240
lines changed

Makefile.in

+2-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ zlib_OBJS=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
4343
OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
4444
util.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
4545
OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
46-
fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
46+
usage.o fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
4747
OBJS3=progress.o pipe.o @ASM@
4848
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
4949
popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
@@ -99,8 +99,7 @@ rsync$(EXEEXT): $(OBJS)
9999
$(OBJS): $(HEADERS)
100100
$(CHECK_OBJS): $(HEADERS)
101101
tls.o xattrs.o: lib/sysxattrs.h
102-
options.o: latest-year.h help-rsync.h help-rsyncd.h git-version.h
103-
exclude.o: default-cvsignore.h
102+
usage.o: latest-year.h help-rsync.h help-rsyncd.h git-version.h default-cvsignore.h
104103
loadparm.o: default-dont-compress.h daemon-parm.h
105104

106105
flist.o: rounding.h

exclude.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
*/
2222

2323
#include "rsync.h"
24-
#include "default-cvsignore.h"
2524
#include "ifuncs.h"
2625

2726
extern int am_server;
@@ -1053,7 +1052,7 @@ static void get_cvs_excludes(uint32 rflags)
10531052
return;
10541053
initialized = 1;
10551054

1056-
parse_filter_str(&cvs_filter_list, DEFAULT_CVSIGNORE,
1055+
parse_filter_str(&cvs_filter_list, default_cvsignore(),
10571056
rule_template(rflags | (protocol_version >= 30 ? FILTRULE_PERISHABLE : 0)),
10581057
0);
10591058

options.c

-235
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@
2222
#include "rsync.h"
2323
#include "itypes.h"
2424
#include "ifuncs.h"
25-
#include "latest-year.h"
26-
#include "git-version.h"
2725
#include <popt.h>
2826

2927
extern int module_id;
3028
extern int local_server;
3129
extern int sanitize_paths;
3230
extern unsigned int module_dirlen;
33-
extern struct name_num_obj valid_checksums;
34-
extern struct name_num_obj valid_compressions;
3531
extern filter_rule_list filter_list;
3632
extern filter_rule_list daemon_filter_list;
3733

@@ -576,225 +572,6 @@ void negate_output_levels(void)
576572
debug_levels[j] *= -1;
577573
}
578574

579-
static char *istring(const char *fmt, int val)
580-
{
581-
char *str;
582-
if (asprintf(&str, fmt, val) < 0)
583-
out_of_memory("istring");
584-
return str;
585-
}
586-
587-
static void print_info_flags(enum logcode f)
588-
{
589-
STRUCT_STAT *dumstat;
590-
char line_buf[75];
591-
int line_len, j;
592-
char *info_flags[] = {
593-
594-
"*Capabilities",
595-
596-
istring("%d-bit files", (int)(sizeof (OFF_T) * 8)),
597-
istring("%d-bit inums", (int)(sizeof dumstat->st_ino * 8)), /* Don't check ino_t! */
598-
istring("%d-bit timestamps", (int)(sizeof (time_t) * 8)),
599-
istring("%d-bit long ints", (int)(sizeof (int64) * 8)),
600-
601-
#ifndef HAVE_SOCKETPAIR
602-
"no "
603-
#endif
604-
"socketpairs",
605-
606-
#ifndef SUPPORT_HARD_LINKS
607-
"no "
608-
#endif
609-
"hardlinks",
610-
611-
#ifndef CAN_HARDLINK_SPECIAL
612-
"no "
613-
#endif
614-
"hardlink-specials",
615-
616-
#ifndef SUPPORT_LINKS
617-
"no "
618-
#endif
619-
"symlinks",
620-
621-
#ifndef INET6
622-
"no "
623-
#endif
624-
"IPv6",
625-
626-
#ifndef SUPPORT_ATIMES
627-
"no "
628-
#endif
629-
"atimes",
630-
631-
"batchfiles",
632-
633-
#ifndef HAVE_FTRUNCATE
634-
"no "
635-
#endif
636-
"inplace",
637-
638-
#ifndef HAVE_FTRUNCATE
639-
"no "
640-
#endif
641-
"append",
642-
643-
#ifndef SUPPORT_ACLS
644-
"no "
645-
#endif
646-
"ACLs",
647-
648-
#ifndef SUPPORT_XATTRS
649-
"no "
650-
#endif
651-
"xattrs",
652-
653-
#ifdef RSYNC_USE_PROTECTED_ARGS
654-
"default "
655-
#else
656-
"optional "
657-
#endif
658-
"protect-args",
659-
660-
#ifndef ICONV_OPTION
661-
"no "
662-
#endif
663-
"iconv",
664-
665-
#ifndef CAN_SET_SYMLINK_TIMES
666-
"no "
667-
#endif
668-
"symtimes",
669-
670-
#ifndef SUPPORT_PREALLOCATION
671-
"no "
672-
#endif
673-
"prealloc",
674-
675-
#ifndef HAVE_MKTIME
676-
"no "
677-
#endif
678-
"stop-at",
679-
680-
#ifndef SUPPORT_CRTIMES
681-
"no "
682-
#endif
683-
"crtimes",
684-
685-
"*Optimizations",
686-
687-
#ifndef HAVE_SIMD
688-
"no "
689-
#endif
690-
"SIMD",
691-
692-
#ifndef HAVE_ASM
693-
"no "
694-
#endif
695-
"asm",
696-
697-
#ifndef USE_OPENSSL
698-
"no "
699-
#endif
700-
"openssl-crypto",
701-
702-
NULL
703-
};
704-
705-
for (line_len = 0, j = 0; ; j++) {
706-
char *str = info_flags[j], *next_nfo = str ? info_flags[j+1] : NULL;
707-
int str_len = str && *str != '*' ? strlen(str) : 1000;
708-
int need_comma = next_nfo && *next_nfo != '*' ? 1 : 0;
709-
if (line_len && line_len + 1 + str_len + need_comma >= (int)sizeof line_buf) {
710-
rprintf(f, " %s\n", line_buf);
711-
line_len = 0;
712-
}
713-
if (!str)
714-
break;
715-
if (*str == '*') {
716-
rprintf(f, "%s:\n", str+1);
717-
continue;
718-
}
719-
line_len += snprintf(line_buf+line_len, sizeof line_buf - line_len, " %s%s", str, need_comma ? "," : "");
720-
}
721-
}
722-
723-
const char *rsync_version(void)
724-
{
725-
return RSYNC_GITVER;
726-
}
727-
728-
static void print_rsync_version(enum logcode f)
729-
{
730-
char tmpbuf[256], *subprotocol = "";
731-
732-
#if SUBPROTOCOL_VERSION != 0
733-
subprotocol = istring(".PR%d", SUBPROTOCOL_VERSION);
734-
#endif
735-
rprintf(f, "%s version %s protocol version %d%s\n",
736-
RSYNC_NAME, rsync_version(), PROTOCOL_VERSION, subprotocol);
737-
738-
rprintf(f, "Copyright (C) 1996-" LATEST_YEAR " by Andrew Tridgell, Wayne Davison, and others.\n");
739-
rprintf(f, "Web site: https://rsync.samba.org/\n");
740-
741-
print_info_flags(f);
742-
743-
rprintf(f, "Checksum list:\n");
744-
get_default_nno_list(&valid_checksums, tmpbuf, sizeof tmpbuf, '(');
745-
rprintf(f, " %s\n", tmpbuf);
746-
747-
rprintf(f, "Compress list:\n");
748-
get_default_nno_list(&valid_compressions, tmpbuf, sizeof tmpbuf, '(');
749-
rprintf(f, " %s\n", tmpbuf);
750-
751-
#ifdef MAINTAINER_MODE
752-
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
753-
#endif
754-
755-
#if SIZEOF_INT64 < 8
756-
rprintf(f, "WARNING: no 64-bit integers on this platform!\n");
757-
#endif
758-
if (sizeof (int64) != SIZEOF_INT64) {
759-
rprintf(f,
760-
"WARNING: size mismatch in SIZEOF_INT64 define (%d != %d)\n",
761-
(int) SIZEOF_INT64, (int) sizeof (int64));
762-
}
763-
764-
rprintf(f,"\n");
765-
rprintf(f,"rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you\n");
766-
rprintf(f,"are welcome to redistribute it under certain conditions. See the GNU\n");
767-
rprintf(f,"General Public Licence for details.\n");
768-
}
769-
770-
771-
void usage(enum logcode F)
772-
{
773-
print_rsync_version(F);
774-
775-
rprintf(F,"\n");
776-
rprintf(F,"rsync is a file transfer program capable of efficient remote update\n");
777-
rprintf(F,"via a fast differencing algorithm.\n");
778-
779-
rprintf(F,"\n");
780-
rprintf(F,"Usage: rsync [OPTION]... SRC [SRC]... DEST\n");
781-
rprintf(F," or rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST\n");
782-
rprintf(F," or rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST\n");
783-
rprintf(F," or rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST\n");
784-
rprintf(F," or rsync [OPTION]... [USER@]HOST:SRC [DEST]\n");
785-
rprintf(F," or rsync [OPTION]... [USER@]HOST::SRC [DEST]\n");
786-
rprintf(F," or rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]\n");
787-
rprintf(F,"The ':' usages connect via remote shell, while '::' & 'rsync://' usages connect\n");
788-
rprintf(F,"to an rsync daemon, and require SRC or DEST to start with a module name.\n");
789-
rprintf(F,"\n");
790-
rprintf(F,"Options\n");
791-
#include "help-rsync.h"
792-
rprintf(F,"\n");
793-
rprintf(F,"Use \"rsync --daemon --help\" to see the daemon-mode command-line options.\n");
794-
rprintf(F,"Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation.\n");
795-
rprintf(F,"See https://rsync.samba.org/ for updates, bug reports, and answers\n");
796-
}
797-
798575
enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
799576
OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
800577
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
@@ -1055,18 +832,6 @@ static struct poptOption long_options[] = {
1055832
{0,0,0,0, 0, 0, 0}
1056833
};
1057834

1058-
static void daemon_usage(enum logcode F)
1059-
{
1060-
print_rsync_version(F);
1061-
1062-
rprintf(F,"\n");
1063-
rprintf(F,"Usage: rsync --daemon [OPTION]...\n");
1064-
#include "help-rsyncd.h"
1065-
rprintf(F,"\n");
1066-
rprintf(F,"If you were not trying to invoke rsync as a daemon, avoid using any of the\n");
1067-
rprintf(F,"daemon-specific rsync options. See also the rsyncd.conf(5) man page.\n");
1068-
}
1069-
1070835
static struct poptOption long_daemon_options[] = {
1071836
/* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
1072837
{"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 },

0 commit comments

Comments
 (0)