-
Notifications
You must be signed in to change notification settings - Fork 23
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
80 additions
and
5 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
bin/* | ||
cat | ||
cmp | ||
coreutils/* | ||
diff | ||
etc/* | ||
|
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,57 @@ | ||
#!/usr/bin/env bash | ||
#!dgsh | ||
# | ||
# Dgsh-compatible wrapping of the GNU cmp command | ||
# Depending on the arguments, the command can accept 0-2 inputs | ||
# | ||
|
||
|
||
oopt='' | ||
|
||
# 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=":bi:ln:sv-:" | ||
while getopts "$optspec" optchar; do | ||
case "${optchar}" in | ||
-) | ||
case "${OPTARG}" in | ||
quiet) | ||
oopt='-o 0' | ||
;; | ||
silent) | ||
oopt='-o 0' | ||
;; | ||
esac | ||
;; | ||
s) | ||
oopt='-o 0' | ||
;; | ||
esac | ||
done | ||
|
||
# Examine the number of remaining (non-option) arguments | ||
case $(($# - $OPTIND + 1)) in | ||
0) | ||
# Exactly two inputs are required | ||
exec dgsh-wrap $oopt /usr/bin/cmp "$@" '<|' '<|' | ||
;; | ||
1) | ||
if [[ "${!OPTIND}" == '-' ]] ; then | ||
# One (non-stdin) input is required | ||
exec dgsh-wrap -I $oopt /usr/bin/cmp "$@" '<|' | ||
else | ||
# One (stdin) input is required | ||
exec dgsh-wrap $oopt /usr/bin/cmp "$@" - | ||
fi | ||
;; | ||
*) | ||
ARG2=$((OPTIND + 1)) | ||
if [[ "${!OPTIND}" == '-' ]] || [[ "${!ARG2}" == '-' ]] ; then | ||
# One (stdin) input is required | ||
exec dgsh-wrap /usr/bin/cmp $oopt "$@" | ||
else | ||
# No input is required | ||
exec dgsh-wrap -i 0 /usr/bin/cmp $oopt "$@" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ dm chgrp | |
dm chmod | ||
dm chown | ||
D cksum | ||
D cmp | ||
c cmp | ||
c comm | ||
d command | ||
f compress # TODO custom | ||
|
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