]> git.sur5r.net Git - openldap/blob - clients/rcpt500/help.c
Separate autoconf generated values from "defaults".
[openldap] / clients / rcpt500 / help.c
1 /*
2  * help.c: for rcpt500 (X.500 email query responder)
3  *
4  * 16 June 1992 by Mark C Smith
5  * Copyright (c) 1992 The Regents of The University of Michigan
6  * All Rights Reserved
7  */
8
9 #include "portable.h"
10
11 #include <stdio.h>
12
13 #include <ac/syslog.h>
14 #include <ac/string.h>
15 #include <ac/unistd.h>
16
17 #ifdef HAVE_FCNTL_H
18 #include <fcntl.h>
19 #endif
20
21 #include "ldap_defaults.h"
22 #include "rcpt500.h"
23
24
25 int
26 help_cmd(struct msginfo *msgp, char *reply)
27 {
28     int         fd, len;
29
30     if (( fd = open( RCPT500_HELPFILE, O_RDONLY )) == -1 ) {
31         if ( dosyslog ) {
32             syslog( LOG_ERR, "open help file: %m" );
33         }
34         strcat( reply, "Unable to access the help file.  Sorry!\n" );
35         return( 0 );
36     }
37
38     len = read( fd, reply + strlen( reply ), MAXSIZE );
39     close( fd );
40
41     if ( len == -1 ) {
42         if ( dosyslog ) {
43             syslog( LOG_ERR, "read help file: %m" );
44         }
45         strcat( reply, "Unable to read the help file.  Sorry!\n" );
46         return( 0 );
47     }
48
49     *(reply + len ) = '\0';
50     return( 0 );
51 }