add nohup

This commit is contained in:
Connor Lane Smith
2011-06-18 06:41:28 +01:00
parent e54eb9f4bc
commit f24772dcbb
7 changed files with 103 additions and 17 deletions

15
util/enprintf.c Normal file
View 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);
}

View File

@@ -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
View 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);
}