Split non-static code out of wiggle.c
[wiggle/upstream.git] / ReadMe.c
blobc71709208bf50295127efa2b715f75d81f672fea
1 /*
2 * wiggle - apply rejected patches
4 * Copyright (C) 2003 Neil Brown <neilb@cse.unsw.edu.au>
5 * Copyright (C) 2010-2013 Neil Brown <neilb@suse.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program.
21 * Author: Neil Brown
22 * Email: <neilb@suse.de>
26 * Options and help text for wiggle
29 #include "wiggle.h"
31 #ifndef VERSION
32 #define VERSION "1.2"
33 #endif
34 #ifndef VERS_DATE
35 #define VERS_DATE "2019-12-27"
36 #endif
38 char Version[] = "wiggle " VERSION " " VERS_DATE " GPL-2+ http://neil.brown.name/wiggle/\n";
40 char short_options[] = "xdmwlrho:iW123p::VRvqBb";
42 struct option long_options[] = {
43 {"browse", 0, 0, 'B'},
44 {"extract", 0, 0, 'x'},
45 {"diff", 0, 0, 'd'},
46 {"merge", 0, 0, 'm'},
47 {"words", 0, 0, 'w'},
48 {"lines", 0, 0, 'l'},
49 {"patch", 0, 0, 'p'},
50 {"replace", 0, 0, 'r'},
51 {"help", 0, 0, 'h'},
52 {"version", 0, 0, 'V'},
53 {"reverse", 0, 0, 'R'},
54 {"verbose", 0, 0, 'v'},
55 {"quiet", 0, 0, 'q'},
56 {"strip", 1, 0, 'p'},
57 {"output", 1, 0, 'o'},
58 {"no-ignore", 0, 0, 'i'},
59 {"show-wiggles",0, 0, 'W'},
60 {"ignore-blanks",0,0, 'b'},
61 {"no-backup", 0, 0, NO_BACKUP },
62 {"self-test", 0, 0, SELF_TEST},
63 {"report-wiggles", 0, 0, REPORT_WIGGLES},
64 {"non-space", 0, 0, NON_SPACE},
65 {"shortest", 0, 0, SHORTEST},
66 {0, 0, 0, 0}
69 char Usage[] =
70 "Usage: wiggle --diff|--extract|--merge|--browse --lines|--words [--replace] files...\n";
72 char Help[] = "\n"
73 "Wiggle - apply patches that 'patch' rejects.\n"
74 "\n"
75 "Wiggle provides four distinct but related functions:\n"
76 "merge, diff, extract, and browse.\n"
77 "To get more detailed help on a function, select the function\n"
78 "before requesting help. e.g.\n"
79 " wiggle --diff --help\n"
80 "\n"
81 "Options:\n"
82 " --extract -x : select 'extract' function.\n"
83 " --diff -d : select 'diff' function.\n"
84 " --merge -m : select 'merge' function (default).\n"
85 " --browse -B : select 'browse' function.\n"
86 "\n"
87 " --words -w : word-wise diff and merge.\n"
88 " --lines -l : line-wise diff and merge.\n"
89 " --non-space : words are separated by spaces.\n"
90 "\n"
91 " --patch -p : treat last file as a patch file.\n"
92 " -1 -2 -3 : select which component of patch or merge to use.\n"
93 " --reverse -R : swap 'before' and 'after' for diff function.\n"
94 " --no-ignore -i : Don't ignore already-applied changes.\n"
95 " --show-wiggle -W : Report wiggles like conflicts with an extra stanza.\n"
96 "\n"
97 " --help -h : get help.\n"
98 " --version -V : get version of wiggle.\n"
99 " --verbose -v : (potentially) be more verbose.\n"
100 " --quiet -q : don't print un-necessary messages.\n"
101 "\n"
102 " --replace -r : replace first file with result of merger.\n"
103 " --no-backup : Never save original file (as name.porig).\n"
104 "\n"
105 " --strip= -p : number of path components to strip from file names.\n"
106 "\n"
107 "Wiggle needs to be given 1, 2, or 3 files. Any one of these can\n"
108 "be given as '-' to signify standard input.\n"
109 "\n";
111 char HelpExtract[] = "\n"
112 "wiggle --extract -[123] [--patch] merge-or-patch\n"
113 "\n"
114 "The extract function allows one branch of a patch or merge file\n"
115 "to be extracted. A 'patch' is the output of 'diff -c' or 'diff -u'.\n"
116 "Either the before (-1) or after (-2) branch can be extracted.\n"
117 "\n"
118 "A 'merge' is the output of 'diff3 -m' or 'merge -A'. Either the\n"
119 "first, second, or third branch can be extracted.\n"
120 "\n"
121 "A 'merge' file is assumed unless --patch is given.\n"
122 "\n";
124 char HelpDiff[] = "\n"
125 "wiggle --diff [-wl] [-p12] [-R] file-or-patch [file-or-patch]\n"
126 "\n"
127 "The diff function will report the differences and similarities between\n"
128 "two files in a format similar to 'diff -u'. With --word mode\n"
129 "(the default) word-wise differences are displayed on lines starting\n"
130 "with a '|'. With --line mode, only whole lines are considered\n"
131 "much like normal diff.\n"
132 "\n"
133 "If one file is given is it assumed to be a patch, and the two\n"
134 "branches of the patch are extracted and compared. If two files\n"
135 "are given they are normally assumed to be whole files and are compared.\n"
136 "However if the --patch option is given with two files, then the\n"
137 "second is treated as a patch and the first or (with -2) second branch\n"
138 "is extracted and compared against the first file.\n"
139 "\n"
140 "--reverse (-R) with cause diff to swap the two files before comparing\n"
141 "them.\n"
142 "\n";
144 char HelpMerge[] = "\n"
145 "wiggle --merge [-wl] [--replace] file-or-merge [file-or-patch [file]]\n"
146 "\n"
147 "The merge function is the primary function of wiggle and is assumed\n"
148 "if no function is explicitly chosen.\n"
149 "\n"
150 "Normally wiggle will compare three files on a word-by-word basis and\n"
151 "output unresolvable conflicts in the resulting merge by showing\n"
152 "whole-line differences.\n"
153 "With the --lines option, the files are compared line-wise much\n"
154 "like 'merge'. With the (default) --words option, files are compared\n"
155 "word-wise and unresolvable conflicts are reported word-wise.\n"
156 "\n"
157 "If --merge is given one file, it is treated as a merge (merge -A\n"
158 "output) and the three needed streams are extracted from it.\n"
159 "If --merge is given one file and -p, it is a patch which identifies\n"
160 "the files that should be patched.\n"
161 "If --merge is given two files, the second is treated as a patch\n"
162 "file and the first is the original file.\n"
163 "If --merge is given three files, they are each treated as whole files\n"
164 "and differences between the second and third are merged into the first.\n"
165 "This usage is much like 'merge'.\n"
166 "\n";
168 char HelpBrowse[] = "\n"
169 "wiggle --browse [-R] [--strip=n] [-p] [files]\n"
170 "\n"
171 "The 'browse' function provides an interactive mode for browsing a\n"
172 "patch or set of patches. It allows the application of a patch to each\n"
173 "file to be inspected and will eventually allow limited editing to correct\n"
174 "mis-application of patches where wiggling was required, and where conflicts\n"
175 "occurred.\n"
176 "If no files are given, a patch file is read from stdin\n"
177 "If one file is given with -p, it is treated as a patch file\n"
178 "If one file is given with a name ending .rej, it is treated as a reject for\n"
179 " a file with matching basename\n"
180 "Otherwise a single file is assumed to be a merge output with conflicts.\n"
181 "If two files are given, the second is a patch to apply to the first.\n"
182 "If three files are given then the difference between 2nd and 3rd is applied\n"
183 " to the first\n"
184 "\n";