/*
 *  MSG.C -- functions to print messages
 */

/*
 * (c)Copyright 1992-93 by Tobias Ferber.
 *
 * This file is part of CPDIST.
 *
 * CPDIST is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 1 of the License,
 * or (at your option) any later version.
 *
 * CPDIST is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with CPDIST; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <stdarg.h>
#include <stdio.h>

/* globals initialized by main() */
char *whoami;
FILE *ferr;


void echo(const char *fmt, ...)
{ va_list argp;
  va_start(argp,fmt);
  fprintf(ferr,"%s: ",whoami);
  vfprintf(ferr,(char *)fmt,argp);
  fprintf(ferr,"\n");
  fflush(ferr);
  va_end(argp);
}


void lerror(int line, const char *fmt, ...)
{ va_list argp;
  va_start(argp,fmt);
  fprintf(ferr,"line %d: ",line);
  vfprintf(ferr,(char *)fmt,argp);
  fprintf(ferr,"\n");
  fflush(ferr);
  va_end(argp);
}

