aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin_help.hdr
blob: f209680f6ce116e7ccbc81f8e68d2b5666203e4e (plain)
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
/** \file builtin_help.c

    Functions for printing usage information of builtin commands. This
	file is automatically generated from the file builtin_help.hdr and
	various help files in the doc_src directory.
*/

#include "config.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include <sys/types.h>

#include "util.h"
#include "common.h"
#include "halloc_util.h"

/**
	Hashtable storing the help text
*/
static hash_table_t tbl;

static void builtin_help_init();

char *builtin_help_get( const wchar_t *cmd )
{
	builtin_help_init();

	return (char *)hash_get( &tbl, (void *)cmd );
}

/**
	Initialize help hash table. Don't invoke it manually, 
	it is called by builtin_help_get automatically.
*/
static void builtin_help_init()
{
	static int is_help_init = 0;
	if( is_help_init )
		return;
	is_help_init=1;
	halloc_register_function( global_context, (void (*)(void *))&hash_destroy, &tbl );
	hash_init( &tbl, &hash_wcs_func, &hash_wcs_cmp );