summaryrefslogtreecommitdiff
path: root/modules/m_help.c
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2012-11-23 21:00:02 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2012-11-23 21:00:02 +0000
commita629edeb23da4df76a12892dfce53ddbf9d191d5 (patch)
tree0e8a0f7f179fbcdfbdab1c6002d2fb3cb25a870a /modules/m_help.c
parent2a2d8754519acdc30b39dfec0b9fa037a6b22ee9 (diff)
- Minor cleanups to m_help.c, also helpfiles may no longer contain #comments
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1674 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules/m_help.c')
-rw-r--r--modules/m_help.c46
1 files changed, 10 insertions, 36 deletions
diff --git a/modules/m_help.c b/modules/m_help.c
index 2bd47a1..03dd7f7 100644
--- a/modules/m_help.c
+++ b/modules/m_help.c
@@ -91,21 +91,13 @@ dohelp(struct Client *source_p, const char *hpath, char *topic)
char h_index[] = "index";
char path[PATH_MAX + 1];
struct stat sb;
- int i;
+ unsigned int i;
- if (topic != NULL)
- {
- if (*topic == '\0')
- topic = h_index;
- else
- {
- /* convert to lower case */
- for (i = 0; topic[i] != '\0'; ++i)
- topic[i] = ToLower(topic[i]);
- }
- }
+ if (EmptyString(topic))
+ topic = h_index;
else
- topic = h_index; /* list available help topics */
+ for (i = 0; topic[i] != '\0'; ++i)
+ topic[i] = ToLower(topic[i]);
if (strpbrk(topic, "/\\"))
{
@@ -145,8 +137,6 @@ sendhelpfile(struct Client *source_p, const char *path, const char *topic)
{
FILE *file;
char line[HELPLEN];
- char started = 0;
- int type;
if ((file = fopen(path, "r")) == NULL)
{
@@ -162,35 +152,19 @@ sendhelpfile(struct Client *source_p, const char *path, const char *topic)
return;
}
- else if (line[0] != '#')
- {
- line[strlen(line) - 1] = '\0';
- sendto_one(source_p, form_str(RPL_HELPSTART),
+ line[strlen(line) - 1] = '\0';
+ sendto_one(source_p, form_str(RPL_HELPSTART),
me.name, source_p->name, topic, line);
- started = 1;
- }
while (fgets(line, sizeof(line), file))
{
line[strlen(line) - 1] = '\0';
- if (line[0] != '#')
- {
- if (!started)
- {
- type = RPL_HELPSTART;
- started = 1;
- }
- else
- type = RPL_HELPTXT;
-
- sendto_one(source_p, form_str(RPL_HELPTXT),
- me.name, source_p->name, topic, line);
- }
+
+ sendto_one(source_p, form_str(RPL_HELPTXT),
+ me.name, source_p->name, topic, line);
}
fclose(file);
- sendto_one(source_p, form_str(RPL_HELPTXT),
- me.name, source_p->name, topic, "");
sendto_one(source_p, form_str(RPL_ENDOFHELP),
me.name, source_p->name, topic);
}