Commit 1ce6c715 authored by Andrew Price's avatar Andrew Price
Browse files

Fix building src/utils/* and move the Header struct into src/mesg.h

parent fb7ffc65
......@@ -26,6 +26,7 @@
#include "socket.h"
#include "bb.h"
#include "who.h"
#include "user.h"
extern Alias rpc_list;
extern Alias event_list;
......
......@@ -11,6 +11,7 @@
#include "intl.h"
#include "mesg.h"
#include "bb.h"
#include "user.h"
void send_mesg(char *from, const char *to, char *text, int wiz)
{
......
#ifndef MESG_H
#define MESG_H
#include <folders.h>
#include "user.h"
#define SUBJECTSIZE 40
struct Header {
int32_t Ref;
int32_t date;
char from[NAMESIZE+1];
char to[SUBJECTSIZE+1];
char subject[SUBJECTSIZE+1];
int32_t datafield;
int32_t size;
char status;
int32_t replyto;
char spare[4]; /*adjust size as necessary */
};
/* Header.status
bit use
0 moderator approved
1 marked for deletion
2 has a reply
3 is a remote posting
4 -
5 -
6 -
7 -
*/
#include <mesg.h>
void broadcast(int state, const char *fmt, ...) __attribute__((format(printf,2,3)));
void inform_of_mail(char *to);
......
......@@ -10,10 +10,11 @@
#include "talker.h"
#include "main.h"
#include "strings.h"
#include "mesg.h"
#include "perms.h"
#include "bb.h"
#include "userio.h"
#include "user.h"
#include "mesg.h"
extern struct person *user;
......
......@@ -25,6 +25,7 @@
#include "util.h"
#include "intl.h"
#include "userio.h"
#include "user.h"
const char *partlist_search[]={
"status", "special", "groups", "chatprivs", "chatmode", "protpower",
......
#ifndef MW_MESG_H
#define MW_MESG_H
#include <user.h>
#define SUBJECTSIZE 40
struct Header {
int32_t Ref;
int32_t date;
char from[NAMESIZE+1];
char to[SUBJECTSIZE+1];
char subject[SUBJECTSIZE+1];
int32_t datafield;
int32_t size;
char status;
int32_t replyto;
char spare[4]; /*adjust size as necessary */
};
/* Header.status
bit use
0 moderator approved
1 marked for deletion
2 has a reply
3 is a remote posting
4 -
5 -
6 -
7 -
*/
#endif /* MW_MESG_H */
CFLAGS=
SRCROOT = $(CURDIR)/../..
DEPTH=../../
include ../../Makefile.common
LDFLAGS+= -L..
CFLAGS+= -I..
all: listuser fixuser del_user sizes
listuser: listuser.c ../bb.h
$(CC) $(CFLAGS) listuser.c -o listuser
listuser: listuser.o
$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
fixuser: fixuser.o
$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
del_user: del_user.o ../libmw.a
$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
fixuser: fixuser.c ../bb.h
$(CC) $(CFLAGS) fixuser.c -o fixuser
sizes: sizes.o
$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
del_user: del_user.c ../libmw.a ../client/userio.o
clean:
rm -f *.o *.d listuser fixuser del_user sizes
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "bb.h"
#include "files.h"
#include <unistd.h>
#include <time.h>
#include <bb.h>
#include <files.h>
#include <perms.h>
int internet=0;
struct person user;
main()
int main(void)
{
char newpath[1024];
const char *newpath = USERFILE ".new";
int newfile,oldfile;
char buff[20];
long tt=0l;
sprintf(newpath,"%s.new",USERFILE);
if ((oldfile=open(USERFILE,O_RDONLY))<0)
{
perror(USERFILE);
exit(0);
exit(1);
}
if ((newfile=open(newpath,O_WRONLY|O_CREAT,0600))<0)
{
perror(newpath);
exit(0);
exit(1);
}
while(read(oldfile,&user,sizeof(user))>0)
......@@ -34,18 +36,21 @@ main()
}else
{
time_t when = user.lastlogout;
char *line = NULL;
size_t len = 0;
char buff[20];
printf("Name: %s\tRname: %s\n",user.name,user.realname);
printf("Contact: %s\n",user.contact);
show_user_stats(user.status,buff,true);
show_user_stats(user.status,buff,1);
printf("Status [%s]\n",buff);
printf("Lastlogin %s", ctime(&when));
printf("\nDelete(y/n)?");
get_str(buff,3);
if(buff[0]!='y')
while ((getline(&line, &len, stdin) < 1) || line == NULL);
if (*line != 'y')
{
write(newfile,&user,sizeof(user));
}
if (buff[0]=='t') tt=user.lastlogout;
if (*line == 't') tt = user.lastlogout;
}
}
close(newfile);
......
......@@ -2,27 +2,28 @@
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include "../bb.h"
#include "../user.h"
#include <bb.h>
#include <user.h>
#include <files.h>
main()
int main(void)
{
struct person user;
char path[1024];
const char *path = USERFILE;
int count=0;
int ff, ff2;
snprintf(path, 1024, "%s/users.bb", HOMEPATH);
if ((ff=open(path, O_RDONLY))<0) {
fprintf(stderr, "%s: %s", path, strerror(errno));
exit(0);
exit(1);
}
if ((ff2=open("users.bb.new", O_WRONLY|O_CREAT, 0600))<0) {
fprintf(stderr, "users.bb.new: %s", strerror(errno));
exit(0);
exit(1);
}
while (read(ff, &user, sizeof(user))>0) {
......@@ -32,7 +33,7 @@ main()
if (!strcasecmp(user.name, "dot")) {
close(ff2);
close(ff);
exit(0);
exit(1);
}
}
close(ff);
......
......@@ -2,25 +2,26 @@
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include "../bb.h"
#include "../user.h"
#include <bb.h>
#include <user.h>
#include <files.h>
main(int argc, char **argv)
int main(int argc, char **argv)
{
struct person user;
char path[1024];
const char *path = USERFILE;
int count=0;
int ff;
if (argc<2)
snprintf(path, 1024, "%s/users.bb", HOMEPATH);
else
snprintf(path, 1024, "%s", argv[1]);
if (argc > 1)
path = argv[1];
if ((ff=open(path, O_RDONLY))<0) {
fprintf(stderr, "%s: %s", path, strerror(errno));
exit(0);
fprintf(stderr, "%s: %s\n", path, strerror(errno));
exit(1);
}
while (read(ff, &user, sizeof(user))>0) {
......
......@@ -3,17 +3,13 @@
#include <strings.h>
#include <stdlib.h>
#include <mesg.h>
#include "bb.h"
#include "user.h"
#include "files.h"
#include "folders.h"
#include "mesg.h"
void addmap(char *map, const char *name, char key, unsigned long size, void * offset, void * base);
void showmap(const char *map, unsigned long size);
void addmap(char *map, const char *name, char key,
static void addmap(char *map, const char *name, char key,
unsigned long size, void * offset, void * base)
{
int i;
......@@ -23,7 +19,7 @@ void addmap(char *map, const char *name, char key,
map[i]=key;
}
void showmap(const char *map, unsigned long size)
static void showmap(const char *map, unsigned long size)
{
int i;
printf("memmap: ");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment