/*
 * A set of miscellaneous utilities for Pan-STARRS
 */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "psLib.h"

/*****************************************************************************/
/*
 * Return a copy of a string
 */
char *psStringCopy(const char *str)
{
    return strcpy(psAlloc(strlen(str) + 1), str);
}

/*****************************************************************************/
/*
 * Send a psLogFatal message and abort
 */
void psAbort(const char *name, const char *fmt, ...)
{
    va_list ap;
    
    va_start(ap, fmt);
    psErrorStackPrint(stderr, "Error traceback:");
    va_end(ap);

    va_start(ap, fmt);
    psLogMsgV(name, PS_LOG_ABORT, fmt, ap);
    va_end(ap);
    
    abort();
}
