ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/branches/newio/modules/m_help.c
(Generate patch)

Comparing branches/newio/modules/m_help.c (file contents):
Revision 2416 by michael, Sat Jul 6 16:22:05 2013 UTC vs.
Revision 2417 by michael, Sun Jul 21 18:11:50 2013 UTC

# Line 35 | Line 35
35   #define HELPLEN 400
36  
37  
38 < static void
38 > static int
39   sendhelpfile(struct Client *source_p, const char *path, const char *topic)
40   {
41    FILE *file = NULL;
# Line 45 | Line 45 | sendhelpfile(struct Client *source_p, co
45    {
46      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
47                 me.name, source_p->name, topic);
48 <    return;
48 >    return 0;
49    }
50  
51    if (fgets(line, sizeof(line), file) == NULL)
52    {
53      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
54                 me.name, source_p->name, topic);
55 <    return;
55 >    return 0;
56    }
57  
58    line[strlen(line) - 1] = '\0';
# Line 70 | Line 70 | sendhelpfile(struct Client *source_p, co
70    fclose(file);
71    sendto_one(source_p, form_str(RPL_ENDOFHELP),
72               me.name, source_p->name, topic);
73 +  return 0;
74   }
75  
76 < static void
76 > static int
77   dohelp(struct Client *source_p, char *topic)
78   {
79    char *p = topic;
# Line 90 | Line 91 | dohelp(struct Client *source_p, char *to
91    {
92      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
93                 me.name, source_p->name, topic);
94 <    return;
94 >    return 0;
95    }
96  
97    if (strlen(HPATH) + strlen(topic) + 1 > HYB_PATH_MAX)
98    {
99      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
100                 me.name, source_p->name, topic);
101 <    return;
101 >    return 0;
102    }
103  
104    snprintf(path, sizeof(path), "%s/%s", HPATH, topic);
# Line 106 | Line 107 | dohelp(struct Client *source_p, char *to
107    {
108      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
109                 me.name, source_p->name, topic);
110 <    return;
110 >    return 0;
111    }
112  
113    if (!S_ISREG(sb.st_mode))
114    {
115      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
116                 me.name, source_p->name, topic);
117 <    return;
117 >    return 0;
118    }
119  
120 <  sendhelpfile(source_p, path, topic);
120 >  return sendhelpfile(source_p, path, topic);
121   }
122  
123   /*
124   * m_help - HELP message handler
125   *      parv[0] = sender prefix
126   */
127 < static void
127 > static int
128   m_help(struct Client *client_p, struct Client *source_p,
129         int parc, char *parv[])
130   {
# Line 135 | Line 136 | m_help(struct Client *client_p, struct C
136      /* safe enough to give this on a local connect only */
137      sendto_one(source_p,form_str(RPL_LOAD2HI),
138                 me.name, source_p->name);
139 <    return;
139 >    return 0;
140    }
141  
142    last_used = CurrentTime;
143  
144 <  dohelp(source_p, parv[1]);
144 >  return dohelp(source_p, parv[1]);
145   }
146  
147   /*
148   * mo_help - HELP message handler
149   *      parv[0] = sender prefix
150   */
151 < static void
151 > static int
152   mo_help(struct Client *client_p, struct Client *source_p,
153          int parc, char *parv[])
154   {
155 <  dohelp(source_p, parv[1]);
155 >  return dohelp(source_p, parv[1]);
156   }
157  
158 < static struct Message help_msgtab = {
158 > static struct Message help_msgtab =
159 > {
160    "HELP", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
161    {m_unregistered, m_help, m_ignore, m_ignore, mo_help, m_ignore}
162   };
# Line 171 | Line 173 | module_exit(void)
173    mod_del_cmd(&help_msgtab);
174   }
175  
176 < struct module module_entry = {
176 > struct module module_entry =
177 > {
178    .node    = { NULL, NULL, NULL },
179    .name    = NULL,
180    .version = "$Revision$",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines