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>
|
Protoized, moved extern definitions to .h files, fixed related bugs.
Most function and variable definitions are now preceded by its extern
definition, for error checking. Retyped a number of functions, usually
to return void. Fixed a number of printf format errors.
API changes (in ldap/include):
Added avl_dup_ok, avl_prefixapply, removed ber_fatten (probably typo
for ber_flatten), retyped ldap_sort_strcasecmp, grew lutil.h.
A number of `extern' declarations are left (some added by protoize), to
be cleaned away later. Mostly strdup(), strcasecmp(), mktemp(), optind,
optarg, errno.
1998-11-16 06:40:11 +08:00
|
|
|
#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
|
|
|
|
1999-06-17 11:54:25 +08:00
|
|
|
#include "ldap_defaults.h"
|
1998-08-09 08:43:13 +08:00
|
|
|
#include "rcpt500.h"
|
|
|
|
|
|
|
|
|
|
|
|
int
|
Protoized, moved extern definitions to .h files, fixed related bugs.
Most function and variable definitions are now preceded by its extern
definition, for error checking. Retyped a number of functions, usually
to return void. Fixed a number of printf format errors.
API changes (in ldap/include):
Added avl_dup_ok, avl_prefixapply, removed ber_fatten (probably typo
for ber_flatten), retyped ldap_sort_strcasecmp, grew lutil.h.
A number of `extern' declarations are left (some added by protoize), to
be cleaned away later. Mostly strdup(), strcasecmp(), mktemp(), optind,
optarg, errno.
1998-11-16 06:40:11 +08:00
|
|
|
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 );
|
|
|
|
}
|