
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) 
{
  char * BAD;
  long int result;

  if (argc != 2) return 1;
  result = strtol(argv[1], &BAD, 10);
  if (*BAD) {
    printf("There was a bad character '%c'; the preceding number was %ld.\n",
           *BAD, result);
  } else {
    printf("The entire input was good and was equal to %ld.\n", result);
  }
  return 0;
}
