#include <stdio.h>
#include <string.h>
#include "common.h"
/*
 * If no extension, add the one specified
 */
void AddExt(char *buffer, char *ext)
{
  char *pos = strrchr(buffer,'.');
  if (!pos || (*(pos-1) == '.'))
    strcat(buffer, ext);
}
/*
 * Strip extension, if it has one
 */
void StripExt(char *buffer)
{
  char *pos = strrchr(buffer,'.');
  if (pos && (*(pos-1) != '.'))
    *pos = 0;
}
/*
 * Return path of EXE file
 */
void EXEPath(char *buffer, char*filename)
{
  char *temp;
  strcpy(buffer,filename);
  if ((temp = strrchr(buffer,'\\')) != 0)
    *(temp+1) = 0;
  else
    buffer[0] = 0;
}