home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / TELECOM / rn_4_3_blars.lzh / range.c < prev    next >
C/C++ Source or Header  |  1990-08-22  |  1KB  |  57 lines

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