#include <mit-copyright.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/file.h>
#include <krb.h>
#include <errno.h>
#include "query.h"
get_motd(cl)
client *cl;
{
- FILE *motd;
+ int motd, len;
char buffer[1024];
char *arg[1];
arg[0] = buffer;
cl->reply.sms_status = 0;
- motd = fopen(SMS_MOTD_FILE, "r");
- if (motd == NULL) return;
- fgets(buffer, sizeof(buffer), motd);
- fclose(motd);
+ motd = open(SMS_MOTD_FILE, 0, O_RDONLY);
+ if (motd < 0) return;
+ len = read(motd, buffer, sizeof(buffer) - 1);
+ close(motd);
+ buffer[len] = 0;
retr_callback(1, arg, cl);
cl->reply.sms_status = 0;
}