1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-23 09:36:31 -05:00
uemacs/wrapper.c

40 lines
607 B
C
Raw Normal View History

2013-04-30 05:24:46 -04:00
/* wrapper.c -- implements wrapper.h */
#include "wrapper.h"
2013-05-01 02:00:16 -04:00
#include <stdio.h>
#include <stdlib.h>
2013-04-30 05:24:46 -04:00
#include <unistd.h>
#ifdef MINGW32
int mkstemp( char *template) {
return -1 ;
}
#endif
2013-05-01 02:00:16 -04:00
static void die( const char *err) {
fprintf( stderr, "fatal: %s\n", err) ;
exit( EXIT_FAILURE) ;
}
/* Function copyright: git */
2013-04-30 05:24:46 -04:00
void xmkstemp( char *template) {
int fd ;
fd = mkstemp( template) ;
if( fd < 0)
die( "Unable to create temporary file") ;
close( fd) ;
}
2013-04-30 05:24:46 -04:00
void *xmalloc( size_t size) {
void *ret = malloc( size) ;
if( !ret)
die( "Out of memory") ;
return ret ;
}
2013-04-30 05:24:46 -04:00
/* end of wrapper.c */