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);
84 cprintf("%d %s has no bio on file.\n",
85 ERROR+FILE_NOT_FOUND,ruser.fullname);
88 cprintf("%d \n",LISTING_FOLLOWS);
89 while (fgets(buf,256,fp)!=NULL) cprintf("%s",buf);
95 * list of users who have entered bios
97 void cmd_lbio(char *cmdbuf) {
100 struct usersupp usbuf;
102 ls=popen("cd ./bio; ls","r");
104 cprintf("%d Cannot open listing.\n",ERROR+FILE_NOT_FOUND);
108 cprintf("%d\n",LISTING_FOLLOWS);
109 while (fgets(buf,255,ls)!=NULL)
110 if (getuserbynumber(&usbuf,atol(buf))==0)
111 cprintf("%s\n",usbuf.fullname);
119 char *Dynamic_Module_Init(void)
121 CtdlRegisterProtoHook(cmd_ebio, "EBIO", "Enter your bio");
122 CtdlRegisterProtoHook(cmd_rbio, "RBIO", "Read a user's bio");
123 CtdlRegisterProtoHook(cmd_lbio, "LBIO", "List users with bios");