#ident "@(#)testbcdinc.c	1.1 5/3/96 15:19:02"
/*
/* Copyright John Moyer 1996
/* permission is granted to use this for any purpose provided proper
/* credit is given to the author
*/

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <math.h>

#include "bignum.h"

int main (int argc, char *argv[])
{
int i, j, err;
BigNum x1;
char str[ISIZE+8];

if ( argc == 2 )
  {
  err = ascii2bcd(argv[1],&x1);
  }
else
  err = 999;
if ( err )
  {
  fprintf(stderr,"%s: Could not get a number from command line\n",argv[0]);
  return 1;
  }

j = x1.c;
if ( j > ISIZE -1 )
  {
  fprintf( stderr,"%s: Numbers to large, max=%d\n",argv[0],ISIZE-1);
  return 1;
  }

bcdinc(x1.x,j);

for ( x1.c = 0, i = ISIZE -1 ; i >= 0; i-- )
  if ( x1.x[i] != 0 )
    {
    x1.c = i+1;
    break;
    }

bcd2ascii(str, sizeof(str), &x1);
fprintf(stdout,"%s",str);

fputc('\n',stdout);

return (0);
}


