r810: add err_puts()

puts() adds '\n', but fputs() does not.
This commit is contained in:
Heng Li 2014-08-26 11:07:24 -04:00
parent b5cba257c1
commit 1e611b235c
3 changed files with 13 additions and 2 deletions

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h" #include "utils.h"
#ifndef PACKAGE_VERSION #ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.10-r809-dirty" #define PACKAGE_VERSION "0.7.10-r810-dirty"
#endif #endif
int bwa_fa2pac(int argc, char *argv[]); int bwa_fa2pac(int argc, char *argv[]);

11
utils.c
View File

@ -219,6 +219,17 @@ int err_fputs(const char *s, FILE *stream)
return ret; return ret;
} }
int err_puts(const char *s)
{
int ret = puts(s);
if (EOF == ret)
{
_err_fatal_simple("puts", strerror(errno));
}
return ret;
}
int err_fflush(FILE *stream) int err_fflush(FILE *stream)
{ {
int ret = fflush(stream); int ret = fflush(stream);

View File

@ -80,7 +80,7 @@ extern "C" {
int err_fputc(int c, FILE *stream); int err_fputc(int c, FILE *stream);
#define err_putchar(C) err_fputc((C), stdout) #define err_putchar(C) err_fputc((C), stdout)
int err_fputs(const char *s, FILE *stream); int err_fputs(const char *s, FILE *stream);
#define err_puts(S) err_fputs((S), stdout) int err_puts(const char *s);
int err_fflush(FILE *stream); int err_fflush(FILE *stream);
int err_fclose(FILE *stream); int err_fclose(FILE *stream);
int err_gzclose(gzFile file); int err_gzclose(gzFile file);