/* $Id: resfile.c 190 2001-04-12 00:36:10Z skaus $

	Return the name of the resource file

*/

#include "../config.h"

#include <assert.h>
#include <stdlib.h>
#include <string.h>

#include <dfn.h>

#include "../include/command.h"
#include "../include/misc.h"

char *comResFile(void)
{  if(isSwapFile) {
       static char *p = 0;

       free(p);
       if((p = strdup(comFile())) != 0) {
           assert(strlen(p) == isSwapFile + 3);
           memcpy(p + isSwapFile, "SWP", 3);
           if(exist(p))
			   return p;
       }
   }

   return comFile();
}
