README for roll

ROLL is a command available in telehack.  See URLs:

     http://www.telehack.com/
     telnet://telehack.com:23

I'm not certain who authored the source for the roll command, or if
the source code is open or closed-source, so I recreated it from
scratch.

I tried to be as faithful as possible in recreating it.  The program
should compile on anything with a C compiler that accepts a command
line and has stdout and stderr.

The program does not check the screen-size, which is usually 80
characters by 24 or 25 lines.  Rolling more than 8 dice doesn't look
pretty with 80 characters per line, but most terminals can be
configured with more than 100 characters per line.  On telehack.com
the number of dice is limited to 10.

'ROLL' without arguments will default to rolling 2 dice.

It will accept one argument.  Either an option or a number.  Options
begin with '-' or '/'.  The length of an option is not checked, but
all characters must be alphanumeric or '?'.  The '?' option gives a
brief description.  Any characters not in the set described will cause
it to exit with a non-zero status.  Options, aside from '?' are
ignored.

If a number, n, is an integer and 0<=n<=MAX_NUM_DIES, it will output n
flashing dice.

Returns EXIT_SUCCESS (usually zero) for help or a valid number of
dice.

Returns EXIT_FAILURE (usually non-zero) on any error.

Unfortunately, on my Mac, the command name conflicts with another
utility available in mac-ports, so, I renamed the target in the
Makefile.

If your character set supports graphic characters, the design of the
dice can be modified in roll.h.

The Makefile may need some massaging for DOS, but there shouldn't be
any problems compiling.  I'm not certain if 8 dice will print
correctly.  I use ANSI sequences to clear the screen, so you should
load ANSI.SYS or ANSI.COM if your command line processor doesn't
interpret ANSI sequences.

The ANSI sequences are the least portable portion of the code.  This
code is isolated in screen.h and screen.c.  This program only uses
screen_clear() which can be easily updated with appropriate code, a
system call to 'clear' or 'CLS.COM', or simply short circuited.

Michael J. Chappell
mcsuper5@freeshell.org
June 23, 2016

 **************************************************************

Version 0.2 

I updated the help message and added an option to display the version.

While it no longer behaves exactly as it does on Telehack's site, the
change is not significant and is very unlikely to require any changes
for anyone who uses it.

Michael J. Chappell
mcsuper5@freeshell.org
February 21, 2017

 *************************************************************

Version 0.3

I allowed a positive number of dice to call sranddev because I
saw the same throw being repeated in OS X Catalina.

Negative numbers will use the absolute value for the number of dice
but bypass the call to sranddev.

I also added a man page.

Michael J. Chappell
mcsuper5@freeshell.org
March 22, 2020

 ************************************************************

Version 0.4

Redined sranddev() to srandomdev() on FreeBSD.
Redined sranddev() to srand(0) on NetBSD.

Updated man page.

Updated Makefile for single user install on FreeBSD.

Michael J. Chappell
mcsuper5@freeshell.org
April 6, 2024

 ************************************************************

Version 0.5

Redefined sranddev() to srand(0) on Linux

Updated man page.

Updated Makefile for Linux.

Michael J. Chappell
mcsuper5@freeshell.org
October 4, 2024
 ************************************************************

Version 0.6

Redefined sranddev() to srand((int)time(NULL)) on Linux

Updated man page.

Updated Makefile for Linux.

Michael J. Chappell
mcsuper5@freeshell.org
October 5, 2024