
/****************************************************************************/

/*  Module PNLXV03C.C         ( includes LV211 LV212 and LV213 functions )

    Copyright 1986 Roundhill Computer Systems Limited
    All rights reserved

    Use and disclosure of this code are prohibited unless in accordance
    with the terms of the PANEL software licence.

    ************************************************************************
    *** THE OBJECT CODE VERSION OF THIS MODULE IS INCLUDED IN THE PANEL  ***
    *** LIBRARY.  IF YOU AMEND AND COMPILE THIS MODULE AND LINK IT WITH  ***
    *** YOUR APPLICATION IT WILL SUPERSEDE THE LIBRARY VERSION.          ***
    ************************************************************************

    PANEL:  Type 4          : Validation
            Source Language : C

    Modification History (Push-Down List):  

            28.12.85        : Convert to table-driven operation

*****************************************************************************/

#include <pnl4.h>

/*  Case 211 displays the current date in d,m,y format
    Case 212 displays the current date in m,d,y format
    Case 213 displays the current date in y,m,d format    */

static int pyear = 0, pmonth = 0, pday = 0;

PAXV03(fn,fp)
int fn;
panfcb *fp;

{
#ifdef DATETIME
    int lv, len, offset;
    char dum[11];           /* work area for formatted date */

    lv = UCI(fp->linevaln);
    if ((lv > 210) && (lv < 214))     /* codes 211..213 */
        {
        PADATE(&pyear, &pmonth, &pday);     /* get date */
        switch (lv-210) {
        case 1: sprintf(dum,"%02d/%02d/%02d  ",
                             pday,
                                  pmonth,
                                       pyear-1900); 
                len = 8;
                break;
        case 2: sprintf(dum,"%02d-%02d-%02d  ",
                             pmonth,
                                  pday,
                                       pyear-1900);
                len = 8;
                break;
        case 3: sprintf(dum,"%04d.%02d.%02d",
                             pyear,
                                  pmonth,
                                       pday); 
                len = 10;
                break;};
        if (len > UCI(fp->sl)) len = UCI(fp->sl);
        offset = 0;
        if (!(abbr & fp->sa)) offset = UCI(fp->di);
        PABM(dum,fp->datablock+offset,len);     /* block move (s,d,l) */
        }
#endif
}
