"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "xmsql-0.4.2/flist.c" of archive xmsql-0.4.2.tgz:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1 /*--------------------------------------------------------------*/
2 /* */
3 /* xmsql version 0.4 */
4 /* */
5 /* xmsql is a X interface to the mSQL database */
6 /* */
7 /* xmsql is distributed WITHOUT ANY WARRENTY; */
8 /* see README for details. */
9 /* Copyright (C) 1995 Stefan Dupont-Christ */
10 /* Heavily modified by Debursky Ko (debursky@deb.lumax.com.tw) */
11 /*--------------------------------------------------------------*/
12
13 #include <X11/Intrinsic.h>
14 #include <X11/StringDefs.h>
15 #include <ctype.h>
16 #include <stdio.h>
17 #include <string.h>
18
19 #include "common.h"
20 #include "flist.h"
21
22 FILE *fp;
23
24 void insertFld(Flist *head, Flist *flist)
25 {
26 flist->next = head;
27 flist->prev = head->prev;
28 head->prev->next = flist;
29 head->prev = flist;
30 }
31
32 void removeFld()
33 {
34 cMsql.flist->prev->next = cMsql.flist->next;
35 cMsql.flist->next->prev = cMsql.flist->prev;
36 }
37
38 void reorderFlds()
39 {
40 int i;
41
42 for (i = 0; i < cMsql.fldsCount ; i++) {
43 if (cMsql.flist->fldno == -1) break;
44 cMsql.flist->fldno = i;
45 cMsql.flist = cMsql.flist->next;
46 }
47
48 }
49
50 void rewindFlds()
51 {
52
53 if (cMsql.flist->fldno == -1)
54 cMsql.flist = cMsql.flist->prev;
55
56 while (cMsql.flist->fldno > 0) {
57 cMsql.flist = cMsql.flist->prev;
58 if (debug) fprintf(fp,"Flist Rewinding %s(%d)\n",
59 cMsql.flist->fld, cMsql.flist->type);
60 }
61 }
62
63 void emptyFlds()
64 {
65 Flist *tmpflist = cMsql.flist;
66
67 if (cMsql.fldsCount == 0) return;
68 while (cMsql.fldsCount-- > 0) {
69 cMsql.flist = cMsql.flist->prev;
70 removeFld();
71 if (debug) fprintf(debugfp,"Flist Removing %s(%d)\n",
72 cMsql.flist->fld, cMsql.flist->type);
73 }
74 cMsql.flist = tmpflist;
75 }
76
77 void seekFld(int pos)
78 {
79
80 rewindFlds();
81 while ((cMsql.flist = cMsql.flist->next)->fldno < pos) {
82 if (debug) fprintf(debugfp,"Flist Rewinding %s(%d)\n",
83 cMsql.flist->fld, cMsql.flist->type);
84 }
85 }
86
87 void DecreaseField()
88 {
89
90 seekFld(hs.lastcolumn);
91 removeFld(cMsql.flist);
92 }
93
94 void debugField(Widget widget, XtPointer clientData, XtPointer callData)
95 {
96 int i=0;
97
98 setStatusLine("On Debugging Xmsql Fileds!");
99
100 fp = fopen("/xmsql-0.4/xmsql.log","w+");
101
102 rewindFlds();
103
104 while (cMsql.flist->fldno > -1) {
105 fprintf(fp,"%d Field: type %c\tname %s \tlen %d\n",
106 cMsql.flist->fldno,
107 cMsql.flist->type,
108 cMsql.flist->fld,
109 cMsql.flist->length);
110 cMsql.flist = cMsql.flist->next;
111 }
112 fclose (fp);
113 view(widget,clientData,callData);
114 }
115
116
117
118