/*
** Copyright (c) Digital Equipment Corporation, 1994
** All Rights Reserved.
**
** This software is furnished under a license and may be used and copied
** only  in  accordance  with  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.
**
**
**    FILE:           x_atttmp.c
**
**    DESCRIPTION:    Illustrates attaching to a temporary queue
**                    and making a temporary primary queue.
**
**    CREATION DATE:  26 November 1993
**
**    REQUIREMENTS:   none.
**
*/

/**  .......................  **/
/**  C library include files  **/
/**  .......................  **/
#include <stdio.h>
#include <string.h>

/**  .........................  **/
/**  DECmessageQ include files  **/
/**  .........................  **/
#include "p_entry.h"
#include "p_return.h"
#include "p_symbol.h"


long
main( )
{
    int32      attach_mode;
    int32      dmq_status;
    int32      q_type;
    q_address  my_primary_queue;


    printf("\n\n\nExample program to illustrate how DMQ can\n" );
    printf("attach to a temporary primary queue...\n");

    attach_mode   = PSYM_ATTACH_TEMPORARY;
    q_type        = PSYM_ATTACH_PQ; /* causes the tempory queue to be */
                                    /* a temporary primary queue      */
  
    dmq_status    = pams_attach_q(
                          &attach_mode,
                          &my_primary_queue,
                          &q_type,       /*  make a temp primary queue */
                          (char *) 0,    /*  q_name not needed         */
                          (int32 *) 0,    /*  q_name_len not needed     */
                          (int32 *) 0,    /*  Use default name space    */
                          (int32 *) 0,    /*  No name space list len    */
                          (char *) 0,    /*  Reserved by Digital       */
                          (char *) 0,    /*  Reserved by Digital       */
                          (char *) 0 );  /*  Reserved by Digital       */

    if ( dmq_status == PAMS__SUCCESS )
            printf("\n\tAttached successfully to temporary queue %d.\n", 
                        my_primary_queue.au.queue);
    else
            printf("\n\tError attaching temporary; status returned is: %ld\n", 
                    dmq_status );

    return( dmq_status );

} /* end of main */
