* More paginator changes. Shuffled code around, added pagination to a bunch
authorArt Cancro <ajc@citadel.org>
Mon, 10 Apr 2000 01:47:23 +0000 (01:47 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 10 Apr 2000 01:47:23 +0000 (01:47 +0000)
  of other functions, and replaced the old, cumbersome pagination with the
  new, easy, API-based one in everything except message output.

citadel/ChangeLog
citadel/commands.c
citadel/commands.h
citadel/rooms.c
citadel/routines.c
citadel/routines.h
citadel/routines2.c

index 9fee335d8c8063c0c8a5014dfc27200fb059d65e..99e4d78423d031fc67b883d098fc392453a99792 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 570.18  2000/04/10 01:47:22  ajc
+ * More paginator changes.  Shuffled code around, added pagination to a bunch
+   of other functions, and replaced the old, cumbersome pagination with the
+   new, easy, API-based one in everything except message output.
+
  Revision 570.17  2000/04/09 17:51:18  ajc
  * Added pprintf() (paginated version of printf) to the client-side API.  Now
    any client side function can be paginated simply by changing all of the
@@ -1841,3 +1846,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
index 9e6719544e96ac8fec223cee99ac1e527492e7c0..844a2e9b2404f3bf4cdb9852f0d5b16e8400c75e 100644 (file)
@@ -83,6 +83,27 @@ int enable_color = 0;                        /* nonzero for ANSI color */
 
 
 
+/*
+ * Check to see if we need to pause at the end of a screen.
+ * If we do, we have to disable server keepalives during the pause because
+ * we are probably in the middle of a server operation and the NOOP command
+ * would confuse everything.
+ */
+int checkpagin(int lp, int pagin, int height)
+{
+       if (!pagin) return(0);
+       if (lp>=(height-1)) {
+               set_keepalives(KA_NO);
+               hit_any_key();
+               set_keepalives(KA_YES);
+               return(0);
+               }
+       return(lp);
+       }
+
+
+
+
 /*
  * pprintf()  ...   paginated version of printf()
  */
index 6ade37ce7e0b64e4b227bc7d748c96a47275783c..968e1980b7ce0044d1f53776918a872ec110c3fe 100644 (file)
@@ -50,9 +50,11 @@ void keyopt(char *);
 char keymenu(char *menuprompt, char *menustring);
 void async_ka_start(void);
 void async_ka_end(void);
+int checkpagin(int lp, int pagin, int height);
 void pprintf(const char *format, ...);
 
 
+
 extern int num_urls;
 extern char urls[MAXURLS][256];
 extern char rc_url_cmd[256];
index dd17496890ffb5e3f2c404666742f17c549f722e..fcc65c3ef6310281f3bf965166111bed102bf4a8 100644 (file)
@@ -41,7 +41,6 @@ void progress(long int curr, long int cmax);
 int pattern(char *search, char *patn);
 int file_checksum(char *filename);
 int nukedir(char *dirname);
-int checkpagin(int lp, int pagin, int height); 
 
 extern unsigned room_flags;
 extern char room_name[];
@@ -64,8 +63,6 @@ extern char ugname[];
 
 extern char floorlist[128][256];
 
-int knlinecount;
-
 
 void load_floorlist(void) {
        int a;
@@ -105,12 +102,7 @@ void room_tree_list(struct roomlisting *rp) {
                if ((c + strlen(rmname) + 4) > screenwidth) {
 
                        /* line break, check the paginator */
-                       printf("\n");
-                       knlinecount = knlinecount + 1;
-                       knlinecount = checkpagin(knlinecount,
-                                   ((userflags & US_PAGINATOR) ? 1 : 0),
-                                              screenheight);
-
+                       pprintf("\n");
                        c = 1;
                        }
                        if (f & QR_MAILBOX) {
@@ -122,11 +114,11 @@ void room_tree_list(struct roomlisting *rp) {
                else {
                        color(DIM_WHITE);
                        }
-               printf("%s",rmname);
-               if ((f & QR_DIRECTORY) && (f & QR_NETWORK)) printf("}  ");
-               else if (f & QR_DIRECTORY) printf("]  ");
-               else if (f & QR_NETWORK) printf(")  ");
-               else printf(">  ");
+               pprintf("%s",rmname);
+               if ((f & QR_DIRECTORY) && (f & QR_NETWORK)) pprintf("}  ");
+               else if (f & QR_DIRECTORY) pprintf("]  ");
+               else if (f & QR_NETWORK) pprintf(")  ");
+               else pprintf(">  ");
                c = c + strlen(rmname) + 3;
                }
 
@@ -220,10 +212,10 @@ void list_other_floors(void) {
        c = 1;
        for (a=0; a<128; ++a) if ((strlen(floorlist[a])>0)&&(a!=curr_floor)) {
                if ((c + strlen(floorlist[a]) + 4) > screenwidth) {
-                       printf("\n");
+                       pprintf("\n");
                        c = 1;
                        }
-               printf("%s:  ",floorlist[a]);
+               pprintf("%s:  ",floorlist[a]);
                c = c + strlen(floorlist[a]) + 3;
                }
        }
@@ -239,51 +231,41 @@ void knrooms(int kn_floor_mode)
        int a;
 
        load_floorlist();
-       knlinecount = 0;
 
        if (kn_floor_mode == 0) {
                color(BRIGHT_CYAN);
-               printf("\n   Rooms with unread messages:\n");
-               knlinecount = knlinecount + 2;
+               pprintf("\n   Rooms with unread messages:\n");
                listrms("LKRN");
                color(BRIGHT_CYAN);
-               printf("\n\n   No unseen messages in:\n");
-               knlinecount = knlinecount + 3;
+               pprintf("\n\n   No unseen messages in:\n");
                listrms("LKRO");
-               printf("\n");
-               knlinecount = knlinecount + 1;
+               pprintf("\n");
                }
 
        if (kn_floor_mode == 1) {
                color(BRIGHT_CYAN);
-               printf("\n   Rooms with unread messages on %s:\n",
+               pprintf("\n   Rooms with unread messages on %s:\n",
                        floorlist[(int)curr_floor]);
-               knlinecount = knlinecount + 2;
-               sprintf(buf,"LKRN %d",curr_floor);
+               sprintf(buf,"LKRN %d", curr_floor);
                listrms(buf);
                color(BRIGHT_CYAN);
-               printf("\n\n   Rooms with no new messages on %s:\n",
+               pprintf("\n\n   Rooms with no new messages on %s:\n",
                        floorlist[(int)curr_floor]);
-               knlinecount = knlinecount + 3;
                sprintf(buf,"LKRO %d",curr_floor);
                listrms(buf);
                color(BRIGHT_CYAN);
-               printf("\n\n   Other floors:\n");
-               knlinecount = knlinecount + 3;
+               pprintf("\n\n   Other floors:\n");
                list_other_floors();
-               printf("\n");
-               knlinecount = knlinecount + 1;
+               pprintf("\n");
                }
 
        if (kn_floor_mode == 2) {
                for (a=0; a<128; ++a) if (floorlist[a][0]!=0) {
                        color(BRIGHT_CYAN);
-                       printf("\n   Rooms on %s:\n",floorlist[a]);
-                       knlinecount = knlinecount + 2;
+                       pprintf("\n   Rooms on %s:\n",floorlist[a]);
                        sprintf(buf,"LKRA %d",a);
                        listrms(buf);
-                       printf("\n");
-                       knlinecount = knlinecount + 1;
+                       pprintf("\n");
                        }
                }
        
@@ -294,9 +276,9 @@ void knrooms(int kn_floor_mode)
 
 void listzrooms(void) {                /* list public forgotten rooms */
        color(BRIGHT_CYAN);
-       printf("\n   Forgotten public rooms:\n");
+       pprintf("\n   Forgotten public rooms:\n");
        listrms("LZRM");
-       printf("\n");
+       pprintf("\n");
        color(DIM_WHITE);
        IFNEXPERT hit_any_key();
        }
@@ -912,13 +894,13 @@ void whoknows(void) {
        serv_puts("WHOK");
        serv_gets(buf);
        if (buf[0]!='1') {
-               printf("%s\n",&buf[5]);
+               pprintf("%s\n",&buf[5]);
                return;
                }
        sigcaught = 0;
        sttybbs(SB_YES_INTR);
        while (serv_gets(buf), strncmp(buf,"000",3)) {
-               if (sigcaught==0) printf("%s\n",buf);
+               if (sigcaught==0) pprintf("%s\n",buf);
                }
        sttybbs(SB_NO_INTR);
        }
index d93fc04a7a7c400abea98a2c76771661cee63683..e7c08a9a0edf13aaf6c9c87ac7724febb39571e3 100644 (file)
@@ -295,25 +295,6 @@ void interr(int errnum)    /* display internal error as defined in errmsgs */
 
 
 
-/*
- * Check to see if we need to pause at the end of a screen.
- * If we do, we have to disable server keepalives during the pause because
- * we are probably in the middle of a server operation and the NOOP command
- * would confuse everything.
- */
-int checkpagin(int lp, int pagin, int height)
-{
-       if (!pagin) return(0);
-       if (lp>=(height-1)) {
-               set_keepalives(KA_NO);
-               hit_any_key();
-               set_keepalives(KA_YES);
-               return(0);
-               }
-       return(lp);
-       }
-
-
 void strproc(char *string)
 {
        int a;
index d176a232f4074e6d414dfe0783d7a86e4c6a7430..8e37f89762e3f74f290d52b490d91ba2a6b6de4e 100644 (file)
@@ -2,7 +2,6 @@
 void edituser(void);
 void interr(int errnum);
 int struncmp(char *lstr, char *rstr, int len);
-int checkpagin(int lp, int pagin, int height);
 int pattern(char *search, char *patn);
 void enter_config(int mode);
 void locate_host(char *hbuf);
index d4e07c9292291e75c1eb6eb69ff50c53bb732e7f..5af1700f54455a694b443afd571d944606ae5906 100644 (file)
@@ -575,18 +575,18 @@ void list_bio(void)
        serv_puts("LBIO");
        serv_gets(buf);
        if (buf[0] != '1') {
-               printf("%s\n", &buf[4]);
+               pprintf("%s\n", &buf[4]);
                return;
        }
        while (serv_gets(buf), strcmp(buf, "000")) {
                if ((pos + strlen(buf) + 5) > screenwidth) {
-                       printf("\n");
+                       pprintf("\n");
                        pos = 1;
                }
-               printf("%s, ", buf);
+               pprintf("%s, ", buf);
                pos = pos + strlen(buf) + 2;
        }
-       printf("%c%c  \n\n", 8, 8);
+       pprintf("%c%c  \n\n", 8, 8);
 }
 
 
@@ -600,7 +600,7 @@ void read_bio(void)
 
        do {
                newprompt("Read bio for who ('?' for list) : ", who, 25);
-               printf("\n");
+               pprintf("\n");
                if (!strcmp(who, "?"))
                        list_bio();
        } while (!strcmp(who, "?"));
@@ -608,11 +608,11 @@ void read_bio(void)
        serv_puts(buf);
        serv_gets(buf);
        if (buf[0] != '1') {
-               printf("%s\n", &buf[4]);
+               pprintf("%s\n", &buf[4]);
                return;
        }
        while (serv_gets(buf), strcmp(buf, "000")) {
-               printf("%s\n", buf);
+               pprintf("%s\n", buf);
        }
 }