On Wed, May 13, 2009 at 12:20:44PM +0200, Otto Moerbeek wrote:
> You forgot to fix usage(). Also, I think it makes sense to allow -l
> for sum(1) too, so that both commands that take -a also take -l.
>
> -Otto
Eeek. Ok this will do then:
Regards,
-p
? cksum.1-orig
? cksum.patch
? md5.c-orig
Index: cksum.1
===================================================================
RCS file: /cvs/src/bin/md5/cksum.1,v
retrieving revision 1.19
diff -u -r1.19 cksum.1
--- cksum.1 8 Feb 2009 17:15:09 -0000 1.19
+++ cksum.1 13 May 2009 11:27:53 -0000
@@ -42,7 +42,7 @@
.Sh SYNOPSIS
.Nm cksum
.Bk -words
-.Op Fl bpqrtx
+.Op Fl blpqrtx
.Op Fl a Ar algorithms
.Op Fl c Op Ar checklist ...
.Op Fl o Ar 1 | 2
@@ -50,7 +50,7 @@
.Op Ar file ...
.Ek
.Nm sum
-.Op Fl bpqrtx
+.Op Fl blpqrtx
.Op Fl a Ar algorithms
.Op Fl c Op Ar checklist ...
.Op Fl o Ar 1 | 2
@@ -162,6 +162,8 @@
option may not be used in conjunction with more than a single
.Fl a
option.
+.It Fl l
+outputs the algorithms available and exits.
.It Fl o Ar 1 | 2
Use historic algorithms instead of the (superior) default one
(see below).
Index: md5.c
===================================================================
RCS file: /cvs/src/bin/md5/md5.c,v
retrieving revision 1.50
diff -u -r1.50 md5.c
--- md5.c 6 Sep 2008 12:01:34 -0000 1.50
+++ md5.c 13 May 2009 11:27:53 -0000
@@ -210,15 +210,15 @@
struct hash_list hl;
size_t len;
char *cp, *input_string;
- int fl, error, base64;
+ int fl, error, base64, i;
int bflag, cflag, pflag, rflag, tflag, xflag;
static const char *optstr[5] = {
"bcpqrs:tx",
"bcpqrs:tx",
"bcpqrs:tx",
- "a:bco:pqrs:tx",
- "a:bco:pqrs:tx"
+ "a:bco:lpqrs:tx",
+ "a:bco:lpqrs:tx"
};
TAILQ_INIT(&hl);
@@ -315,6 +315,15 @@
if (hftmp == TAILQ_END(&hl))
hash_insert(&hl, hf, 0);
break;
+ case 'l':
+ for (hf = functions; hf->name != NULL; hf++) {
+ len = strlen(hf->name);
+ for (i = 0; i < len; i++) {
+ putchar(tolower(hf->name[i]));
+ }
+ putchar('\n');
+ }
+ exit(0);
case 'p':
pflag = 1;
break;
@@ -794,7 +803,7 @@
break;
case MODE_CKSUM:
case MODE_SUM:
- fprintf(stderr, "usage: %s [-bpqrtx] [-a algorithms] "
+ fprintf(stderr, "usage: %s [-blpqrtx] [-a algorithms] "
"[-c [checklist ...]] [-o 1 | 2]\n"
" %*s [-s string] [file ...]\n",
__progname, (int)strlen(__progname), "");