home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / flistfrontend / src / dclchk.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-04  |  1.3 KB  |  67 lines

  1. #ifndef NO_IDENT
  2. static char *Id = "$Id: dclchk.c,v 1.4 1995/06/04 19:06:22 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    dclchk.c
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    28 May 1984
  9.  * Last update:
  10.  *        19 Feb 1995, prototypes
  11.  *        26 Aug 1984, cleanup buffer sizes
  12.  *        14 Jul 1984, use $GETMSG for most messages.
  13.  *        28 Jun 1984
  14.  *
  15.  * Function:    Test the DCLARG-list given for error conditions, print an
  16.  *        appropriate error message if found.
  17.  *
  18.  * Parameters:    dcl_    => DCLARG list to check
  19.  *        co_    => buffer into which to return error message (suppress
  20.  *               actual print).
  21.  *
  22.  * Returns:    TRUE if an error is found, else FALSE (0).
  23.  */
  24.  
  25. #include    <stdio.h>
  26. #include    <string.h>
  27. #include    <rms.h>
  28.  
  29. #include    "bool.h"
  30. #include    "crt.h"
  31. #include    "dclarg.h"
  32.  
  33. #include    "strutils.h"
  34. #include    "sysutils.h"
  35.  
  36. int
  37. dclchk (DCLARG *dcl_, char *co_)
  38. {
  39.     unsigned status;
  40.     int    j;
  41.     char    *form_    = 0,
  42.         gotmsg    [CRT_COLS],
  43.         bfr    [CRT_COLS];
  44.  
  45.     for (; dcl_; dcl_ = dcl_->dcl_next)
  46.     {
  47.         if (status = dcl_->dcl_stat)
  48.         {
  49.             if (status == -1)
  50.                 form_ = dcl_->dcl_text;
  51.             else
  52.             {
  53.                 sysgetmsg (status, gotmsg, sizeof(gotmsg));
  54.                 strform2 (bfr, sizeof(bfr),
  55.                     gotmsg, 0, dcl_->dcl_text, 0);
  56.                 form_    = bfr;
  57.             }
  58.             if (co_)
  59.                 strcpy (co_, form_);
  60.             else
  61.                 printf ("%s\n", form_);
  62.             return (TRUE);    /* TRUE, found an error    */
  63.         }
  64.     }
  65.     return (FALSE);
  66. }
  67.