/*
   <p>Test harness for <i>ltoa()</i> function.</p>

   <kbd>
   <b>environ - C programming support functions</b><br>
   Copyright (C) 2005  Martin C Gregorie
   
   This program is free software; you can redistribute it and/or
   modify it under the terms of the Lesser GNU General Public License.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
  
   You should have received a copy of the Lesser GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
   </kbd>
  
   <p>Contact Martin Gregorie at <i>martin@gregorie.org</i></p>
*/

#include <stdio.h>
#include <string.h>
#include "environ.h"

main(int argc, char **argv)
{
    long x;
    char str[35];

    setprog(argv[0]);
    
    if (argc != 2)
        error(argv[0],"piss off, Noddy","");
        
    x = atol(argv[1]);
    printf("\n\nReceived %s (%ld)\n",argv[1],x);
    printf("LTOA base 10 returned %s\n",ltoa(x,str,10));
    printf("String is %s (%d characters long)\n\n",str,strlen(str));
    printf("LTOA base 16 returned %s\n",ltoa(x,str,16));
    printf("String is %s (%d characters long)\n\n",str,strlen(str));
    printf("LTOA base 8 returned %s\n",ltoa(x,str,8));
    printf("String is %s (%d characters long)\n\n",str,strlen(str));
    printf("LTOA base 2 returned %s\n",ltoa(x,str,2));
    printf("String is %s (%d characters long)\n\n",str,strlen(str));
    return 0;
}
