* $Id$
*/
+#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>
#include <string.h>
#include <limits.h>
+#ifdef HAVE_PTHREAD_H
#include <pthread.h>
+#endif
#include "citadel.h"
#include "server.h"
#include <syslog.h>
#define MODULE_NAME "Import an unpacked system"
#define MODULE_AUTHOR "Art Cancro"
#define MODULE_EMAIL "ajc@uncnsrd.mt-kisco.ny.us"
-#define MAJOR_VERSION 0
-#define MINOR_VERSION 3
+#define MAJOR_VERSION 1
+#define MINOR_VERSION 0
static struct DLModule_Info info = {
MODULE_NAME,
void import_message(long msgnum, long msglen) {
char *msgtext;
- msgtext = malloc(msglen);
+ msgtext = mallok(msglen);
if (msgtext == NULL) {
lprintf(3, "ERROR: cannot allocate memory\n");
lprintf(3, "Your data files are now corrupt.\n");
fread(msgtext, msglen, 1, imfp);
cdb_store(CDB_MSGMAIN, &msgnum, sizeof(long), msgtext, msglen);
- free(msgtext);
+ phree(msgtext);
}
void imp_floors(void) {
while(fpgetfield(imfp, key), strcasecmp(key, "endsection")) {
if (!strcasecmp(key, "floor")) {
- bzero(&fl, sizeof(struct floor));
+ memset(&fl, 0, sizeof(struct floor));
while(fpgetfield(imfp, tag),
strcasecmp(tag, "endfloor")) {
while(fpgetfield(imfp, key), strcasecmp(key, "endsection")) {
if (!strcasecmp(key, "room")) {
- bzero(&qr, sizeof(struct quickroom));
+ memset(&qr, 0, sizeof(struct quickroom));
msglist = NULL;
num_msgs = 0;
lprintf(9, "Room ");
msglen = atol(tval);
import_message(msgnum, msglen);
++num_msgs;
- msglist = realloc(msglist,
+ msglist = reallok(msglist,
(sizeof(long)*num_msgs) );
msglist[num_msgs - 1] = msgnum;
}
CC->num_msgs = num_msgs;
put_msglist(&qr);
}
- free(msglist);
+ phree(msglist);
}
}
char key[256], value[256];
struct usersupp us;
- bzero(&us, sizeof(struct usersupp));
+ memset(&us, 0, sizeof(struct usersupp));
while(fpgetfield(imfp, key), strcasecmp(key, "enduser")) {
if (strcasecmp(key, "mail")) {
fpgetfield(imfp, value);
void do_import(char *argbuf) {
char import_filename[PATH_MAX];
+
+ if (CC->internal_pgm == 0) {
+ cprintf("%d This command is for internal programs only.\n",
+ ERROR);
+ return;
+ }
extract(import_filename, argbuf, 0);
imfp = fopen(import_filename, "rb");
fprintf(exfp, "qrpasswd%c%s%c", 0, qr->QRpasswd, 0);
fprintf(exfp, "qrroomaide%c%ld%c", 0, qr->QRroomaide, 0);
fprintf(exfp, "qrhighest%c%ld%c", 0, qr->QRhighest, 0);
- fprintf(exfp, "qrgen%c%ld%c", 0, qr->QRgen, 0);
+ fprintf(exfp, "qrgen%c%ld%c", 0, (long)qr->QRgen, 0);
fprintf(exfp, "qrflags%c%d%c", 0, qr->QRflags, 0);
fprintf(exfp, "qrdirname%c%s%c", 0, qr->QRdirname, 0);
fprintf(exfp, "qrinfo%c%ld%c", 0, qr->QRinfo, 0);
fprintf(exfp, "qrfloor%c%d%c", 0, qr->QRfloor, 0);
- fprintf(exfp, "qrmtime%c%ld%c", 0, qr->QRmtime, 0);
+ fprintf(exfp, "qrmtime%c%ld%c", 0, (long)qr->QRmtime, 0);
fprintf(exfp, "qrepmode%c%d%c", 0, qr->QRep.expire_mode, 0);
fprintf(exfp, "qrepvalue%c%d%c", 0, qr->QRep.expire_value, 0);
fprintf(exfp, "usscreenwidth%c%d%c", 0, us->USscreenwidth, 0);
fprintf(exfp, "usscreenheight%c%d%c", 0, us->USscreenheight, 0);
fprintf(exfp, "usernum%c%ld%c", 0, us->usernum, 0);
- fprintf(exfp, "lastcall%c%ld%c", 0, us->lastcall, 0);
+ fprintf(exfp, "lastcall%c%ld%c", 0, (long)us->lastcall, 0);
fprintf(exfp, "usname%c%s%c", 0, us->USname, 0);
fprintf(exfp, "usaddr%c%s%c", 0, us->USaddr, 0);
fprintf(exfp, "uscity%c%s%c", 0, us->UScity, 0);
void do_export(char *argbuf) {
char export_filename[PATH_MAX];
+
+ if (CC->internal_pgm == 0) {
+ cprintf("%d This command is for internal programs only.\n",
+ ERROR);
+ return;
+ }
extract(export_filename, argbuf, 0);
exfp = fopen(export_filename, "wb");