--- old/usr/src/cmd/egrep/egrep.y	2013-05-30 19:29:52.419131806 +0200
+++ new/usr/src/cmd/egrep/egrep.y	2013-05-30 19:29:52.439669268 +0200
@@ -32,9 +32,9 @@
 /*	Copyright (c) 1987, 1988 Microsoft Corporation	*/
 /*	  All Rights Reserved	*/
 
-%{
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-%}
+/*
+ * Copyright 2013 Damian Bogel. All rights reserved.
+ */
 
 /*
  * egrep -- print lines containing (or not containing) a regular expression
@@ -61,6 +61,8 @@
 #include <limits.h>
 #include <locale.h>
 
+#define STDIN_FILENAME gettext("(standard input)")
+
 #define BLKSIZE 512	/* size of reported disk blocks */
 #define EBUFSIZ 8192
 #define MAXLIN 350
@@ -110,11 +112,12 @@
 int	cflag;
 int	eflag;
 int	fflag;
+int	Hflag;
 int	hflag;
 int	iflag;
 int	lflag;
 int	nflag;
-int	sflag;
+int	qflag;
 int	vflag;
 int	nfile;
 long long blkno;
@@ -660,7 +663,7 @@
 #endif
 	(void) textdomain(TEXT_DOMAIN);
 
-	while((c = getopt(argc, argv, "ybcie:f:hlnvs")) != -1)
+	while((c = getopt(argc, argv, "ybcie:f:Hhlnvs")) != -1)
 		switch(c) {
 
 		case 'b':
@@ -686,8 +689,15 @@
 			}
 			continue;
 
+		case 'H':
+			if (!lflag) /* H is excluded by l as in GNU grep */
+				Hflag++;
+			hflag = 0; /* H excludes h */
+			continue;
+
 		case 'h':
 			hflag++;
+			Hflag = 0; /* h excludes H */
 			continue;
 
 		case 'y':
@@ -697,14 +707,16 @@
 
 		case 'l':
 			lflag++;
+			Hflag = 0; /* l excludes H */
 			continue;
 
 		case 'n':
 			nflag++;
 			continue;
 
-		case 's':
-			sflag++;
+		case 'q':
+		case 's': /* Solaris: legacy option */
+			qflag++;
 			continue;
 
 		case 'v':
@@ -799,16 +811,16 @@
 			return;
 		}
 	} else {
-		file = "<stdin>";
 		f = stdin;
+		file = STDIN_FILENAME;
 	}
 	lnum = 1;
 	tln = 0;
 	if((count = read(fileno(f), buf, EBUFSIZ)) <= 0) {
 		fclose(f);
 
-		if (cflag) {
-			if (nfile>1 && !hflag)
+		if (cflag && !qflag) {
+			if (Hflag || (nfile > 1 && !hflag))
 				fprintf(stdout, "%s:", file);
 			fprintf(stdout, "%lld\n", tln);
 		}
@@ -902,19 +914,19 @@
 				break;
 			}
 		}
