/*
 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 *%									   %
 *%	Copyright (C) 1991,1994 by WATCOM International Inc.		   %
 *%	All rights reserved.						   %
 *%									   %
 *%     Permission is granted to anyone to use this example program for	   %
 *%     any purpose on any computer system, subject to the following	   %
 *%	restrictions:							   %
 *%									   %
 *%     1. This example is provided on an "as is" basis, without warranty. %
 *%	   You indemnify, hold harmless and defend WATCOM from and against %
 *%	   any claims or lawsuits, including attorney's, that arise or	   %
 *%	   result from the use or distribution of this example, or any     %
 *%	   modification thereof.					   %
 *%									   %
 *%     2. You may not remove, alter or suppress this notice from this	   %
 *%        example program or any modification thereof.			   %
 *%									   %
 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 *
 * FILE.C
 *
 * Code to get a file using common dialog
 *
 */
#include <stdlib.h>
#include <stdio.h>
#include <direct.h>
#include <malloc.h>
#include <string.h>
#include <sys/stat.h>
#define INCLUDE_COMMDLG_H 	1
#include <windows.h>
#include "life.h"
#include "win1632.h"

BOOL GetFileName( char *name, BOOL save, char *ext,
		  char *buff, int len )
/**************************************/
{
    OPENFILENAME	of;
    char 		filter[30];
    char		*ptr;
    BOOL		rc;

    buff[0] = '\0';
    ptr = filter;
    strcpy( ptr, ext );
    ptr += strlen( ptr ) + 1;
    strcpy( ptr, ext );
    ptr += strlen( ptr ) + 1;
    *ptr = '\0';
    memset( &of, 0, sizeof( OPENFILENAME ) );
    of.lStructSize = sizeof( OPENFILENAME );
    of.hwndOwner = NULL;
    of.lpstrFilter = (LPSTR) filter;
    of.lpstrDefExt = "";
    of.nFilterIndex = 1L;
    of.lpstrFile = buff;
    of.nMaxFile = len;
    of.lpstrTitle = name;
    of.Flags = OFN_HIDEREADONLY;
    if( save ) {
	rc = GetSaveFileName( &of );
    } else {
	rc = GetOpenFileName( &of );
    }
    return( rc );
}

int CheckHeap()
{
	return( _heapchk() );

}
