home *** CD-ROM | disk | FTP | other *** search
- # include <stdio.h>
- # include <bench.h>
- # include <proc.io>
- # include "field.h"
- # include "sup.h"
- # include "screen.h"
- # include "iodef.h"
-
- /*
- * Re-order the list of records, depending on the
- * direction we are adding additional records from
- */
- void reorder_mode(tab, head, lptr, direction)
- struct _table *tab;
- struct a_line **head, **lptr;
- int direction;
- {
- struct a_line *top, *bot, *tmp;
-
- /*
- * Find the End of the list
- */
- for (bot = *head; bot != ANULL; bot = bot->next)
- if (bot->next == ANULL)
- break;
-
- top = *head;
-
- if (direction == FORWARD)
- tmp = *head;
- else
- tmp = bot;
-
- /*
- * If there are > 1 on the list
- * then let's shuffle up
- */
- if (bot != *head)
- {
- bot->next = top;
- top->prev = bot;
-
- if (direction == BACKWARD)
- {
- bot->prev->next = ANULL;
- bot->prev = ANULL;
- *head = tmp = bot;
- }
- else /* forward */
- {
- *head = (*head)->next;
- top->next->prev = ANULL;
- top->next = ANULL;
- }
- }
-
- /*
- * Add the new one on to the freed up slot in the list
- */
- bytecpy(tmp->rec, tab->rec, tab->size);
-
- *lptr = tmp;
- }
-
-