comparison srogue/options.c @ 217:94a0d9dd5ce1

Super-Rogue: convert to ANSI-style function declarations. This fixes most of the build warnings.
author John "Elwin" Edwards
date Sun, 31 Jan 2016 13:45:07 -0500
parents 458df24e973d
children d71e5e1f49cf
comparison
equal deleted inserted replaced
216:b24545357d2e 217:94a0d9dd5ce1
28 char *o_opt; /* pointer to thing to set */ 28 char *o_opt; /* pointer to thing to set */
29 }; 29 };
30 30
31 typedef struct optstruct OPTION; 31 typedef struct optstruct OPTION;
32 32
33 int put_str(), get_str(); 33 int allowchange(OPTION *opt);
34 34
35 OPTION optlist[] = { 35 OPTION optlist[] = {
36 { "name", "Name: ", whoami }, 36 { "name", "Name: ", whoami },
37 { "fruit", "Fruit: ", fruit }, 37 { "fruit", "Fruit: ", fruit },
38 { "file", "Save file: ", file_name } 38 { "file", "Save file: ", file_name }
44 #define NUM_SOPTS (sizeof safeoptlist / sizeof (OPTION)) 44 #define NUM_SOPTS (sizeof safeoptlist / sizeof (OPTION))
45 45
46 /* 46 /*
47 * print and then set options from the terminal 47 * print and then set options from the terminal
48 */ 48 */
49 option() 49 void
50 option(void)
50 { 51 {
51 reg OPTION *op; 52 reg OPTION *op;
52 reg int wh; 53 reg int wh;
53 OPTION *olist; 54 OPTION *olist;
54 int olen; 55 int olen;
104 /* 105 /*
105 * get_str: 106 * get_str:
106 * Set a string option 107 * Set a string option
107 */ 108 */
108 #define CTRLB 2 109 #define CTRLB 2
109 get_str(opt, awin) 110 int
110 char *opt; 111 get_str(char *opt, WINDOW *awin)
111 WINDOW *awin;
112 { 112 {
113 reg char *sp; 113 reg char *sp;
114 reg int c, oy, ox; 114 reg int c, oy, ox;
115 char buf[LINLEN]; 115 char buf[LINLEN];
116 116
117 draw(awin); 117 draw(awin);
118 getyx(awin, oy, ox); 118 getyx(awin, oy, ox);
119 /* 119 /*
120 * loop reading in the string, and put it in a temporary buffer 120 * loop reading in the string, and put it in a temporary buffer
121 */ 121 */
122 for (sp = buf; (c=readchar(awin)) != '\n' && c != '\r' && c != ESCAPE; 122 for (sp = buf; (c=readchar()) != '\n' && c != '\r' && c != ESCAPE;
123 wclrtoeol(awin), draw(awin)) { 123 wclrtoeol(awin), draw(awin)) {
124 if (sp - buf >= 50) { 124 if (sp - buf >= 50) {
125 *sp = '\0'; /* line was too long */ 125 *sp = '\0'; /* line was too long */
126 strucpy(opt,buf,strlen(buf)); 126 strucpy(opt,buf,strlen(buf));
127 mvwaddstr(awin, 0, 0, "Name was truncated --More--"); 127 mvwaddstr(awin, 0, 0, "Name was truncated --More--");
184 * the string is a series of comma seperated values, with strings 184 * the string is a series of comma seperated values, with strings
185 * being "name=....", with the string being defined up to a comma 185 * being "name=....", with the string being defined up to a comma
186 * or the end of the entire option string. 186 * or the end of the entire option string.
187 */ 187 */
188 188
189 parse_opts(str) 189 void
190 char *str; 190 parse_opts(char *str)
191 { 191 {
192 reg char *sp; 192 reg char *sp;
193 reg OPTION *op; 193 reg OPTION *op;
194 reg int len; 194 reg int len;
195 195
229 } 229 }
230 230
231 /* 231 /*
232 * copy string using unctrl for things 232 * copy string using unctrl for things
233 */ 233 */
234 strucpy(s1, s2, len) 234 void
235 char *s1, *s2; 235 strucpy(char *s1, char *s2, int len)
236 int len;
237 { 236 {
238 reg char *sp; 237 reg char *sp;
239 238
240 while (len-- > 0) { 239 while (len-- > 0) {
241 strcpy(s1, (sp = unctrl(*s2))); 240 strcpy(s1, (sp = unctrl(*s2)));