+\f/*
+** HELP -- implement the HELP command.
+**
+** Parameters:
+** topic -- the topic we want help for.
+**
+** Returns:
+** none.
+**
+** Side Effects:
+** outputs the help file to message output.
+*/
+
+help(topic)
+ char *topic;
+{
+ register FILE *hf;
+ int len;
+ char buf[MAXLINE];
+ bool noinfo;
+
+ hf = fopen("/usr/lib/sendmail.hf", "r");
+ if (hf == NULL)
+ {
+ /* no help */
+ message("502", "HELP not implemented");
+ return;
+ }
+
+ len = strlen(topic);
+ makelower(topic);
+ noinfo = TRUE;
+
+ while (fgets(buf, sizeof buf, hf) != NULL)
+ {
+ if (strncmp(buf, topic, len) == 0)
+ {
+ register char *p;
+
+ p = index(buf, '\t');
+ if (p == NULL)
+ p = buf;
+ else
+ p++;
+ fixcrlf(p, TRUE);
+ message("214-", p);
+ noinfo = FALSE;
+ }
+ }
+
+ if (noinfo)
+ message("504", "HELP topic unknown");
+ else
+ message("214", "End of HELP info");
+ fclose(hf);
+}