Files
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

32 lines
1.1 KiB
C
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*----------------------------------------------------------------------*\
| NAME : get_num |
| CREATED : 5-August-83 LAST MODIFIED : 7-October-83 |
| FUNCTION: Get_num retrieves a number appended to the end of |
| a string pointed to by option. If none is found the |
| default value, dflt, is returned. |
| INPUT : option -- pointer to command option string |
| dflt -- default value of number if none was found |
| OUTPUT : Returns number appened to option, or default if not |
| found. |
\*----------------------------------------------------------------------*/
#include <portab.h>
#include "utildef.h"
WORD get_num( option,dflt )
BYTE *option; /* ptr to current option */
WORD dflt; /* default number, if not found */
{
WORD num; /* number taken from option */
num = 0;
while( isalpha( *option ) ) /* skip alphabetic ch. */
option++;
if( !isdigit( *option ) ) /* no digits found */
num = dflt;
else /* extract number */
num = atoi( option );
return( num );
}