Cleanups in get_help_topic(). Topic now displays correctly, rather than the
argument supplied to /bhelp. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@126 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -41,17 +41,16 @@ struct chelp_index {
|
|||||||
struct chelp_index bitchx_help;
|
struct chelp_index bitchx_help;
|
||||||
struct chelp_index script_help;
|
struct chelp_index script_help;
|
||||||
|
|
||||||
char *get_help_topic(char *args, int helpfunc)
|
char *get_help_topic(const char *args, int helpfunc)
|
||||||
{
|
{
|
||||||
char *new_comm = NULL;
|
|
||||||
int found = 0, i;
|
int found = 0, i;
|
||||||
char *others = NULL;
|
char *others = NULL;
|
||||||
struct chelp_index *index = helpfunc ? &script_help : &bitchx_help;
|
struct chelp_index *index = helpfunc ? &script_help : &bitchx_help;
|
||||||
new_comm = LOCAL_COPY(args);
|
size_t arglen = strlen(args);
|
||||||
|
|
||||||
for (i = 0; i < index->size; i++)
|
for (i = 0; i < index->size; i++)
|
||||||
{
|
{
|
||||||
if (!my_strnicmp(index->entries[i].title, new_comm, strlen(new_comm)))
|
if (!my_strnicmp(index->entries[i].title, args, arglen))
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
char *text = NULL;
|
char *text = NULL;
|
||||||
@@ -60,11 +59,12 @@ char *others = NULL;
|
|||||||
m_s3cat(&others, " , ", index->entries[i].title);
|
m_s3cat(&others, " , ", index->entries[i].title);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (args && *args && do_hook(HELPTOPIC_LIST, "%s", args))
|
if (do_hook(HELPTOPIC_LIST, "%s", index->entries[i].title))
|
||||||
put_it("%s",convert_output_format("$G \002$0\002: Help on Topic: \002$1\002", "%s %s", version, args));
|
put_it("%s", convert_output_format("$G \002$0\002: Help on Topic: \002$1-\002",
|
||||||
|
"%s %s", version, index->entries[i].title));
|
||||||
for (j = 0; (text = index->entries[i].contents[j]) != NULL; j++)
|
for (j = 0; (text = index->entries[i].contents[j]) != NULL; j++)
|
||||||
{
|
{
|
||||||
if (do_hook(HELPSUBJECT_LIST, "%s %s", new_comm, text))
|
if (do_hook(HELPSUBJECT_LIST, "%s , %s", index->entries[i].title, text))
|
||||||
{
|
{
|
||||||
in_chelp++;
|
in_chelp++;
|
||||||
put_it("%s", convert_output_format(text, NULL));
|
put_it("%s", convert_output_format(text, NULL));
|
||||||
|
|||||||
@@ -4771,7 +4771,7 @@ BUILT_IN_FUNCTION(function_umask, words)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern char *get_help_topic (char *, int);
|
extern char *get_help_topic (const char *, int);
|
||||||
extern int read_file (FILE *, int);
|
extern int read_file (FILE *, int);
|
||||||
|
|
||||||
BUILT_IN_FUNCTION(function_help, words)
|
BUILT_IN_FUNCTION(function_help, words)
|
||||||
|
|||||||
Reference in New Issue
Block a user