File: qprintf.c

package info (click to toggle)
giflib 5.1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 3,952 kB
  • sloc: sh: 11,565; ansic: 6,901; xml: 2,401; makefile: 278
file content (46 lines) | stat: -rw-r--r-- 1,131 bytes parent folder | download | duplicates (3)
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
/*****************************************************************************

 qprintf.c - module to emulate a printf with a possible quiet (disable mode.)

 A global variable GifNoisyPrint controls the printing of this routine
 
*****************************************************************************/


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

#include "gif_lib.h"

bool GifNoisyPrint = false;

/*****************************************************************************
 Same as fprintf to stderr but with optional print.
******************************************************************************/
void
GifQprintf(char *Format, ...) {
    va_list ArgPtr;

    va_start(ArgPtr, Format);

    if (GifNoisyPrint) {
	char Line[128];
	(void)vsnprintf(Line, sizeof(Line), Format, ArgPtr);
	(void)fputs(Line, stderr);
    }

    va_end(ArgPtr);
}

void
PrintGifError(int ErrorCode) {
    const char *Err = GifErrorString(ErrorCode);

    if (Err != NULL)
        fprintf(stderr, "GIF-LIB error: %s.\n", Err);
    else
        fprintf(stderr, "GIF-LIB undefined error %d.\n", ErrorCode);
}

/* end */