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>
|
|
|
|
|
|
|
|
#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 "ldapconfig.h"
|
|
|
|
#include "rcpt500.h"
|
|
|
|
|
|
|
|
extern int dosyslog;
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
help_cmd( msgp, reply )
|
|
|
|
struct msginfo *msgp;
|
|
|
|
char *reply;
|
|
|
|
{
|
|
|
|
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 );
|
|
|
|
}
|