Repository navigation
Expand file tree
/
Copy pathEXCSHOW.C
More file actions
89 lines (78 loc) · 2.49 KB
/
Copy pathEXCSHOW.C
File metadata and controls
89 lines (78 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <stdlib.h>
#include <string.h>
#include "zedit.h"
struct bufline *excshow(
union both_scr *posptr,
register struct lineptrs *place,
int maxlrecl)
/**********************************************************************/
/* */
/* Process exclude show/first/last line commands. */
/* */
/**********************************************************************/
/* */
/* This is ZEDIT source material. */
/* */
/* ZEDIT Source Materials are intellectual property */
/* (c) Copyright 1987,2001 by Clyde Thomas Zuber. */
/* */
/**********************************************************************/
{
register struct bufline *pos;
struct bufline *top;
struct bufline *bot;
register int s;
int forw;
int snum;
if (place -> excst)
{
forw = YES;
pos = place -> excst;
place -> excst = NULL;
} /* end then */
else
{
forw = NO;
pos = place -> excfn;
place -> excfn = NULL;
} /* end else */
top = pos -> bblk;
bot = pos;
if (pos -> rcnt < place -> count)
snum = pos -> rcnt;
else
snum = place -> count;
place -> count = 0;
/* calculate the number of lines remaining excluded */
pos -> rcnt -= snum;
if (!(pos -> rcnt))
{
/* show the whole thing and exit */
for (pos = top -> next; pos != bot; pos = pos -> next)
pos -> status ^= ST_EXCL;
return(excremv(top, &snum));
} /* end then */
if (forw)
{
/* reset first lines and move BYPS line down */
for (s = 0, pos = top -> next; s < snum; ++s, pos = pos -> next)
pos -> status ^= ST_EXCL;
place -> movest = top;
place -> movefn = top;
place -> after = pos -> prev;
movelin(posptr, place, maxlrecl);
} /* end then */
else
{
/* reset last lines and move XBLK line up */
for (s = 0, pos = bot -> prev; s < snum; ++s, pos = pos -> prev)
pos -> status ^= ST_EXCL;
place -> movest = bot;
place -> movefn = bot;
place -> after = pos;
movelin(posptr, place, maxlrecl);
} /* end else */
/* redo the XBLK record */
excxblk(bot);
return(bot);
} /* end excshow */