mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 07:16:23 -05:00
28 lines
509 B
C
28 lines
509 B
C
/* usage.c -- implements usage.h */
|
|
|
|
/* TODO: align exit return code */
|
|
|
|
#include "usage.h"
|
|
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
static void report( const char *prefix, const char *err, va_list params) {
|
|
char msg[ 4096] ;
|
|
|
|
vsnprintf( msg, sizeof msg, err, params) ;
|
|
fprintf( stderr, "%s%s\n", prefix, msg) ;
|
|
}
|
|
|
|
void die( const char *err, ...) {
|
|
va_list params ;
|
|
|
|
va_start( params, err) ;
|
|
report( "fatal: ", err, params) ;
|
|
va_end( params) ;
|
|
exit( 128) ;
|
|
}
|
|
|
|
/* end of usage.c */
|