home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / UUPC11XT.ZIP / RN / RANGE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-21  |  1.6 KB  |  69 lines

  1. #ifndef lint
  2. static char *rcsid = "$Header: E:\SRC\UUPC\RN\RCS/RANGE.C 1.1 1992/11/21 06:14:58 ahd Exp $";
  3.  
  4. #endif
  5.  
  6. /*
  7. ***************************************************************************
  8. This work in its current form is Copyright 1989 Stan Barber
  9. This software may be distributed freely as long as no profit is made from
  10. such distribution and this notice is reproducted in whole.
  11. ***************************************************************************
  12. This software is provided on an "as is" basis with no guarantee of
  13. usefulness or correctness of operation for any purpose, intended or
  14. otherwise. The author is in no way liable for this software's performance
  15. or any damage it may cause to any data of any kind anywhere.
  16. ***************************************************************************
  17. */
  18. /*
  19.  * $Log: RANGE.C $
  20.  * Revision 1.1  1992/11/21  06:14:58  ahd
  21.  * Initial
  22.  *
  23.  *
  24.  *    Rev 1.0   18 Nov 1990  0:22:26
  25.  * Initial revision.
  26.  * Revision 1.1  89/11/08  03:45:39  sob
  27.  * Initial revision
  28.  *
  29.  *
  30.  */
  31.  
  32. #include <stdio.h>
  33. extern char *rindex();
  34. char *progname;
  35.  
  36. main(argc, argv)
  37.    char *argv[];
  38.    int argc;
  39. {
  40.    int x, y, i;
  41.  
  42.  
  43.    if ((progname = rindex(argv[0], '/')) == NULL)
  44.       progname = argv[0];
  45.    else
  46.       progname++;
  47.  
  48.  
  49.    if (argc != 3)
  50.       usage();
  51.    x = atoi(argv[1]);
  52.    y = atoi(argv[2]);
  53.    if (y < x)
  54.       usage();
  55.    y++;
  56.  
  57.    for (i = x; i < y; i++)
  58.       printf("%d ", i);
  59.    printf("\n");
  60.  
  61.    exit(0);
  62. }
  63.  
  64. usage()
  65. {
  66.    fprintf(stderr, "Usage: %s startnumber endnumber\n", progname);
  67.    exit(-1);
  68. }
  69.