/**********************************************************************
*
*  module   : Hfd
*  commande : HfdGetPath
*  fichier  : HfdGetPath.c
*  Auteur   : Ducloy
*  Date     : Avril 95
*  $Id: DamGetPath.c,v 1.2 2003/03/17 16:33:04 parmentf Exp $
*
****************************************************************************
*
* Copyright (c) 1995 CNRS/CRIN & INRIA Lorraine
* 
***********************************************************************/
#include <stdio.h>
#include "Hfd.h"


void usage(char *mess)
{
  if (mess) fprintf(stderr,"**** %s\n", mess);
  fprintf(stderr,"usage: HfdGetPath -AIBrfci -n fileName\n");
  exit(1);
}

extern char *optarg;
static char *fileName;
static char  pathType;
static char fileType;

extern int optind;
int getopt();

int main(argc,argv)
     int argc;
     char **argv;
{
  int cOption;
  
  pathType='A';
  fileType='h';
  fileName=NULL;
  
  while((cOption=getopt(argc,argv,"ABIcdihn:r"))!=EOF)
    
    {switch (cOption)
      {
      case 'A':
      case 'B':
      case 'I':
	pathType=cOption;
	break;
	
      case 'h': 
      case 'i':
      case 'c': 
      case 'r': 
      case 'd': 
	 fileType=cOption;
	 break;
	 
      case 'n':
	fileName=optarg;
	break;

	
      default:
	usage(NULL);
      }
    }

  if (!fileName) usage ("n option is mandatory");
  
  printf("%s\n", HfdGetPath(fileName,fileType,pathType ));
  
  return 0;
}
