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