openldap/clients/rcpt500/help.c

52 lines
969 B
C
Raw Normal View History

1998-08-09 08:43:13 +08:00
/*
* help.c: for rcpt500 (X.500 email query responder)
*
* 16 June 1992 by Mark C Smith
* Copyright (c) 1992 The Regents of The University of Michigan
* All Rights Reserved
*/
1998-10-25 09:41:42 +08:00
#include "portable.h"
1998-08-09 08:43:13 +08:00
#include <stdio.h>
1998-10-25 09:41:42 +08:00
#include <ac/syslog.h>
#include <ac/string.h>
#include <ac/unistd.h>
1998-10-25 09:41:42 +08:00
#ifdef HAVE_FCNTL_H
1998-08-09 08:43:13 +08:00
#include <fcntl.h>
1998-10-25 09:41:42 +08:00
#endif
1998-08-09 08:43:13 +08:00
#include "ldap_defaults.h"
1998-08-09 08:43:13 +08:00
#include "rcpt500.h"
int
help_cmd(struct msginfo *msgp, char *reply)
1998-08-09 08:43:13 +08:00
{
int fd, len;
if (( fd = open( RCPT500_HELPFILE, O_RDONLY )) == -1 ) {
if ( dosyslog ) {
syslog( LOG_ERR, "open help file: %m" );
}
strcat( reply, "Unable to access the help file. Sorry!\n" );
return( 0 );
}
len = read( fd, reply + strlen( reply ), MAXSIZE );
close( fd );
if ( len == -1 ) {
if ( dosyslog ) {
syslog( LOG_ERR, "read help file: %m" );
}
strcat( reply, "Unable to read the help file. Sorry!\n" );
return( 0 );
}
*(reply + len ) = '\0';
return( 0 );
}