| 36 |
|
#include "modules.h" |
| 37 |
|
#include "irc_string.h" |
| 38 |
|
|
| 39 |
– |
#define HPATH IRCD_PREFIX "/help/opers" |
| 40 |
– |
#define UHPATH IRCD_PREFIX "/help/users" |
| 39 |
|
#define HELPLEN 400 |
| 40 |
|
|
| 41 |
|
static void m_help(struct Client *, struct Client *, int, char *[]); |
| 122 |
|
static void |
| 123 |
|
dohelp(struct Client *source_p, const char *hpath, char *topic) |
| 124 |
|
{ |
| 125 |
+ |
char h_index[] = "index"; |
| 126 |
|
char path[PATH_MAX + 1]; |
| 127 |
|
struct stat sb; |
| 128 |
|
int i; |
| 130 |
|
if (topic != NULL) |
| 131 |
|
{ |
| 132 |
|
if (*topic == '\0') |
| 133 |
< |
topic = "index"; |
| 133 |
> |
topic = h_index; |
| 134 |
|
else |
| 135 |
|
{ |
| 136 |
|
/* convert to lower case */ |
| 137 |
< |
for (i = 0; topic[i] != '\0'; i++) |
| 137 |
> |
for (i = 0; topic[i] != '\0'; ++i) |
| 138 |
|
topic[i] = ToLower(topic[i]); |
| 139 |
|
} |
| 140 |
|
} |
| 141 |
|
else |
| 142 |
< |
topic = "index"; /* list available help topics */ |
| 142 |
> |
topic = h_index; /* list available help topics */ |
| 143 |
|
|
| 144 |
|
if (strpbrk(topic, "/\\")) |
| 145 |
|
{ |
| 159 |
|
|
| 160 |
|
if (stat(path, &sb) < 0) |
| 161 |
|
{ |
| 163 |
– |
ilog(L_NOTICE, "help file %s not found", path); |
| 162 |
|
sendto_one(source_p, form_str(ERR_HELPNOTFOUND), |
| 163 |
|
me.name, source_p->name, topic); |
| 164 |
|
return; |
| 165 |
|
} |
| 166 |
|
|
| 169 |
– |
#ifndef _WIN32 |
| 167 |
|
if (!S_ISREG(sb.st_mode)) |
| 168 |
|
{ |
| 172 |
– |
ilog(L_NOTICE, "help file %s not found", path); |
| 169 |
|
sendto_one(source_p, form_str(ERR_HELPNOTFOUND), |
| 170 |
|
me.name, source_p->name, topic); |
| 171 |
|
return; |
| 172 |
|
} |
| 177 |
– |
#endif |
| 173 |
|
|
| 174 |
|
sendhelpfile(source_p, path, topic); |
| 175 |
|
} |
| 207 |
|
while (fbgets(line, sizeof(line), file)) |
| 208 |
|
{ |
| 209 |
|
line[strlen(line) - 1] = '\0'; |
| 210 |
< |
if(line[0] != '#') |
| 210 |
> |
if (line[0] != '#') |
| 211 |
|
{ |
| 212 |
|
if (!started) |
| 213 |
|
{ |
| 214 |
|
type = RPL_HELPSTART; |
| 215 |
< |
started = 1; |
| 215 |
> |
started = 1; |
| 216 |
|
} |
| 217 |
|
else |
| 218 |
|
type = RPL_HELPTXT; |