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) {
48 if (!(CC->logged_in)) {
49 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
53 sprintf(buf,"./bio/%ld",CC->usersupp.usernum);
56 cprintf("%d Cannot create file\n",ERROR);
59 cprintf("%d \n",SEND_LISTING);
60 while(client_gets(buf), strcmp(buf,"000")) {
61 fprintf(fp,"%s\n",buf);
69 void cmd_rbio(char *cmdbuf)
71 struct usersupp ruser;
75 extract(buf,cmdbuf,0);
76 if (getuser(&ruser,buf)!=0) {
77 cprintf("%d No such user.\n",ERROR+NO_SUCH_USER);
80 sprintf(buf,"./bio/%ld",ruser.usernum);
82 cprintf("%d OK|%s|%ld|%d|%ld|%ld|%ld\n", LISTING_FOLLOWS,
83 ruser.fullname, ruser.usernum, ruser.axlevel,
84 ruser.lastcall, ruser.timescalled, ruser.posted);
87 cprintf("%s has no bio on file.\n", ruser.fullname);
89 while (fgets(buf,256,fp)!=NULL) cprintf("%s",buf);
96 * list of users who have entered bios
98 void cmd_lbio(char *cmdbuf) {
101 struct usersupp usbuf;
103 ls=popen("cd ./bio; ls","r");
105 cprintf("%d Cannot open listing.\n",ERROR+FILE_NOT_FOUND);
109 cprintf("%d\n",LISTING_FOLLOWS);
110 while (fgets(buf,sizeof buf,ls)!=NULL)
111 if (getuserbynumber(&usbuf,atol(buf))==0)
112 cprintf("%s\n",usbuf.fullname);
120 char *Dynamic_Module_Init(void)
122 CtdlRegisterProtoHook(cmd_ebio, "EBIO", "Enter your bio");
123 CtdlRegisterProtoHook(cmd_rbio, "RBIO", "Read a user's bio");
124 CtdlRegisterProtoHook(cmd_lbio, "LBIO", "List users with bios");