]> code.citadel.org Git - citadel.git/blobdiff - citadel/client_chat.c
fix all the <time.h> vs. <sys/time.h> issues, hopefully
[citadel.git] / citadel / client_chat.c
index 849b94fc3dab76167f0e321586b03a0ae15a64b5..49418a5d26bc190b93e0b1c58d89155b052c1065 100644 (file)
 #include <string.h>
 #include <signal.h>
 #include <errno.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/types.h>
 #ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
@@ -40,14 +51,16 @@ extern struct CtdlServInfo serv_info;
 extern char temp[];
 void getline(char *, int);
 
+char last_paged[SIZ] = "";
+
 void chatmode(void)
 {
-       char wbuf[256];
-       char buf[256];
-       char c_user[256];
-       char c_text[256];
-       char c_room[256];
-       char last_user[256];
+       char wbuf[SIZ];
+       char buf[SIZ];
+       char c_user[SIZ];
+       char c_text[SIZ];
+       char c_room[SIZ];
+       char last_user[SIZ];
        int send_complete_line;
        int recv_complete_line;
        char ch;
@@ -216,8 +229,7 @@ void chatmode(void)
  */
 void page_user()
 {
-       static char last_paged[32] = "";
-       char buf[256], touser[256], msg[256];
+       char buf[SIZ], touser[SIZ], msg[SIZ];
        FILE *pagefp;
 
        strcpy(touser, last_paged);
@@ -255,7 +267,7 @@ void page_user()
                serv_gets(buf);
                if (buf[0] == '4') {
                        strcpy(last_paged, touser);
-                       while (fgets(buf, 256, pagefp) != NULL) {
+                       while (fgets(buf, sizeof buf, pagefp) != NULL) {
                                buf[strlen(buf) - 1] = 0;
                                serv_puts(buf);
                        }
@@ -274,7 +286,7 @@ void page_user()
 void quiet_mode(void)
 {
        int qstate;
-       char buf[256];
+       char buf[SIZ];
 
        serv_puts("DEXP 2");
        serv_gets(buf);