-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
117 additions
and
4 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
====3 | ||
1:0a | ||
2:0a | ||
3:1c | ||
a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
==== | ||
1:1,2c | ||
a | ||
b | ||
2:0a | ||
3:1c | ||
b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
====2 | ||
1:1c | ||
3:1c | ||
b | ||
2:1c | ||
a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
====2 | ||
1:1c | ||
3:1c | ||
b | ||
2:1c | ||
a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
==== | ||
1:1,2c | ||
a | ||
c | ||
2:1c | ||
b | ||
3:1c | ||
c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ cat | |
cmp | ||
coreutils/* | ||
diff | ||
diff3 | ||
etc/* | ||
gawk/* | ||
gnulib/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env bash | ||
#!dgsh | ||
# | ||
# Dgsh-compatible wrapping of the GNU diff3 command | ||
# Depending on the arguments, the command can accept 0-3 inputs | ||
# | ||
|
||
|
||
# For the parsing of long options see | ||
# https://stackoverflow.com/questions/402377/using-getopts-in-bash-shell-script-to-get-long-and-short-command-line-options/7680682#7680682 | ||
optspec=":AeE3xXimaTL:v-:" | ||
while getopts "$optspec" optchar; do | ||
case "${optchar}" in | ||
-) | ||
case "${OPTARG}" in | ||
# Long options with mandatory arguments. In these the argument | ||
# can appear separated from the option name, and must be removed. | ||
diff-program|label) | ||
OPTIND=$(($OPTIND + 1)) | ||
;; | ||
esac | ||
;; | ||
esac | ||
done | ||
|
||
# Examine the number of remaining (non-option) arguments | ||
case $(($# - $OPTIND + 1)) in | ||
0) | ||
# Exactly three inputs are required | ||
exec dgsh-wrap /usr/bin/diff3 "$@" '<|' '<|' '<|' | ||
;; | ||
1) | ||
if [[ "${!OPTIND}" = '-' ]] ; then | ||
# Two inputs (excluding stdin) are required | ||
exec dgsh-wrap -I /usr/bin/diff3 "$@" '<|' '<|' | ||
else | ||
# Two inputs (including stdin) are required | ||
exec dgsh-wrap /usr/bin/diff3 "$@" '<|' '<|' | ||
fi | ||
;; | ||
2) | ||
ARG2=$((OPTIND + 1)) | ||
if [[ "${!OPTIND}" = '-' ]] || [[ "${!ARG2}" = '-' ]] ; then | ||
# One (non-stdin) input is required | ||
exec dgsh-wrap -I /usr/bin/diff3 "$@" '<|' | ||
else | ||
# One (stdin) input is required | ||
exec dgsh-wrap /usr/bin/diff3 "$@" - | ||
fi | ||
;; | ||
*) | ||
ARG2=$((OPTIND + 1)) | ||
ARG3=$((OPTIND + 2)) | ||
if [[ "${!OPTIND}" = '-' ]] || [[ "${!ARG2}" = '-' ]] || [[ "${!ARG3}" = '-' ]] ; then | ||
# One (stdin) input is required | ||
exec dgsh-wrap /usr/bin/diff3 "$@" | ||
else | ||
# No input is required | ||
exec dgsh-wrap -i 0 /usr/bin/diff3 "$@" | ||
fi | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters