Skip to content
Permalink
Browse files

Removes/cleans some cruft about daemon format.

  • Loading branch information...
cryptogenomicon committed Jun 2, 2018
1 parent 6a2595c commit d54560c41bdc3c8fae10be020d81f354d5a4bced
Showing with 42 additions and 47 deletions.
  1. +37 −42 easel.c
  2. +5 −5 esl_sqio_ascii.c
79 easel.c
@@ -64,22 +64,22 @@ static esl_exception_handler_f esl_exception_handler = NULL;
void
esl_fail(char *errbuf, const char *format, ...)
{
if (format) {
va_list ap;
/* Check whether we are running as a daemon so we can do the right thing about logging instead of printing errors */
int parent_pid;
parent_pid = getppid();

if(parent_pid != 1){ // we aren't running as a daemon, so print the error normally

va_start(ap, format);
if (errbuf) vsnprintf(errbuf, eslERRBUFSIZE, format, ap);
va_end(ap);
}
else { // we are, so log the error instead of printing it
vsyslog(LOG_ERR, format, ap);
if (format)
{
va_list ap;
/* Check whether we are running as a daemon so we can do the
* right thing about logging instead of printing errors
*/
if (getppid() != 1)
{ // we aren't running as a daemon, so print the error normally
va_start(ap, format);
if (errbuf) vsnprintf(errbuf, eslERRBUFSIZE, format, ap);
va_end(ap);
}
else vsyslog(LOG_ERR, format, ap); // SRE: TODO: check this.
// looks wrong. I think it needs va_start(), va_end().
// also see two more occurrences, below.
}
}
}


@@ -143,21 +143,18 @@ esl_exception(int errcode, int use_errno, char *sourcefile, int sourceline, char
}
else
{
/* Check whether we are running as a daemon so we can do the right thing about logging instead of printing errors */
int parent_pid;
parent_pid = getppid();
if(parent_pid != 1){ // we're not running as a daemon, so print the error normally
fprintf(stderr, "Fatal exception (source file %s, line %d):\n", sourcefile, sourceline);
va_start(argp, format);
vfprintf(stderr, format, argp);
va_end(argp);
fprintf(stderr, "\n");
if (use_errno && errno) perror("system error");
fflush(stderr);
}
else { // we are, so log the error instead of printing it
vsyslog(LOG_ERR, format, argp);
}
/* Check whether we are running as a daemon so we can do the right thing about logging instead of printing errors */
if (getppid() != 1)
{ // we're not running as a daemon, so print the error normally
fprintf(stderr, "Fatal exception (source file %s, line %d):\n", sourcefile, sourceline);
va_start(argp, format);
vfprintf(stderr, format, argp);
va_end(argp);
fprintf(stderr, "\n");
if (use_errno && errno) perror("system error");
fflush(stderr);
}
else vsyslog(LOG_ERR, format, argp);

#ifdef HAVE_MPI
MPI_Initialized(&mpiflag); /* we're assuming we can do this, even in a corrupted, dying process...? */
@@ -300,18 +297,16 @@ esl_fatal(const char *format, ...)
int mpiflag;
#endif
/* Check whether we are running as a daemon so we can do the right thing about logging instead of printing errors */
int parent_pid;
parent_pid = getppid();
if(parent_pid != 1){ // we're not running as a daemon, so print the error normally
va_start(argp, format);
vfprintf(stderr, format, argp);
va_end(argp);
fprintf(stderr, "\n");
fflush(stderr);
}
else { // we are, so log the error instead of printing it
vsyslog(LOG_ERR, format, argp);
}
if (getppid() != 1)
{ // we're not running as a daemon, so print the error normally
va_start(argp, format);
vfprintf(stderr, format, argp);
va_end(argp);
fprintf(stderr, "\n");
fflush(stderr);
}
else vsyslog(LOG_ERR, format, argp);

#ifdef HAVE_MPI
MPI_Initialized(&mpiflag);
if (mpiflag) MPI_Abort(MPI_COMM_WORLD, 1);
@@ -10,7 +10,7 @@
* 7. Internal routines for EMBL format (including UniProt, TrEMBL)
* 8. Internal routines for GenBank format
* 9. Internal routines for FASTA format
* 10. Internal routines for DAEMON format
* 10. Internal routines for daemon format
* 11. Internal routines for HMMPGMD format
*
* This module shares remote evolutionary homology with Don Gilbert's
@@ -89,7 +89,7 @@ static int header_fasta(ESL_SQFILE *sqfp, ESL_SQ *sq);
static int skip_fasta (ESL_SQFILE *sqfp, ESL_SQ *sq);
static int end_fasta (ESL_SQFILE *sqfp, ESL_SQ *sq);

/* DAEMON format */
/* daemon format */
static void config_daemon(ESL_SQFILE *sqfp);
static void inmap_daemon (ESL_SQFILE *sqfp, const ESL_DSQ *abc_inmap);
static int end_daemon (ESL_SQFILE *sqfp, ESL_SQ *sq);
@@ -3152,7 +3152,7 @@ esl_sqascii_WriteFasta(FILE *fp, ESL_SQ *sq, int save_offsets)
/*------------------- end of FASTA i/o ---------------------------*/

/*****************************************************************
*# 10. Internal routines for DAEMON format
*# 10. Internal routines for daemon format
*****************************************************************/

/* Special case FASTA format where each sequence is terminated with "//".
@@ -3212,7 +3212,7 @@ end_daemon(ESL_SQFILE *sqfp, ESL_SQ *sq)

ESL_SQASCII_DATA *ascii = &sqfp->data.ascii;

if (ascii->nc < 3) ESL_FAIL(eslEFORMAT, ascii->errbuf, "Whoops, DAEMON input stream is corrupted");
if (ascii->nc < 3) ESL_FAIL(eslEFORMAT, ascii->errbuf, "Whoops, daemon input stream is corrupted");

c = ascii->buf[ascii->bpos++];
if (c != '/') ESL_FAIL(eslEFORMAT, ascii->errbuf, "Line %" PRId64 ": did not find // terminator at end of seq record", ascii->linenumber);
@@ -3338,7 +3338,7 @@ esl_sqascii_Parse(char *buf, int size, ESL_SQ *sq, int format)

return eslOK;
}
/*-------------------- end of DAEMON ----------------------------*/
/*-------------------- end of daemon ----------------------------*/

/*****************************************************************
*# 11. Internal routines for HMMPGMD format

0 comments on commit d54560c

Please sign in to comment.
You can’t perform that action at this time.