File: hello.c

package info (click to toggle)
tirc 1.2-10
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,388 kB
  • ctags: 1,909
  • sloc: ansic: 19,264; sh: 2,671; makefile: 222; awk: 14
file content (55 lines) | stat: -rw-r--r-- 1,228 bytes parent folder | download | duplicates (4)
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
/*-
 * tirc -- client for the Internet Relay Chat
 *
 *	Copyright (c) 1996, 1997, 1998
 *		Matthias Buelow.  All rights reserved.
 *
 *	See the file ``COPYRIGHT'' for the usage and distribution
 *	license and warranty disclaimer.
 */

/*
 * This is a very simple example program for demonstrating the dynamically
 * linkable modules interface.
 */

#ifndef	lint
static char rcsid[] = "$Id$";
#endif

#include <dlapi.h>		/* TIRC API definitions */

#include <stdio.h>

#ifdef	NEED_DYNAMIC_SYMBOL
volatile int	_DYNAMIC;	/* required for BSD a.out shared obj */
#endif

static struct tirc_sstat_info si;	/* will hold various strings queried */
					/* from the client */

/*
 * This function is required; it returns a short identifier string to
 * the invoking module support.  It also sets up some stuff.
 */
const char *
modid()
{
	static const char idstring[] = "example program to show the usage of \
dynamically loadable modules";

	tirc_get_strings(&si);

	return idstring;
}

/*
 * This is the function that is to be bound to a dynamic command in tirc.
 */
void
hello_world()
{
	iw_printf(COLI_TEXT, "%sHello, world!\nRunning on version \"%s\", \
host system type is \"%s\"\n", si.si_ppre, si.si_version, si.si_osstring);
}