]> git.sur5r.net Git - openldap/blob - clients/rcpt500/help.c
Fixed slappasswd usage help (ITS#2565)
[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 <stdio.h>
10 #include <syslog.h>
11 #include <string.h>
12 #include <fcntl.h>
13
14 #include "portable.h"
15 #include "ldapconfig.h"
16 #include "rcpt500.h"
17
18 extern int dosyslog;
19
20
21 int
22 help_cmd( msgp, reply )
23     struct msginfo      *msgp;
24     char                *reply;
25 {
26     int         fd, len;
27
28     if (( fd = open( RCPT500_HELPFILE, O_RDONLY )) == -1 ) {
29         if ( dosyslog ) {
30             syslog( LOG_ERR, "open help file: %m" );
31         }
32         strcat( reply, "Unable to access the help file.  Sorry!\n" );
33         return( 0 );
34     }
35
36     len = read( fd, reply + strlen( reply ), MAXSIZE );
37     close( fd );
38
39     if ( len == -1 ) {
40         if ( dosyslog ) {
41             syslog( LOG_ERR, "read help file: %m" );
42         }
43         strcat( reply, "Unable to read the help file.  Sorry!\n" );
44         return( 0 );
45     }
46
47     *(reply + len ) = '\0';
48     return( 0 );
49 }