4 * This module implementsserver commands related to the display and
5 * manipulation of user "bio" files.
17 #include <sys/types.h>
25 #include "sysdep_decls.h"
26 #include "citserver.h"
30 #include "dynloader.h"
44 void cmd_ebio(char *cmdbuf) {
49 if (!(CC->logged_in)) {
50 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
54 sprintf(cbuf,"./bio/%ld",CC->usersupp.usernum);
57 cprintf("%d Cannot create file\n",ERROR);
60 cprintf("%d \n",SEND_LISTING);
61 while(client_gets(&ibuf), strcmp(ibuf,"000")) {
62 fprintf(fp,"%s\n",ibuf);
70 void cmd_rbio(char *cmdbuf)
72 struct usersupp ruser;
76 extract(buf,cmdbuf,0);
77 if (getuser(&ruser,buf)!=0) {
78 cprintf("%d No such user.\n",ERROR+NO_SUCH_USER);
81 sprintf(buf,"./bio/%ld",ruser.usernum);
83 cprintf("%d OK|%s|%ld|%d|%ld|%ld|%ld\n", LISTING_FOLLOWS,
84 ruser.fullname, ruser.usernum, ruser.axlevel,
85 ruser.lastcall, ruser.timescalled, ruser.posted);
88 cprintf("%s has no bio on file.\n", ruser.fullname);
90 while (fgets(buf,256,fp)!=NULL) cprintf("%s",buf);
97 * list of users who have entered bios
99 void cmd_lbio(char *cmdbuf) {
102 struct usersupp usbuf;
104 ls=popen("cd ./bio; ls","r");
106 cprintf("%d Cannot open listing.\n",ERROR+FILE_NOT_FOUND);
110 cprintf("%d\n",LISTING_FOLLOWS);
111 while (fgets(buf,sizeof buf,ls)!=NULL)
112 if (getuserbynumber(&usbuf,atol(buf))==0)
113 cprintf("%s\n",usbuf.fullname);
121 char *Dynamic_Module_Init(void)
123 CtdlRegisterProtoHook(cmd_ebio, "EBIO", "Enter your bio");
124 CtdlRegisterProtoHook(cmd_rbio, "RBIO", "Read a user's bio");
125 CtdlRegisterProtoHook(cmd_lbio, "LBIO", "List users with bios");