Cleanups to $help() function, removing some half-baked functionality that
never worked properly. Search LOAD_PATH for the SCRIPT_HELP file. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@128 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -4776,30 +4776,27 @@ BUILT_IN_FUNCTION(function_help, words)
|
|||||||
extern void get_help_topic(const char *, int);
|
extern void get_help_topic(const char *, int);
|
||||||
extern int read_file(FILE *, int);
|
extern int read_file(FILE *, int);
|
||||||
|
|
||||||
char *filename = NULL, *subject = NULL;
|
|
||||||
static int first_time = 1;
|
static int first_time = 1;
|
||||||
FILE *help_file;
|
|
||||||
|
|
||||||
GET_STR_ARG(subject, words);
|
if (first_time)
|
||||||
if (words && *words)
|
|
||||||
words = next_arg(filename, &words);
|
|
||||||
else
|
|
||||||
malloc_strcpy(&filename, get_string_var(SCRIPT_HELP_VAR));
|
|
||||||
if (first_time && filename)
|
|
||||||
{
|
{
|
||||||
|
FILE *help_file;
|
||||||
char *new_file = NULL;
|
char *new_file = NULL;
|
||||||
malloc_strcpy(&new_file, filename);
|
|
||||||
if (!(help_file = uzfopen(&new_file, ".", 0)))
|
malloc_strcpy(&new_file, get_string_var(SCRIPT_HELP_VAR));
|
||||||
{
|
help_file = uzfopen(&new_file, get_string_var(LOAD_PATH_VAR), 0);
|
||||||
new_free(&new_file);
|
new_free(&new_file);
|
||||||
|
|
||||||
|
if (!help_file)
|
||||||
RETURN_EMPTY;
|
RETURN_EMPTY;
|
||||||
}
|
|
||||||
first_time = 0;
|
first_time = 0;
|
||||||
new_free(&new_file);
|
|
||||||
read_file(help_file, 1);
|
read_file(help_file, 1);
|
||||||
fclose(help_file);
|
fclose(help_file);
|
||||||
} else if (first_time) RETURN_EMPTY;
|
}
|
||||||
get_help_topic(subject, (filename) ? 1 : 0);
|
|
||||||
|
if (words && *words)
|
||||||
|
get_help_topic(words, 1);
|
||||||
#endif
|
#endif
|
||||||
RETURN_EMPTY;
|
RETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user