]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_bio.c
fix all the <time.h> vs. <sys/time.h> issues, hopefully
[citadel.git] / citadel / serv_bio.c
index 37543c89c60cb3f208b8ee6bb8127c83b8154bf6..7915bbfb5d367f255b7ddd0487a08e1057ec1963 100644 (file)
 #include <pwd.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <sys/time.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
 #include <sys/wait.h>
 #include <string.h>
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include <time.h>
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
@@ -79,15 +89,16 @@ void cmd_rbio(char *cmdbuf)
        }
        sprintf(buf,"./bio/%ld",ruser.usernum);
        
+       cprintf("%d OK|%s|%ld|%d|%ld|%ld|%ld\n", LISTING_FOLLOWS,
+               ruser.fullname, ruser.usernum, ruser.axlevel,
+               ruser.lastcall, ruser.timescalled, ruser.posted);
        fp = fopen(buf,"r");
-       if (fp == NULL) {
-               cprintf("%d %s has no bio on file.\n",
-                       ERROR+FILE_NOT_FOUND,ruser.fullname);
-               return;
+       if (fp == NULL)
+               cprintf("%s has no bio on file.\n", ruser.fullname);
+       else {
+               while (fgets(buf,256,fp)!=NULL) cprintf("%s",buf);
+               fclose(fp);
        }
-       cprintf("%d  \n",LISTING_FOLLOWS);
-       while (fgets(buf,sizeof buf,fp)!=NULL) cprintf("%s",buf);
-       fclose(fp);
        cprintf("000\n");
 }
 
@@ -106,7 +117,7 @@ void cmd_lbio(char *cmdbuf) {
        }
 
        cprintf("%d\n",LISTING_FOLLOWS);
-       while (fgets(buf,255,ls)!=NULL)
+       while (fgets(buf,sizeof buf,ls)!=NULL)
                if (getuserbynumber(&usbuf,atol(buf))==0)
                        cprintf("%s\n",usbuf.fullname);
        pclose(ls);