ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_help.c
(Generate patch)

Comparing ircd-hybrid/trunk/modules/m_help.c (file contents):
Revision 1997 by michael, Sat May 11 17:35:07 2013 UTC vs.
Revision 2028 by michael, Tue May 14 18:19:05 2013 UTC

# Line 38 | Line 38
38   static void
39   sendhelpfile(struct Client *source_p, const char *path, const char *topic)
40   {
41 <  FILE *file;
42 <  char line[HELPLEN];
41 >  FILE *file = NULL;
42 >  char line[HELPLEN] = { '\0' };
43  
44    if ((file = fopen(path, "r")) == NULL)
45    {
# Line 73 | Line 73 | sendhelpfile(struct Client *source_p, co
73   }
74  
75   static void
76 < dohelp(struct Client *source_p, const char *hpath, char *topic)
76 > dohelp(struct Client *source_p, char *topic)
77   {
78    char h_index[] = "index";
79    char path[HYB_PATH_MAX + 1];
# Line 93 | Line 93 | dohelp(struct Client *source_p, const ch
93      return;
94    }
95  
96 <  if (strlen(hpath) + strlen(topic) + 1 > HYB_PATH_MAX)
96 >  if (strlen(HPATH) + strlen(topic) + 1 > HYB_PATH_MAX)
97    {
98      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
99                 me.name, source_p->name, topic);
100      return;
101    }
102  
103 <  snprintf(path, sizeof(path), "%s/%s", hpath, topic);
103 >  snprintf(path, sizeof(path), "%s/%s", HPATH, topic);
104  
105    if (stat(path, &sb) < 0)
106    {
# Line 140 | Line 140 | m_help(struct Client *client_p, struct C
140  
141    last_used = CurrentTime;
142  
143 <  dohelp(source_p, UHPATH, parv[1]);
143 >  dohelp(source_p, parv[1]);
144   }
145  
146   /*
# Line 151 | Line 151 | static void
151   mo_help(struct Client *client_p, struct Client *source_p,
152          int parc, char *parv[])
153   {
154 <  dohelp(source_p, HPATH, parv[1]);
155 < }
156 <
157 < /*
158 < * mo_uhelp - HELP message handler
159 < * This is used so that opers can view the user help file without deopering
160 < *      parv[0] = sender prefix
161 < */
162 < static void
163 < mo_uhelp(struct Client *client_p, struct Client *source_p,
164 <         int parc, char *parv[])
165 < {
166 <  dohelp(source_p, UHPATH, parv[1]);
154 >  dohelp(source_p, parv[1]);
155   }
156  
157   static struct Message help_msgtab = {
# Line 171 | Line 159 | static struct Message help_msgtab = {
159    {m_unregistered, m_help, m_ignore, m_ignore, mo_help, m_ignore}
160   };
161  
174 static struct Message uhelp_msgtab = {
175  "UHELP", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
176  {m_unregistered, m_help, m_ignore, m_ignore, mo_uhelp, m_ignore}
177 };
178
162   static void
163   module_init(void)
164   {
165    mod_add_cmd(&help_msgtab);
183  mod_add_cmd(&uhelp_msgtab);
166   }
167  
168   static void
169   module_exit(void)
170   {
171    mod_del_cmd(&help_msgtab);
190  mod_del_cmd(&uhelp_msgtab);
172   }
173  
174   struct module module_entry = {

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)