add nohup
This commit is contained in:
15
util/enprintf.c
Normal file
15
util/enprintf.c
Normal file
@@ -0,0 +1,15 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#include <stdarg.h>
|
||||
#include "../util.h"
|
||||
|
||||
extern void venprintf(int, const char *, va_list);
|
||||
|
||||
void
|
||||
enprintf(int status, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
venprintf(status, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
@@ -1,22 +1,16 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../util.h"
|
||||
|
||||
extern void venprintf(int, const char *, va_list);
|
||||
|
||||
void
|
||||
eprintf(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
venprintf(EXIT_FAILURE, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if(fmt[0] && fmt[strlen(fmt)-1] == ':') {
|
||||
fputc(' ', stderr);
|
||||
perror(NULL);
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
18
util/venprintf.c
Normal file
18
util/venprintf.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../util.h"
|
||||
|
||||
void
|
||||
venprintf(int status, const char *fmt, va_list ap)
|
||||
{
|
||||
vfprintf(stderr, fmt, ap);
|
||||
|
||||
if(fmt[0] && fmt[strlen(fmt)-1] == ':') {
|
||||
fputc(' ', stderr);
|
||||
perror(NULL);
|
||||
}
|
||||
exit(status);
|
||||
}
|
Reference in New Issue
Block a user