NULL
};
-void help_window(char *page1[], char *page2[])
+static void help_window(char *page1[], char *page2[])
{
int rows, cols;
int top, left;
}
-char *typenames[] = {
+static char *typenames[] = {
[End] = "End",
[Unmatched] = "Unmatched",
[Unchanged] = "Unchanged",
};
/* used for checking location during search */
-int same_mpos(struct mpos a, struct mpos b)
+static int same_mpos(struct mpos a, struct mpos b)
{
return a.p.m == b.p.m &&
a.p.s == b.p.s &&
* original, is meaningful. This is used to avoid walking down
* pointless paths.
*/
-int stream_valid(int s, enum mergetype type)
+static int stream_valid(int s, enum mergetype type)
{
switch(type) {
case End: return 1;
* This walks the merges in sequence, and the streams within
* each merge.
*/
-struct elmnt next_melmnt(struct mp *pos,
- struct file fm, struct file fb, struct file fa,
- struct merge *m)
+static struct elmnt next_melmnt(struct mp *pos,
+ struct file fm, struct file fb, struct file fa,
+ struct merge *m)
{
pos->o++;
while(1) {
}
/* step current position.p backwards */
-struct elmnt prev_melmnt(struct mp *pos,
- struct file fm, struct file fb, struct file fa,
- struct merge *m)
+static struct elmnt prev_melmnt(struct mp *pos,
+ struct file fm, struct file fb, struct file fa,
+ struct merge *m)
{
if (pos->s == 0) {
if (ends_mline(fm.list[m[pos->m].a + pos->o]))
* visible in this mode, but also chooses which colour/highlight to use
* to display it.
*/
-int visible(int mode, enum mergetype type, int stream)
+static int visible(int mode, enum mergetype type, int stream)
{
if (mode == 0) return -1;
/* mode can be any combination of ORIG RESULT BEFORE AFTER */
* WIGGLED
* CONFLICTED
*/
-int check_line(struct mpos pos, struct file fm, struct file fb, struct file fa,
- struct merge *m, int mode)
+static int check_line(struct mpos pos, struct file fm, struct file fb,
+ struct file fa,
+ struct merge *m, int mode)
{
int rv = 0;
struct elmnt e;
return rv;
}
-void next_mline(struct mpos *pos, struct file fm, struct file fb, struct file fa,
- struct merge *m, int mode)
+static void next_mline(struct mpos *pos, struct file fm, struct file fb,
+ struct file fa,
+ struct merge *m, int mode)
{
int mask;
do {
}
-void prev_mline(struct mpos *pos, struct file fm, struct file fb, struct file fa,
- struct merge *m, int mode)
+static void prev_mline(struct mpos *pos, struct file fm, struct file fb,
+ struct file fa,
+ struct merge *m, int mode)
{
int mask;
do {
}
/* blank a whole row of display */
-void blank(int row, int start, int cols, int attr)
+static void blank(int row, int start, int cols, int attr)
{
(void)attrset(attr);
move(row,start);
/* search of a string on one display line - just report if found, not where */
-int mcontains(struct mpos pos,
- struct file fm, struct file fb, struct file fa, struct merge *m,
- int mode, char *search)
+static int mcontains(struct mpos pos,
+ struct file fm, struct file fb, struct file fa,
+ struct merge *m,
+ int mode, char *search)
{
/* See if any of the files, between start of this line and here,
* contain the search string
* It is one of ORIG RESULT BEFORE AFTER or ORIG|RESULT or BEFORE|AFTER
* It may also have WIGGLED or CONFLICTED ored in
*/
-void draw_mside(int mode, int row, int offset, int start, int cols,
- struct file fm, struct file fb, struct file fa, struct merge *m,
- struct mpos pos,
- int target, int *colp)
+static void draw_mside(int mode, int row, int offset, int start, int cols,
+ struct file fm, struct file fb, struct file fa,
+ struct merge *m,
+ struct mpos pos,
+ int target, int *colp)
{
struct elmnt e;
int col = 0;
}
}
-void draw_mline(int mode, int row, int start, int cols,
- struct file fm, struct file fb, struct file fa,
- struct merge *m,
- struct mpos pos,
- int target, int *colp)
+static void draw_mline(int mode, int row, int start, int cols,
+ struct file fm, struct file fb, struct file fa,
+ struct merge *m,
+ struct mpos pos,
+ int target, int *colp)
{
/*
* Draw the left and right images of this line
fm,fb,fa,m, pos, target, colp);
}
-extern void cleanlist(struct file a, struct file b, struct csl *list);
-
-char *merge_help[] = {
+static char *merge_help[] = {
"This view shows a the merge of the patch with the",
"original file. It is like a full-context diff showing",
"removed lines with a '-' prefix and added lines with a",
"why there was a conflict",
NULL
};
-char *diff_help[] = {
+static char *diff_help[] = {
"This is the 'diff' or 'patch' view. It shows",
"only the patch that is being applied without the",
"original to which it is being applied.",
"original.",
NULL
};
-char *orig_help[] = {
+static char *orig_help[] = {
"This is the 'original' view which simple shows",
"the original file before applying the patch.",
"Sections of code that would be changed by the patch",
"are highlighted in red.",
NULL
};
-char *result_help[] = {
+static char *result_help[] = {
"This is the 'result' view which show just the",
"result of applying the patch. When a conflict",
"occurred this view does not show the full conflict",
"views.",
NULL
};
-char *before_help[] = {
+static char *before_help[] = {
"This view shows the 'before' section of a patch.",
"It allows the expected match text to be seen uncluttered",
"by text that is meant to replaced it."
"removed by the patch",
NULL
};
-char *after_help[] = {
+static char *after_help[] = {
"This view shows the 'after' section of a patch.",
"It allows the intended result to be seen uncluttered",
"by text that was meant to be matched and replaced."
"part of the patch",
NULL
};
-char *sidebyside_help[] = {
+static char *sidebyside_help[] = {
"This is the Side By Side view of a patched file.",
"The left side shows the original and the result.",
"The right side shows the patch which was applied",
"yellow family (depending on your terminal window).",
NULL
};
-char *merge_window_help[] = {
+static char *merge_window_help[] = {
" Highlight Colours and Keystroke commands",
"",
"In all different views of a merge, highlight colours",
" | display side-by-side view",
NULL
};
-void merge_window(struct plist *p, FILE *f, int reverse)
+
+static void merge_window(struct plist *p, FILE *f, int reverse)
{
/* display the merge in two side-by-side
* panes.
}
}
-void show_merge(char *origname, FILE *patch, int reverse, int is_merge,
- char *before, char *after)
+static void show_merge(char *origname, FILE *patch, int reverse,
+ int is_merge, char *before, char *after)
{
struct plist p;
merge_window(&p, patch, reverse);
}
-struct plist *patch_add_file(struct plist *pl, int *np, char *file,
- unsigned int start, unsigned int end)
+static struct plist *patch_add_file(struct plist *pl, int *np, char *file,
+ unsigned int start, unsigned int end)
{
/* size of pl is 0, 16, n^2 */
int n = *np;
return pl;
}
-struct plist *parse_patch(FILE *f, FILE *of, int *np)
+static struct plist *parse_patch(FILE *f, FILE *of, int *np)
{
/* read a multi-file patch from 'f' and record relevant
* details in a plist.
return s;
}
-
-int pl_cmp(const void *av, const void *bv)
+static int pl_cmp(const void *av, const void *bv)
{
const struct plist *a = av;
const struct plist *b = bv;
return strcmp(a->file, b->file);
}
-int common_depth(char *a, char *b)
+static int common_depth(char *a, char *b)
{
/* find number of path segments that these two have
* in common
}
}
-struct plist *add_dir(struct plist *pl, int *np, char *file, char *curr)
+static struct plist *add_dir(struct plist *pl, int *np, char *file, char *curr)
{
/* any parent of file that is not a parent of curr
* needs to be added to pl
return pl;
}
-struct plist *sort_patches(struct plist *pl, int *np)
+static struct plist *sort_patches(struct plist *pl, int *np)
{
/* sort the patches, add directory names, and re-sort */
char curr[1024];
* paths to find them from current directory. This is
* used to guess correct '-p' value.
*/
-int get_strip(char *file)
+static int get_strip(char *file)
{
int fd;
int strip = 0;
}
-int set_prefix(struct plist *pl, int n, int strip)
+static int set_prefix(struct plist *pl, int n, int strip)
{
int i;
for(i=0; i<4 && i<n && strip < 0; i++)
return 1;
}
-void calc_one(struct plist *pl, FILE *f, int reverse)
+static void calc_one(struct plist *pl, FILE *f, int reverse)
{
struct stream s1, s2;
struct stream s = load_segment(f, pl->start, pl->end);
pl->calced = 1;
}
-int get_prev(int pos, struct plist *pl, int n, int mode)
+static int get_prev(int pos, struct plist *pl, int n, int mode)
{
int found = 0;
if (pos == -1) return pos;
return pos;
}
-int get_next(int pos, struct plist *pl, int n, int mode,
+static int get_next(int pos, struct plist *pl, int n, int mode,
FILE *f, int reverse)
{
int found = 0;
return pos;
}
-
-void draw_one(int row, struct plist *pl, FILE *f, int reverse)
+static void draw_one(int row, struct plist *pl, FILE *f, int reverse)
{
char hdr[12];
hdr[0] = 0;
clrtoeol();
}
-char *main_help[] = {
+static char *main_help[] = {
" You are using the \"browse\" mode of wiggle.",
"This page shows a list of files in a patch together with",
"the directories that contain them.",
" C only list files with a conflict",
NULL
};
-void main_window(struct plist *pl, int n, FILE *f, int reverse)
+
+static void main_window(struct plist *pl, int n, FILE *f, int reverse)
{
/* The main window lists all files together with summary information:
* number of chunks, number of wiggles, number of conflicts.
}
}
-
-
-void catch(int sig)
+static void catch(int sig)
{
if (sig == SIGINT) {
signal(sig, catch);
}
/* use stderr for keyboard input */
dup2(2,0);
+ if (set_prefix(pl, num_patches, strip) == 0) {
+ fprintf(stderr, "%s: aborting\n", Cmd);
+ exit(2);
+ }
main_window(pl, num_patches, in, reverse);
break;
}
if (patch) {
pl = parse_patch(f, NULL, &num_patches);
+ if (set_prefix(pl, num_patches, strip) == 0) {
+ fprintf(stderr, "%s: aborting\n", Cmd);
+ exit(2);
+ }
main_window(pl, num_patches, f, reverse);
} else if (strlen(argv[0]) > 4 &&
strcmp(argv[0]+strlen(argv[0])-4, ".rej") == 0) {