diff options
author | bapt <bapt@FreeBSD.org> | 2016-10-22 13:15:19 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2016-10-22 13:15:19 +0000 |
commit | ea479f6f8bfe2c8710c8cc864aafd2973c4cfb03 (patch) | |
tree | 57d7bfba7d466264b94ee2acfd553c40d6789656 /usr.bin | |
parent | 7237ecd817a1dd804265db11b20878ce7fbb9ad0 (diff) | |
download | FreeBSD-src-ea479f6f8bfe2c8710c8cc864aafd2973c4cfb03.zip FreeBSD-src-ea479f6f8bfe2c8710c8cc864aafd2973c4cfb03.tar.gz |
MFC: 307368,307369,307372,307381
Remove the common.h include which is actually not used in sdiff.c
Turn editit into a static function
Move cleanup() into the edit.c file which is the only users of that function
Remove common.{c,h}
Fix typos in sdiff(1) message and improve display
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sdiff/Makefile | 2 | ||||
-rw-r--r-- | usr.bin/sdiff/common.c | 24 | ||||
-rw-r--r-- | usr.bin/sdiff/common.h | 9 | ||||
-rw-r--r-- | usr.bin/sdiff/edit.c | 12 | ||||
-rw-r--r-- | usr.bin/sdiff/sdiff.c | 38 |
5 files changed, 29 insertions, 56 deletions
diff --git a/usr.bin/sdiff/Makefile b/usr.bin/sdiff/Makefile index 504adc2..f4772cc 100644 --- a/usr.bin/sdiff/Makefile +++ b/usr.bin/sdiff/Makefile @@ -3,7 +3,7 @@ .include <src.opts.mk> PROG= sdiff -SRCS= common.c edit.c sdiff.c +SRCS= edit.c sdiff.c WARNS= 3 MAN1= sdiff.1 diff --git a/usr.bin/sdiff/common.c b/usr.bin/sdiff/common.c deleted file mode 100644 index 686965c..0000000 --- a/usr.bin/sdiff/common.c +++ /dev/null @@ -1,24 +0,0 @@ -/* $OpenBSD: common.c,v 1.4 2006/05/25 03:20:32 ray Exp $ */ - -/* - * Written by Raymond Lai <ray@cyth.net>. - * Public domain. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <err.h> -#include <stdlib.h> -#include <unistd.h> - -#include "common.h" - -void -cleanup(const char *filename) -{ - - if (unlink(filename)) - err(2, "could not delete: %s", filename); - exit(2); -} diff --git a/usr.bin/sdiff/common.h b/usr.bin/sdiff/common.h deleted file mode 100644 index 127c1f4..0000000 --- a/usr.bin/sdiff/common.h +++ /dev/null @@ -1,9 +0,0 @@ -/* $OpenBSD: common.h,v 1.2 2006/05/25 03:20:32 ray Exp $ */ -/* $FreeBSD$ */ - -/* - * Written by Raymond Lai <ray@cyth.net>. - * Public domain. - */ - -void cleanup(const char *) __dead2; diff --git a/usr.bin/sdiff/edit.c b/usr.bin/sdiff/edit.c index 21f7cdc..993b515 100644 --- a/usr.bin/sdiff/edit.c +++ b/usr.bin/sdiff/edit.c @@ -21,10 +21,16 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> -#include "common.h" #include "extern.h" -int editit(const char *); +static void +cleanup(const char *filename) +{ + + if (unlink(filename)) + err(2, "could not delete: %s", filename); + exit(2); +} /* * Execute an editor on the specified pathname, which is interpreted @@ -32,7 +38,7 @@ int editit(const char *); * * Returns -1 on error, or the exit value on success. */ -int +static int editit(const char *pathname) { sig_t sighup, sigint, sigquit, sigchld; diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c index 008de53..8337e46 100644 --- a/usr.bin/sdiff/sdiff.c +++ b/usr.bin/sdiff/sdiff.c @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> -#include "common.h" #include "extern.h" #define DIFF_PATH "/usr/bin/diff" @@ -144,24 +143,25 @@ static struct option longopts[] = { }; static const char *help_msg[] = { - "\nusage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n", - "\t-l, --left-column, Only print the left column for identical lines.", - "\t-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.", - "\t-s, --suppress-common-lines, Skip identical lines.", - "\t-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.", - "\tOptions passed to diff(1) are:", - "\t\t-a, --text, Treat file1 and file2 as text files.", - "\t\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.", - "\t\t-d, --minimal, Minimize diff size.", - "\t\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.", - "\t\t-i, --ignore-case, Do a case-insensitive comparison.", - "\t\t-t, --expand-tabs Expand tabs to spaces.", - "\t\t-W, --ignore-all-spaces, Ignore all spaces.", - "\t\t--speed-large-files, Assume large file with scattered changes.", - "\t\t--strip-trailing-cr, Strip trailing carriage return.", - "\t\t--ignore-file-name-case, Ignore case of file names.", - "\t\t--no-ignore-file-name-case, Do not ignore file name case", - "\t\t--tabsize NUM, Change size of tabs (default 8.)", + "usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n", + "-l, --left-column: only print the left column for identical lines.", + "-o OUTFILE, --output=OUTFILE: interactively merge file1 and file2 into outfile.", + "-s, --suppress-common-lines: skip identical lines.", + "-w WIDTH, --width=WIDTH: print a maximum of WIDTH characters on each line.", + "", + "Options passed to diff(1) are:", + "\t-a, --text: treat file1 and file2 as text files.", + "\t-b, --ignore-trailing-cr: ignore trailing blank spaces.", + "\t-d, --minimal: minimize diff size.", + "\t-I RE, --ignore-matching-lines=RE: ignore changes whose line matches RE.", + "\t-i, --ignore-case: do a case-insensitive comparison.", + "\t-t, --expand-tabs: sxpand tabs to spaces.", + "\t-W, --ignore-all-spaces: ignore all spaces.", + "\t--speed-large-files: assume large file with scattered changes.", + "\t--strip-trailing-cr: strip trailing carriage return.", + "\t--ignore-file-name-case: ignore case of file names.", + "\t--no-ignore-file-name-case: do not ignore file name case", + "\t--tabsize NUM: change size of tabs (default 8.)", NULL, }; |