File: base.c

package info (click to toggle)
youbin 2.13-12
  • links: PTS
  • area: main
  • in suites: potato
  • size: 556 kB
  • ctags: 416
  • sloc: ansic: 2,830; makefile: 60; sh: 24
file content (81 lines) | stat: -rw-r--r-- 2,439 bytes parent folder | download | duplicates (2)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * Program:     $RCSfile: base.c,v $  $Revision: 4.3 $
 *
 * Purpose:     Basic routines of internet "youbin" service.
 *
 * Author:      K.Agusa     agusa@nuie.nagoya-u.ac.jp
 *              S.Yamamoto  yamamoto@nuie.nagoya-u.ac.jp
 *
 * Date:        1993/07/27
 * Modified:    $Date: 1995/03/26 11:56:18 $
 *
 * Copyright:   K.Agusa and S.Yamamoto  1993 - 1995
 *
 * The X Consortium, and any party obtaining a copy of these files from
 * the X Consortium, directly or indirectly, is granted, free of charge,
 * a full and unrestricted irrevocable, world-wide, paid up, royalty-free,
 * nonexclusive right and license to deal in this software and documentation
 * files (the "Software"), including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons who receive copies from any such
 * party to do so. This license includes without limitation a license to do
 * the foregoing actions under any patents of the party supplying this
 * software to the X Consortium.
 */

#ifndef lint
static char rcsid[] =
    "$Id: base.c,v 4.3 1995/03/26 11:56:18 yamamoto Exp $";
#endif

#include <stdio.h>

#include "youbin.h"

/*
 * Variable argument list.
 *
 * USE_STDARG:  Use ANSI routines.
 * USE_VARARGS  Use UNIX's native routines.
 */

#ifdef USE_STDARG 

#include <stdarg.h>
#define VARARGS_PROTO(func, firstArg, type)     func(type firstArg, ...)
#define VA_START(argsPtr, firstArg)             va_start(argsPtr, firstArg)
#define VA_1ST_ARG(argsPtr, firstArg, type)     firstArg

#else /* USE_VARARGS */

#include <varargs.h>
#define VARARGS_PROTO(func, firstArg, type)     func(va_alist) va_dcl
#define VA_START(argsPtr, firstArg)             va_start(argsPtr)
#define VA_1ST_ARG(argsPtr, firstArg, type)     va_arg(argsPtr, type)

#endif /* USE_VARARGS */

void
print_usage(usage)
char    **usage;
{
    while (*usage != NULL) {
        fprintf(stderr, "%s\n", *usage++);
    }
    fprintf(stderr, "VERSION\n");
    fprintf(stderr, "    Version           %s\n", VERSION);
    fprintf(stderr, "    Patch level       %s\n", PATCH_LEVEL);
    fprintf(stderr, "    Protocol version  %s\n", PROTOCOL_VERSION);
}

void
VARARGS_PROTO(debug, va_args, char *)
{
    va_list     args;
    
    if (debug_mode) {
        VA_START(args, va_args);
        vfprintf(stderr, VA_1ST_ARG(args, va_args, char *), args);
        va_end(args);
    }
}