2005-09-20 13:26:39 +00:00
|
|
|
/** \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 <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <strings.h>
|
|
|
|
#include <wchar.h>
|
2005-12-20 08:57:46 +00:00
|
|
|
#include <sys/types.h>
|
2005-09-20 13:26:39 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "common.h"
|
2006-06-13 13:43:28 +00:00
|
|
|
#include "halloc_util.h"
|
|
|
|
|
2005-09-20 13:26:39 +00:00
|
|
|
/**
|
|
|
|
Hashtable storing the help text
|
|
|
|
*/
|
|
|
|
static hash_table_t tbl;
|
|
|
|
|
2006-06-13 13:43:28 +00:00
|
|
|
static void builtin_help_init();
|
|
|
|
|
2006-06-17 13:07:08 +00:00
|
|
|
char *builtin_help_get( const wchar_t *cmd )
|
2005-09-20 13:26:39 +00:00
|
|
|
{
|
2006-06-17 13:07:08 +00:00
|
|
|
builtin_help_init();
|
|
|
|
|
2005-09-20 13:26:39 +00:00
|
|
|
return (char *)hash_get( &tbl, (void *)cmd );
|
|
|
|
}
|
|
|
|
|
2006-06-17 13:07:08 +00:00
|
|
|
/**
|
|
|
|
Initialize help hash table. Don't invoke it manually,
|
|
|
|
it is called by builtin_help_get automatically.
|
|
|
|
*/
|
2006-06-13 13:43:28 +00:00
|
|
|
static void builtin_help_init()
|
2005-09-20 13:26:39 +00:00
|
|
|
{
|
2006-06-17 13:07:08 +00:00
|
|
|
static int is_help_init = 0;
|
|
|
|
if( is_help_init )
|
|
|
|
return;
|
|
|
|
is_help_init=1;
|
2006-06-13 13:43:28 +00:00
|
|
|
halloc_register_function( global_context, (void (*)(void *))&hash_destroy, &tbl );
|
2005-09-20 13:26:39 +00:00
|
|
|
hash_init( &tbl, &hash_wcs_func, &hash_wcs_cmp );
|