DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Sunfreeware Md5 Patch

12.11.2009
| 2826 views |
  • submit to reddit
        This patch makes the source from
ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/md5-6142000.tar.gz
behave a little more like GNU md5sum.

# diff -r md5 md5.patched
diff -r md5/Makefile md5.patched/Makefile
19c19
<       $(CC) -o md5 md5c.o mddriver.o
---
>       $(CC) -o md5sum md5c.o mddriver.o
diff -r md5/mddriver.c md5.patched/mddriver.c
99c99
<      MDFile (argv[i]);
---
>      MDFile (argv[0], argv[i]);
119d118
<   if (!bflag) printf ("MD%d (\"%s\") = ", MD, string);
121c120
<   if (!bflag) printf ("\n");
---
>   if (!bflag) printf ("  %s\n", string);
187c186,187
< static void MDFile (filename)
---
> static void MDFile (progname, filename)
> char *progname;
196c196
<  printf ("%s can't be opened\n", filename);
---
>  printf ("%s: %s: No such file or directory\n", progname, filename);
206d205
<  if (!bflag) printf ("MD%d (%s) = ", MD, filename);
208c207
<  if (!bflag) printf ("\n");
---
>  if (!bflag) printf ("  %s\n", filename);
222c221
<  MDUpdate (&context, buffer, len);
---
>     MDUpdate (&context, buffer, len);
226c225
<   if (!bflag) printf ("\n");
---
>   if (!bflag) printf ("  -\n");