-		if(succ) {
+		if (succ) {
 			nsucc = 1;
-			if (cflag) tln++;
-			else if (sflag)
-				;	/* ugh */
-			else if (lflag) {
-				printf("%s\n", file);
+			if (lflag || qflag) {
+				if (!qflag)
+					(void) printf("%s\n", file);
 				fclose(f);
 				return;
 			}
-			else {
-				if (nfile > 1 && !hflag) 
-					printf(gettext("%s:"), file);
+			if (cflag) {
+				tln++;
+			} else {
+				if (Hflag || (nfile > 1 && !hflag))
+					printf("%s:", file);
 				if (bflag) {
 					nchars = blkno - (buf + count - ptrend) - 2;
 					if(nlflag)
@@ -944,9 +956,9 @@
 			clearg();
 	}
 	fclose(f);
-	if (cflag) {
-		if (nfile > 1 && !hflag)
-			printf(gettext("%s:"), file);
+	if (cflag && !qflag) {
+		if (Hflag || (nfile > 1 && !hflag))
+			printf("%s:", file);
 		printf("%lld\n", tln);
 	}
 }
--- old/usr/src/cmd/fgrep/fgrep.c	2013-05-30 19:29:52.687624812 +0200
+++ new/usr/src/cmd/fgrep/fgrep.c	2013-05-30 19:29:52.699881367 +0200
@@ -30,7 +30,9 @@
 /*	Copyright (c) 1987, 1988 Microsoft Corporation	*/
 /*	  All Rights Reserved	*/
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright 2013 Damian Bogel. All rights reserved.
+ */
 
 /*
  * fgrep -- print all lines containing any of a set of keywords
@@ -107,6 +109,7 @@
 	(a == b || iflag && (!MULTI_BYTE || ISASCII(a)) && (a ^ b) == ' ' && \
 	letter(a) == letter(b))
 
+#define	STDIN_FILENAME gettext("(standard input)")
 
 #define	QSIZE 400
 struct words {
@@ -119,8 +122,8 @@
 
 FILE *fptr;
 long long lnum;
-int	bflag, cflag, lflag, fflag, nflag, vflag, xflag, eflag, sflag;
-int	hflag, iflag;
+int	bflag, cflag, lflag, fflag, nflag, vflag, xflag, eflag, qflag;
+int	Hflag, hflag, iflag;
 int	retcode = 0;
 int	nfile;
 long long blkno;
@@ -150,14 +153,20 @@
 #endif
 	(void) textdomain(TEXT_DOMAIN);
 
-	while ((c = getopt(argc, argv, "hybcie:f:lnvxs")) != EOF)
+	while ((c = getopt(argc, argv, "Hhybcie:f:lnvxqs")) != EOF)
 		switch (c) {
 
-		case 's':
-			sflag++;
+		case 'q':
+		case 's': /* Solaris: legacy option */
+			qflag++;
+			continue;
+		case 'H':
+			Hflag++;
+			hflag = 0;
 			continue;
 		case 'h':
 			hflag++;
+			Hflag = 0;
 			continue;
 		case 'b':
 			bflag++;
@@ -221,7 +230,7 @@
 
 	argc -= optind;
 	if (errflg || ((argc <= 0) && !fflag && !eflag)) {
-		(void) printf(gettext("usage: fgrep [ -bchilnsvx ] "
+		(void) printf(gettext("usage: fgrep [ -bcHhilnqsvx ] "
 			"[ -e exp ] [ -f file ] [ strings ] [ file ] ...\n"));
 		exit(2);
 	}
@@ -313,8 +322,8 @@
 			return;
 		}
 	} else {
-		file = "<stdin>";
 		fptr = stdin;
+		file = STDIN_FILENAME;
 	}
 	ccount = 0;
 	failed = 0;
@@ -417,14 +426,16 @@
 				goto nomatch;
 succeed:
 			nsucc = 1;
-			if (cflag)
-				tln++;
-			else if (lflag && !sflag) {
-				(void) printf("%s\n", file);
+			if (lflag || qflag) {
+				if (!qflag)
+					(void) printf("%s\n", file);
 				(void) fclose(fptr);
 				return;
-			} else if (!sflag) {
-				if (nfile > 1 && !hflag)
+			}
+			if (cflag) {
+				tln++;
+			} else {
+				if (Hflag || (nfile > 1 && !hflag))
 					(void) printf("%s:", file);
 				if (bflag)
 					(void) printf("%lld:",
@@ -458,8 +469,8 @@
 			}
 	}
 	(void) fclose(fptr);
-	if (cflag) {
-		if ((nfile > 1) && !hflag)
+	if (cflag && !qflag) {
+		if (Hflag || (nfile > 1 && !hflag))
 			(void) printf("%s:", file);
 		(void) printf("%lld\n", tln);
 	}
--- old/usr/src/cmd/grep/grep.c	2013-05-30 19:29:52.868438362 +0200
+++ new/usr/src/cmd/grep/grep.c	2013-05-30 19:29:52.891079357 +0200
@@ -33,6 +33,10 @@
 /* Copyright 2012 Nexenta Systems, Inc.  All rights reserved. */
 
 /*
+ * Copyright 2013 Damian Bogel. All rights reserved.
+ */
+
+/*
  * grep -- print lines matching (or not matching) a pattern
  *
  *	status returns:
@@ -73,6 +77,8 @@
 	NULL
 };
 
+#define	STDIN_FILENAME	gettext("(standard input)")
+
 #define	errmsg(msg, arg)	(void) fprintf(stderr, gettext(msg), arg)
 #define	BLKSIZE	512
 #define	GBUFSIZ	8192
@@ -94,6 +100,7 @@
 static int	iflag;
 static int	wflag;
 static int	hflag;
+static int 	Hflag;
 static int	qflag;
 static int	errflg;
 static int	nfile;
@@ -123,10 +130,17 @@
 #endif
 	(void) textdomain(TEXT_DOMAIN);
 
-	while ((c = getopt(argc, argv, "hqblcnRrsviyw")) != -1)
+	while ((c = getopt(argc, argv, "hHqblcnRrsviyw")) != -1)
 		switch (c) {
+		/* based on options order h or H is set as in GNU grep */
 		case 'h':
 			hflag++;
+			Hflag = 0; /* h excludes H */
+			break;
+		case 'H':
+			if (!lflag) /* H is excluded by l */
+				Hflag++;
+			hflag = 0; /* H excludes h */
 			break;
 		case 'q':	/* POSIX: quiet: status only */
 			qflag++;
@@ -154,6 +168,7 @@
 			break;
 		case 'l':
 			lflag++;
+			Hflag = 0; /* l excludes H */
 			break;
 		case 'y':
 		case 'i':
@@ -167,7 +182,7 @@
 		}
 
 	if (errflg || (optind >= argc)) {
-		errmsg("Usage: grep [-c|-l|-q] [-r|-R] -hbnsviw "
+		errmsg("Usage: grep [-c|-l|-q] [-r|-R] -hHbnsviw "
 		    "pattern file . . .\n",
 		    (char *)NULL);
 		exit(2);
@@ -299,9 +314,10 @@
 		}
 	}
 
-	if (file == NULL)
+	if (file == NULL) {
 		temp = 0;
-	else if ((temp = open(file + base, O_RDONLY)) == -1) {
+		file = STDIN_FILENAME;
+	} else if ((temp = open(file + base, O_RDONLY)) == -1) {
 		if (!sflag)
 			errmsg("grep: can't open %s\n", file);
 		nsucc = 2;
@@ -313,7 +329,7 @@
 		(void) close(temp);
 
 		if (cflag && !qflag) {
-			if (nfile > 1 && !hflag && file)
+			if (Hflag || (nfile > 1 && !hflag))
 				(void) fprintf(stdout, "%s:", file);
 			if (!rflag)
 			(void) fprintf(stdout, "%lld\n", tln);
@@ -410,8 +426,8 @@
 	(void) close(temp);
 
 	if (cflag && !qflag) {
-		if (!hflag && file && (nfile > 1 ||
-		    (rflag && outfn)))
+		if (Hflag || (!hflag && ((nfile > 1) ||
+		    (rflag && outfn))))
 			(void) fprintf(stdout, "%s:", file);
 		(void) fprintf(stdout, "%lld\n", tln);
 	}
@@ -423,9 +439,6 @@
 	int nchars;
 	nsucc = (nsucc == 2) ? 2 : 1;
 
-	if (f == NULL)
-		f = "<stdin>";
-
 	if (qflag) {
 		/* no need to continue */
 		return (1);
@@ -441,7 +454,7 @@
 		return (1);
 	}
 
-	if (!hflag && (nfile > 1 || (rflag && outfn))) {
+	if (Hflag || (!hflag && (nfile > 1 || (rflag && outfn)))) {
 		/* print filename */
 		(void) fprintf(stdout, "%s:", f);
 	}
--- old/usr/src/cmd/grep_xpg4/grep.c	2013-05-30 19:29:53.037945658 +0200
+++ new/usr/src/cmd/grep_xpg4/grep.c	2013-05-30 19:29:53.044231245 +0200
@@ -36,6 +36,10 @@
 
 /* Copyright 2012 Nexenta Systems, Inc.  All rights reserved. */
 
+/*
+ * Copyright 2013 Damian Bogel. All rights reserved.
+ */
+
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -54,6 +58,8 @@
 #include <ftw.h>
 #include <sys/param.h>
 
+#define	STDIN_FILENAME gettext("(standard input)")
+
 #define	BSIZE		512		/* Size of block for -b */
 #define	BUFSIZE		8192		/* Input buffer size */
 #define	MAX_DEPTH	1000		/* how deep to recurse */
@@ -80,6 +86,7 @@
 static uchar_t	nvflag = 1;		/* Print matching lines */
 static uchar_t	cflag;			/* Count of matches */
 static uchar_t	iflag;			/* Case insensitve matching */
+static uchar_t	Hflag;			/* Precede lines by file name */
 static uchar_t	hflag;			/* Supress printing of filename */
 static uchar_t	lflag;			/* Print file names of matches */
 static uchar_t	nflag;			/* Precede lines by line number */
@@ -155,7 +162,7 @@
 		}
 	}
 
-	while ((c = getopt(argc, argv, "vwchilnrbse:f:qxEFIR")) != EOF) {
+	while ((c = getopt(argc, argv, "vwchHilnrbse:f:qxEFIR")) != EOF) {
 		switch (c) {
 		case 'v':	/* POSIX: negate matches */
 			nvflag = 0;
@@ -216,8 +223,16 @@
 			}
 			*(file_list + n_file - 1) = optarg;
 			break;
+
+		/* based on options order h or H is set as in GNU grep */
 		case 'h':	/* Solaris: supress printing of file name */
 			hflag = 1;
+			Hflag = 0;
+			break;
+		/* Solaris: precede every matching with file name */
+		case 'H':
+			Hflag = 1;
+			hflag = 0;
 			break;
 
 		case 'q':	/* POSIX: quiet: status only */
@@ -294,6 +309,12 @@
 		usage();
 
 	/*
+	 * -l overrides -H like in GNU grep
+	 */
+	if (lflag)
+		Hflag = 0;
+
+	/*
 	 * -c, -l and -q flags are mutually exclusive
 	 * We have -c override -l like in Solaris.
 	 * -q overrides -l & -c programmatically in grep() function.
@@ -346,9 +367,9 @@
 
 	/* Process all files: stdin, or rest of arg list */
 	if (argc < 2) {
-		matched = grep(0, gettext("(standard input)"));
+		matched = grep(0, STDIN_FILENAME);
 	} else {
-		if (argc > 2 && hflag == 0)
+		if (Hflag || (argc > 2 && hflag == 0))
 			outfn = 1;	/* Print filename on match line */
 		for (argv++; *argv != NULL; argv++) {
 			process_path(*argv);
@@ -1112,7 +1133,7 @@
 				break;
 			}
 			if (!cflag) {
-				if (outfn) {
+				if (Hflag || outfn) {
 					(void) printf("%s:", fn);
 				}
 				if (bflag) {
@@ -1139,7 +1160,7 @@
 	}
 
 	if (cflag) {
-		if (outfn) {
+		if (Hflag || outfn) {
 			(void) printf("%s:", fn);
 		}
 		if (!qflag) {
@@ -1158,45 +1179,45 @@
 	if (egrep || fgrep) {
 		(void) fprintf(stderr, gettext("Usage:\t%s"), cmdname);
 		(void) fprintf(stderr,
-		    gettext(" [-c|-l|-q] [-r|-R] [-bhinsvx] "
+		    gettext(" [-c|-l|-q] [-r|-R] [-bhHinsvx] "
 		    "pattern_list [file ...]\n"));
 
 		(void) fprintf(stderr, "\t%s", cmdname);
 		(void) fprintf(stderr,
-		    gettext(" [-c|-l|-q] [-r|-R] [-bhinsvx] "
+		    gettext(" [-c|-l|-q] [-r|-R] [-bhHinsvx] "
 		    "[-e pattern_list]... "
 		    "[-f pattern_file]... [file...]\n"));
 	} else {
 		(void) fprintf(stderr, gettext("Usage:\t%s"), cmdname);
 		(void) fprintf(stderr,
-		    gettext(" [-c|-l|-q] [-r|-R] [-bhinsvwx] "
+		    gettext(" [-c|-l|-q] [-r|-R] [-bhHinsvwx] "
 		    "pattern_list [file ...]\n"));
 
 		(void) fprintf(stderr, "\t%s", cmdname);
 		(void) fprintf(stderr,
-		    gettext(" [-c|-l|-q] [-r|-R] [-bhinsvwx] "
+		    gettext(" [-c|-l|-q] [-r|-R] [-bhHinsvwx] "
 		    "[-e pattern_list]... "
 		    "[-f pattern_file]... [file...]\n"));
 
 		(void) fprintf(stderr, "\t%s", cmdname);
 		(void) fprintf(stderr,
-		    gettext(" -E [-c|-l|-q] [-r|-R] [-bhinsvx] "
+		    gettext(" -E [-c|-l|-q] [-r|-R] [-bhHinsvx] "
 		    "pattern_list [file ...]\n"));
 
 		(void) fprintf(stderr, "\t%s", cmdname);
 		(void) fprintf(stderr,
-		    gettext(" -E [-c|-l|-q] [-r|-R] [-bhinsvx] "
+		    gettext(" -E [-c|-l|-q] [-r|-R] [-bhHinsvx] "
 		    "[-e pattern_list]... "
 		    "[-f pattern_file]... [file...]\n"));
 
 		(void) fprintf(stderr, "\t%s", cmdname);
 		(void) fprintf(stderr,
-		    gettext(" -F [-c|-l|-q] [-r|-R] [-bhinsvx] "
+		    gettext(" -F [-c|-l|-q] [-r|-R] [-bhHinsvx] "
 		    "pattern_list [file ...]\n"));
 
 		(void) fprintf(stderr, "\t%s", cmdname);
 		(void) fprintf(stderr,
-		    gettext(" -F [-c|-l|-q] [-bhinsvx] [-e pattern_list]... "
+		    gettext(" -F [-c|-l|-q] [-bhHinsvx] [-e pattern_list]... "
 		    "[-f pattern_file]... [file...]\n"));
 	}
 	exit(2);
--- old/usr/src/man/man1/egrep.1	2013-05-30 19:29:53.210894290 +0200
+++ new/usr/src/man/man1/egrep.1	2013-05-30 19:29:53.216936693 +0200
@@ -9,40 +9,40 @@
 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH EGREP 1 "Mar 24, 2006"
+.TH EGREP 1 "May 3, 2013"
 .SH NAME
 egrep \- search a file for a pattern using full regular expressions
 .SH SYNOPSIS
 .LP
 .nf
-\fB/usr/bin/egrep\fR [\fB-bchilnsv\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
+\fB/usr/bin/egrep\fR [\fB-bcHhilnqsv\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/bin/egrep\fR [\fB-bchilnsv\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
+\fB/usr/bin/egrep\fR [\fB-bcHhilnqsv\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/bin/egrep\fR [\fB-bchilnsv\fR] \fIpattern\fR [\fIfile...\fR]
+\fB/usr/bin/egrep\fR [\fB-bcHhilnqsv\fR] \fIpattern\fR [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/xpg4/bin/egrep\fR [\fB-bchilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
+\fB/usr/xpg4/bin/egrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
      [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/xpg4/bin/egrep\fR [\fB-bchilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
+\fB/usr/xpg4/bin/egrep\fR [\fB-bcHhilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
      [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/xpg4/bin/egrep\fR [\fB-bchilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
+\fB/usr/xpg4/bin/egrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
 .fi
 
 .SH DESCRIPTION
@@ -151,6 +151,15 @@
 .sp
 .ne 2
 .na
+\fB\fB-H\fR\fR
+.ad
+.RS 19n
+Precedes each line by the name of the file containing the matching line.
+.RE
+
+.sp
+.ne 2
+.na
 \fB\fB-h\fR\fR
 .ad
 .RS 19n
@@ -188,11 +197,20 @@
 .sp
 .ne 2
 .na
+\fB\fB-q\fR\fR
+.ad
+.RS 19n
+Quiet. Does not write anything to the standard output, regardless of matching
+lines. Exits with zero status if an input line is selected.
+.RE
+
+.sp
+.ne 2
+.na
 \fB\fB-s\fR\fR
 .ad
 .RS 19n
-Work silently, that is, display nothing except error messages. This is useful
-for checking the error status.
+Legacy equivalent of \fB-q\fR.
 .RE
 
 .sp
@@ -211,16 +229,6 @@
 .sp
 .ne 2
 .na
-\fB\fB-q\fR\fR
-.ad
-.RS 6n
-Quiet. Does not write anything to the standard output, regardless of matching
-lines. Exits with zero status if an input line is selected.
-.RE
-
-.sp
-.ne 2
-.na
 \fB\fB-x\fR\fR
 .ad
 .RS 6n
--- old/usr/src/man/man1/fgrep.1	2013-05-30 19:29:53.357812696 +0200
+++ new/usr/src/man/man1/fgrep.1	2013-05-30 19:29:53.362783920 +0200
@@ -9,40 +9,40 @@
 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH FGREP 1 "Mar 24, 2006"
+.TH FGREP 1 "May 3, 2013"
 .SH NAME
 fgrep \- search a file for a fixed-character string
 .SH SYNOPSIS
 .LP
 .nf
-\fB/usr/bin/fgrep\fR [\fB-bchilnsvx\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
+\fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/bin/fgrep\fR [\fB-bchilnsvx\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
+\fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/bin/fgrep\fR [\fB-bchilnsvx\fR] \fIpattern\fR [\fIfile...\fR]
+\fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/xpg4/bin/fgrep\fR [\fB-bchilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
+\fB/usr/xpg4/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
      [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/xpg4/bin/fgrep\fR [\fB-bchilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
+\fB/usr/xpg4/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
      [\fIfile...\fR]
 .fi
 
 .LP
 .nf
-\fB/usr/xpg4/bin/fgrep\fR [\fB-bchilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
+\fB/usr/xpg4/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
 .fi
 
 .SH DESCRIPTION
@@ -111,6 +111,15 @@
 .sp
 .ne 2
 .na
+\fB\fB-H\fR\fR
+.ad
+.RS 19n
+Precedes each line by the name of the file containing the matching line.
+.RE
+
+.sp
+.ne 2
+.na
 \fB\fB-h\fR\fR
 .ad
 .RS 19n
@@ -148,43 +157,38 @@
 .sp
 .ne 2
 .na
-\fB\fB-s\fR\fR
+\fB\fB-q\fR\fR
 .ad
 .RS 19n
-Works silently, that is, displays nothing except error messages. This is useful
-for checking the error status.
+Quiet. Does not write anything to the standard output, regardless of matching
+lines. Exits with zero status if an input line is selected.
 .RE
 
 .sp
 .ne 2
 .na
-\fB\fB-v\fR\fR
+\fB\fB-s\fR\fR
 .ad
 .RS 19n
-Prints all lines except those that contain the pattern.
+Legacy equivalent of \fB-q\fR.
 .RE
 
 .sp
 .ne 2
 .na
-\fB\fB-x\fR\fR
+\fB\fB-v\fR\fR
 .ad
 .RS 19n
-Prints only lines that are matched entirely.
+Prints all lines except those that contain the pattern.
 .RE
 
-.SS "/usr/xpg4/bin/fgrep"
-.sp
-.LP
-The following options are supported for \fB/usr/xpg4/bin/fgrep\fR only:
 .sp
 .ne 2
 .na
-\fB\fB-q\fR\fR
+\fB\fB-x\fR\fR
 .ad
-.RS 6n
-Quiet. Does not write anything to the standard output, regardless of matching
-lines. Exits with zero status if an input line is selected.
+.RS 19n
+Prints only lines that are matched entirely.
 .RE
 
 .SH OPERANDS
--- old/usr/src/man/man1/grep.1	2013-05-30 19:29:53.507343646 +0200
+++ new/usr/src/man/man1/grep.1	2013-05-30 19:29:53.512421242 +0200
@@ -10,34 +10,34 @@
 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH GREP 1 "Feb 26, 2008"
+.TH GREP 1 "May 3, 2013"
 .SH NAME
 grep \- search a file for a pattern
 .SH SYNOPSIS
 .LP
 .nf
-\fB/usr/bin/grep\fR [\fB-c\fR | \fB-l\fR |\fB-q\fR] [\fB-r\fR | \fB-R\fR] [\fB-bhinsvw\fR]
+\fB/usr/bin/grep\fR [\fB-c\fR | \fB-l\fR |\fB-q\fR] [\fB-r\fR | \fB-R\fR] [\fB-bHhinsvw\fR]
     \fIlimited-regular-expression\fR [\fIfilename\fR]...
 .fi
 
 .LP
 .nf
 \fB/usr/xpg4/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR] [\fB-r\fR | \fB-R\fR]
-    [\fB-bhinsvwx\fR] \fB-e\fR \fIpattern_list\fR... [\fB-f\fR \fIpattern_file\fR]...
+    [\fB-bHhinsvwx\fR] \fB-e\fR \fIpattern_list\fR... [\fB-f\fR \fIpattern_file\fR]...
     [\fIfile\fR]...
 .fi
 
 .LP
 .nf
 \fB/usr/xpg4/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR] [\fB-r\fR | \fB-R\fR]
-    [\fB-bhinsvwx\fR] [\fB-e\fR \fIpattern_list\fR]... \fB-f\fR \fIpattern_file\fR...
+    [\fB-bHhinsvwx\fR] [\fB-e\fR \fIpattern_list\fR]... \fB-f\fR \fIpattern_file\fR...
     [\fIfile\fR]...
 .fi
 
 .LP
 .nf
 \fB/usr/xpg4/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR] [\fB-r\fR | \fB-R\fR]
-    [\fB-bhinsvwx\fR] \fIpattern\fR [\fIfile\fR]...
+    [\fB-bHhinsvwx\fR] \fIpattern\fR [\fIfile\fR]...
 .fi
 
 .SH DESCRIPTION
@@ -98,6 +98,15 @@
 .sp
 .ne 2
 .na
+\fB\fB-H\fR\fR
+.ad
+.RS 6n
+Precedes each line by the name of the file containing the matching line.
+.RE
+
+.sp
+.ne 2
+.na
 \fB\fB-h\fR\fR
 .ad
 .RS 6n
