              <<< VAXAXP::NOTES$:[NOTES$LIBRARY]VMSNOTES.NOTE;1 >>>
               -< VAX and Alpha VMS - Digital Internal Use Only >-
================================================================================
Note 207.1  SYS$LOOKUP_LICENSE finds PAK that $LICENSE LIST doesn't...   1 of 10
XDELTA::HOFFMAN "Steve, OpenVMS Engineering"        120 lines  18-FEB-1997 09:34
                            -< Working LMF Code... >-
--------------------------------------------------------------------------------

   Here's some LMF code I've been using over the years...

/*
** COPYRIGHT (c) 1992 BY
** DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS.
** ALL RIGHTS RESERVED.
**
** THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
** ONLY  IN  ACCORDANCE  OF  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
** INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR  ANY  OTHER
** COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
** OTHER PERSON.  NO TITLE TO AND  OWNERSHIP OF THE  SOFTWARE IS  HEREBY
** TRANSFERRED.
**
** THE INFORMATION IN THIS SOFTWARE IS  SUBJECT TO CHANGE WITHOUT NOTICE
** AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
** CORPORATION.
**
** DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE  OR  RELIABILITY OF ITS
** SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
*/

/*
**++
**  Facility:
**
**	Examples
**
**  Version: V1.0
**
**  Abstract:
**
**	Example of working with the DEC LMF calls
**
**  Author:
**	Steve Hoffman
**
**  Creation Date:  1-Jan-1990
**
**  Modification History:
**--
*/
/*
// lmf.c
// this subroutine is used to check for a hardwired product license.
// If the license is not installed the soubroutine signals the error.
*/

#include <descrip.h>
#include <lib$routines.h>
#include <lmfdef.h>
#include <ssdef.h>
#include <starlet.h>
#include <stddef.h>
#include <stdio.h>
#include <stsdef.h>
/* until sys$lookup_license() is in starlet.h... */
int sys$lookup_license( void *, void *, void *);

lmf()
    {
    int retstat;
    $DESCRIPTOR( product, "BOGUS" );
    $DESCRIPTOR( producer, "DEC" );
    $DESCRIPTOR( prod_date, "1-JAN-1988" );
    int prod_version = 0x010000;
    int i;
    char bintim[8];
    struct itmlst_3
	{
	short buflen;
	short itmcod;
	void *bufadr;
	void *bufrla;
	} itmlst[3];

    /*
    // Fill in the item list required by the call.  Includes the
    // required final, zero-filled, block.
    */
    i = 0;
    itmlst[i].buflen = 8;
    itmlst[i].itmcod = LMF$_PROD_DATE;
    itmlst[i].bufadr = (void *) bintim;
    itmlst[i++].bufrla = NULL;

    itmlst[i].buflen = 4;
    itmlst[i].itmcod = LMF$_PROD_VERSION;
    itmlst[i].bufadr = (void *) &prod_version;
    itmlst[i++].bufrla = NULL;

    itmlst[i].buflen = 0;
    itmlst[i].itmcod = 0;
    itmlst[i].bufadr = NULL;
    itmlst[i++].bufrla = NULL;

    /*
    // convert the time from ASCII to the internal quadword format.
    */
    retstat = sys$bintim( &prod_date, bintim );
    if ( !$VMS_STATUS_SUCCESS( retstat ))
	lib$signal( retstat );

    /*
    // The LMF signals on errors.
    */
    retstat = sys$lookup_license( &product, &itmlst, &producer );
    if ( !$VMS_STATUS_SUCCESS( retstat ))
	lib$signal( retstat );

    return SS$_NORMAL;
    }

main()
    {
    int retstat;
    retstat = lmf();
    return retstat;
    }
