File: error.c

package info (click to toggle)
shhmsg 1.4.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 148 kB
  • ctags: 78
  • sloc: ansic: 319; makefile: 134; sh: 10
file content (46 lines) | stat: -rw-r--r-- 1,457 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* $Id: error.c,v 1.6 2002/03/02 19:37:36 sverrehu Exp $ */
/*------------------------------------------------------------------------
 |  FILE            error.c
 |  MODULE OF       shhmsg - library for displaying messages.
 |
 |  DESCRIPTION     Function for displaying a simple error message.
 |
 |  WRITTEN BY      Sverre H. Huseby <shh@thathost.com>
 +----------------------------------------------------------------------*/

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

#include "internal.h"
#include "shhmsg.h"

/*-----------------------------------------------------------------------+
|  PUBLIC FUNCTIONS                                                      |
+-----------------------------------------------------------------------*/

/*------------------------------------------------------------------------
 |
 |  NAME          msgError
 |
 |  FUNCTION      Show given message on the _msgErrorStream.
 |
 |  SYNOPSIS      #include "shhmsg.h"
 |                void msgError(const char *format, ...);
 |
 |  INPUT         format, ...
 |                        Arguments used as with printf().
 |
 |  DESCRIPTION   Prints the name of this program followed by ": " and the
 |                given message on the _msgErrorStream.
 */
void
msgError(const char *format, ...)
{
    va_list ap;

    fflush(stdout);
    fprintf(GET_ERROR_STREAM, "%s: ", msgGetName());
    va_start(ap, format);
    vfprintf(GET_ERROR_STREAM, format, ap);
    va_end(ap);
}