|
|
1.1 root 1: #include <curses.h>
2: #include <stdio.h>
3: #include "contents.h"
4: #include "maillist.h"
5:
6: void add_mail(win1, row, col, screen_num)
7: WINDOW *win1;
8: int row, col, screen_num;
9: {
10:
11: WINDOW *master_win, *win3;
12:
13: wclear(win1);
14: wrefresh(win1);
15:
16: if((win3=newwin(3,30,20,0))==NULL)
17: {
18: noraw();
19: endwin();
20: printf("ADD MAIL: Could not allocate MSG Window!\n");
21: exit(1);
22: }
23:
24: if((master_win=newwin(5,45,STARTWIN)) == NULL)
25: {
26: noraw();
27: endwin();
28: printf("ADD MAIL: Could not allocate Master MAILREC Window!\n");
29: exit(1);
30: }
31:
32: if(open_mode == 'r')
33: display_mail(master_win,win3,row,col,screen_num);
34: else
35: {
36: add_del_screen(master_win);
37: get_info(win3,master_win, row, col,screen_num);
38: }
39:
40: delwin(win3);
41: delwin(master_win);
42:
43: }
44:
45: void add_del_screen(master_win)
46: WINDOW *master_win;
47: {
48: int x;
49:
50:
51: wmove(master_win,SITE);
52: waddstr(master_win,"Sitename:");
53: wmove(master_win,LOGIN);
54: waddstr(master_win,"Login:");
55: wmove(master_win,STATE);
56: waddstr(master_win,"State/Country:");
57: wmove(master_win,CITY);
58: waddstr(master_win,"City/Province/Other:");
59:
60: /* highlite the available fields */
61:
62: wmove(master_win,SITEHI);
63: for (x=0;x<sizeof(mail_rec.site);x++)
64: {
65: wstandout(master_win);
66: wprintw(master_win," ");
67: wstandend(master_win);
68: }
69:
70:
71: wmove(master_win,LOGHI);
72: for (x=0;x<sizeof(mail_rec.login);x++)
73: {
74: wstandout(master_win);
75: wprintw(master_win," ");
76: wstandend(master_win);
77: }
78:
79: wmove(master_win,STATEHI);
80: for (x=0;x<sizeof(mail_rec.state);x++)
81: {
82: wstandout(master_win);
83: wprintw(master_win," ");
84: wstandend(master_win);
85: }
86:
87: wmove(master_win,CITYHI);
88: for (x=0;x<sizeof(mail_rec.city);x++)
89: {
90: wstandout(master_win);
91: wprintw(master_win," ");
92: wstandend(master_win);
93: }
94:
95: wrefresh(master_win);
96: }
97:
98:
99: int get_info (win3, master_win, row, col, screen_num)
100: WINDOW * win3, *master_win;
101: int row, col, screen_num;
102:
103: {
104: FILE *outfp;
105: int x;
106: int rec_mark=POS_FORMULA;
107:
108: noraw();
109: echo();
110:
111: wmove(master_win,SITEHI);
112: wrefresh(master_win);
113: wgetstr(master_win,new_mail_rec.site);
114:
115: if(strlen(new_mail_rec.site)>0)
116: {
117: wmove(master_win,SITEHI);
118: wstandout(master_win);
119: waddstr(master_win,new_mail_rec.site);
120: wstandend(master_win);
121: wrefresh(master_win);
122: }
123:
124: else
125: return(1);
126:
127: /* pad the trailing spaces with NULLS to get rid of the extra curses
128: * garbage that may be in the string.
129: */
130:
131: for(x=strlen(new_mail_rec.site);x<sizeof(new_mail_rec.site);x++)
132: new_mail_rec.site[x] = '\0';
133:
134: do {
135: wmove(master_win,LOGHI);
136: wrefresh(master_win);
137: wgetstr(master_win,new_mail_rec.login);
138: wmove(master_win,LOGHI);
139: wstandout(master_win);
140: waddstr(master_win,new_mail_rec.login);
141: wstandend(master_win);
142: }
143: while(strlen(new_mail_rec.login) <1);
144:
145: for(x=strlen(new_mail_rec.login);x<sizeof(new_mail_rec.login);x++)
146: new_mail_rec.login[x] = '\0';
147:
148: wmove(master_win,STATEHI);
149: wrefresh(master_win);
150: wgetstr(master_win,new_mail_rec.state);
151: wmove(master_win,STATEHI);
152: wstandout(master_win);
153: waddstr(master_win,new_mail_rec.state);
154: wstandend(master_win);
155:
156: for(x=strlen(new_mail_rec.state);x<sizeof(new_mail_rec.state);x++)
157: new_mail_rec.state[x] = '\0';
158:
159: wmove(master_win,CITYHI);
160: wrefresh(master_win);
161: wgetstr(master_win,new_mail_rec.city);
162: wmove(master_win,CITYHI);
163: wstandout(master_win);
164: waddstr(master_win,new_mail_rec.city);
165: wstandend(master_win);
166:
167: for(x=strlen(new_mail_rec.city);x<sizeof(new_mail_rec.city);x++)
168: new_mail_rec.city[x] = '\0';
169:
170: raw();
171: noecho();
172: del_rec(win3, row, col, screen_num);
173: uucp_upd();
174: wclear(master_win);
175: wrefresh(master_win);
176:
177: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.