home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 125.img / PRO-C4.ZIP / BENCH1.ZIP / BENCH / RNGSDATE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-28  |  2.0 KB  |  81 lines

  1. /* ==( bench/rngsdate.c )== */
  2. /* ----------------------------------------------- */
  3. /* Pro-C  Copyright (C) 1988 - 1990 Vestronix Inc. */
  4. /* Modification to this source is not supported    */
  5. /* by Vestronix Inc.                               */
  6. /*            All Rights Reserved                  */
  7. /* ----------------------------------------------- */
  8. /* Written   Nig   1-Jan-87                        */
  9. /* Modified  Geo  11-Dec-89  See comments below    */
  10. /* ----------------------------------------------- */
  11. /* %W%  (%H% %T%) */
  12.  
  13. /*
  14.  * Modifications
  15.  *
  16.  * 11-Dec-89 Geo - V2 version
  17.  * 25-Oct-89 Geo - 1.32 Merge
  18. */
  19.  
  20. /*
  21.  * This routine will get the hi and lo values for range checks in
  22.  * a generated program
  23. */
  24. # include <stdio.h>
  25. # include <bench.h>
  26. # include <field.h>
  27.  
  28. static char low_mask[] = "MM-DD-YY";
  29.  
  30. static FIELD f_low =
  31. {
  32.     2, 9, 1, NULL, low_mask, 
  33.     0, 2, F_DATE, REVVID, REVVID, CONFIRM_NEEDED | NO_BLANK, 
  34.     NULL, text_input, NULL, NULL
  35. };
  36.  
  37. static char hi_mask[] = "MM-DD-YY";
  38.  
  39. static FIELD f_hi =
  40. {
  41.     4, 9, 1, NULL, hi_mask, 
  42.     0, 2, F_DATE, REVVID, REVVID, CONFIRM_NEEDED | NO_BLANK, 
  43.     NULL, text_input, NULL, NULL
  44. };
  45.  
  46. void range_sdate(width, hlp, lo, hi, mask, ich)
  47. int width, hlp;
  48. char *lo, *hi;
  49. char *mask;
  50. int *ich;
  51. {
  52.     char tmp[256];
  53.  
  54.     create_w(11, 30, 5, width + 10);
  55.     border_w(boxset, BOLD);
  56.  
  57.     disp_w(2, 2, NORMAL, "FROM :");
  58.     disp_w(4, 2, NORMAL, "  TO :");
  59.  
  60.     f_low.fmask = f_hi.fmask = mask;
  61.     f_low.fbuff = f_hi.fbuff = tmp;
  62.     f_low.fhelp = f_hi.fhelp = hlp;
  63.     f_low.fieldlen = f_hi.fieldlen = width;
  64.     tmp[width] = '\0';
  65.     strcpy(f_low.fbuff, ltocon(dstrtol(lo, "MMDDYY"), f_low.fmask, 1));
  66.  
  67.     *ich = 1;
  68.     if (input_wx(&f_low, K_ESC, K_DOWN, 0) != K_ESC)
  69.     {
  70.         strcpy(lo, ltocon(dstrtol(f_low.fbuff, "MMDDYY"), f_low.fmask, 1));
  71.         strcpy(f_hi.fbuff, ltocon(dstrtol(hi, "MMDDYY"), f_hi.fmask, 1));
  72.         if (input_wx(&f_hi, K_ESC, K_DOWN, 0) != K_ESC)
  73.         {
  74.             strcpy(hi, ltocon(dstrtol(f_hi.fbuff, "MMDDYY"), f_hi.fmask, 1));
  75.             *ich = 0;
  76.         }
  77.     }
  78.     delete_w();
  79. }
  80.  
  81.