X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/3c139aaf8c0ef8fcaeeec25f582f39fbae4b8e79..2d1fd795835c6dc29bc90077a6d0021171510b11:/usr/src/usr.bin/mail/cmd2.c diff --git a/usr/src/usr.bin/mail/cmd2.c b/usr/src/usr.bin/mail/cmd2.c index 9b8135e21f..94469d1309 100644 --- a/usr/src/usr.bin/mail/cmd2.c +++ b/usr/src/usr.bin/mail/cmd2.c @@ -9,7 +9,7 @@ * More user commands. */ -static char *SccsId = "@(#)cmd2.c 1.4 %G%"; +static char *SccsId = "@(#)cmd2.c 2.2 %G%"; /* * If any arguments were given, go to the next applicable argument @@ -382,3 +382,33 @@ core() else printf("\n"); } + +/* + * Clobber as many bytes of stack as the user requests. + */ +clobber(argv) + char **argv; +{ + register int times; + + if (argv[0] == 0) + times = 1; + else + times = (atoi(argv[0]) + 511) / 512; + clobber1(times); +} + +/* + * Clobber the stack. + */ +clobber1(n) +{ + char buf[512]; + register char *cp; + + if (n <= 0) + return; + for (cp = buf; cp < &buf[512]; *cp++ = 0xFF) + ; + clobber1(n - 1); +}