diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 index 899e49ba3517..a3db48596606 100644 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd Feb 5, 2022 +.Dd July 26, 2022 .Dt MD5 1 .Os .Sh NAME @@ -86,6 +86,9 @@ coreutils versions of these programs. If the program was called with a name that does not end in .Nm sum , compare the digest of the file against this string. +If combined with the +.Fl q +option, the calculated digest is printed in addition to the exit status being set. .Pq Note that this option is not yet useful if multiple files are specified. .It Fl c Ar file If the program was called with a name that does end in @@ -94,7 +97,7 @@ the file passed as argument must contain digest lines generated by the same digest algorithm with or without the .Fl r option -.Pq i.e. in either classical BSD format or in GNU coreutils format . +.Pq i.e., in either classical BSD format or in GNU coreutils format . A line with the file name followed by a colon .Dq ":" and either OK or FAILED is written for each well-formed line in the digest file. @@ -164,7 +167,7 @@ d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf .Pd The .Nm -sum -variants put 2 blank characters between hash and file name for full compatibility +variants put 2 blank characters between hash and file name for full compatibility with the coreutils versions of these commands. .Ed .Pp @@ -207,7 +210,7 @@ $ md5 -c digest /boot/loader.conf The digest file may contain any number of lines in the format generated with or without the .Fl r option -.Pq i.e. in either classical BSD format or in GNU coreutils format . +.Pq i.e., in either classical BSD format or in GNU coreutils format . If a hash value does not match the file, FAILED is printed instead of OK. .Sh SEE ALSO .Xr cksum 1 , diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index 7235e6e0a39f..97c587efd63c 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -436,6 +436,8 @@ MDOutput(const Algorithm_t *alg, char *p, char *argv[]) printf("%s: %s\n", *argv, checkfailed ? "FAILED" : "OK"); } else if (qflag || argv == NULL) { printf("%s\n", p); + if (cflag) + checkfailed = strcasecmp(checkAgainst, p) != 0; } else { if (rflag) if (gnu_emu)