From 2244542e6c1a4702dcd726a290782115a82a52c4 Mon Sep 17 00:00:00 2001 From: voroskoi Date: Sun, 4 May 2008 20:34:31 +0200 Subject: [PATCH] add option -v Display version information when -v is in arguments --- usr.bin/diff/diff.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index d6efb5d89..6d25a12c3 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -49,7 +49,7 @@ struct stat stb1, stb2; struct excludes *excludes_list; regex_t ignore_re; -#define OPTIONS "0123456789abC:cdD:efhI:iL:lnNPpqrS:sTtU:uwX:x:" +#define OPTIONS "0123456789abC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwX:x:" static struct option longopts[] = { { "text", no_argument, 0, 'a' }, { "ignore-space-change", no_argument, 0, 'b' }, @@ -84,6 +84,7 @@ void push_excludes(char *); void push_ignore_pats(char *); void read_excludes_file(char *file); void set_argstr(char **, char **); +void version(void); int main(int argc, char **argv) @@ -202,6 +203,9 @@ main(int argc, char **argv) } else context = 3; break; + case 'v': + version(); + exit(0); case 'w': wflag = 1; break; @@ -416,3 +420,13 @@ usage(void) exit(2); } + +void +version(void) +{ + (void)fprintf(stdout, + "diff utility for DragonFly BSD.\n" + "Originally written for OpenBSD by Todd C. Miller.\n" + "\n" + "(C) 2003 Todd C. Miller\n"); +} -- 2.11.4.GIT