1 /* xtermset: change some settings of an xterm from the command line */
2 
3 /*
4 ** Copyright (C) 2000 Breyten J. Ernsting <bje@dds.nl>
5 **
6 ** This program is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU General Public License as published by
8 ** the Free Software Foundation; either version 2 of the License, or
9 ** (at your option) any later version.
10 **
11 ** This program is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ** GNU General Public License for more details.
15 **
16 ** You should have received a copy of the GNU General Public License
17 ** along with this program; if not, write to the Free Software
18 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 **
20 */
21 
22 /* this was orginally 'setxtitle' in the splitvt package,
23  * created by Sam Lantinga(slouken@cs.ucdavis.edu)
24  * rewritten by Breyten Ernsting (bje@dds.nl)
25  * and again by Decklin Foster (decklin@home.com) */
26 
27 #ifndef __XTERMSET_H__
28 #define __XTERMSET_H__
29 
30 #ifdef HAVE_CONFIG_H
31 #include "../config.h"
32 #else
33 #define PACKAGE         "xtermset"
34 #define VERSION		"0.5.2"
35 #endif /* HAVE_CONFIG_H */
36 
37 #ifdef STDC_HEADERS
38 #include <stdio.h>
39 #include <stdlib.h>
40 #include <string.h>
41 #include <assert.h>
42 #endif /* STDC_HEADERS */
43 
44 #define ESC		"\033"
45 #define BEL		"\07"
46 #define RCFILE		".xtermsetrc"
47 #define TERMSFILE	"terms"
48 #define MAXFNCHARS	255
49 #define MAXOPTCHARS	255
50 #define MAXTERMCHARS	255
51 
52 #define BasicOption		1
53 #define ShortOption		2
54 #define GeomOption		3
55 #define UnknownOption		4
56 #define SwitchOption		5
57 #define ComplexSwitchOption	6
58 
59 #define boTitle			2
60 #define boIconName		1
61 #define boForeGround		10
62 #define boBackGround		11
63 #define boTextCursor		12
64 #define boMouseForeGround	13
65 #define boMouseBackGround	14
66 #define boTEKForeGround		15
67 #define boTEKBackGround		16
68 #define boHighlightCursor	17
69 #define boFont			50
70 
71 #define goGeom			(-1)
72 
73 #define soIconify		2
74 #define soRestore		1
75 #define soRefresh		7
76 
77 #define swForce			0
78 
79 #define cswStore		1
80 #define cswDefault		2
81 
82 #define toStart			1
83 #define toEnd			2
84 
85 #define OPTION(name, code, style) \
86 if (strcmp(arg, "-" name) == 0) { *code_return = code; return style; }
87 
88 #define CHECK if(switches[0])
89 
90 #define CHECKFORCOMMAND if ((i + 1 < argc) && (strncmp(argv[i+1],"-",1)!=0)) { \
91    strcpy(argptr->param,argv[++i]); \
92 }
93 
94 #define MALLOCOPTION argptr=argument_new(style,code,NULL);
95 
96 /* argument stuff */
97 
98 typedef struct argument {
99    int style;
100    int command;
101    char param[MAXOPTCHARS-1];
102    struct argument *next,*previous;
103 } argument;
104 
105 extern argument *first,*current;
106 
107 argument *argument_new(int style, int code, char *param);
108 void argument_freeall();
109 argument *argument_first();
110 argument *argument_last();
111 argument *argument_next();
112 argument *argument_prev();
113 void argument_save();
114 argument *argument_pop();
115 argument *argument_delete(int afree);
116 argument *argument_find(int style, int code);
117 
118 /* term stuff */
119 typedef struct good_term {
120   int comp_type;
121   char name[MAXTERMCHARS];
122   struct good_term *next;
123 } good_term;
124 
125 extern good_term *first_term, *cur_term;
126 
127 good_term *term_new(int comp_type, char *name, int len);
128 void term_freeall();
129 good_term *term_first();
130 good_term *term_last();
131 good_term *term_next();
132 good_term *term_prev();
133 good_term *term_find(int comp_type, char *name);
134 void term_loadall();
135 
136 void version();
137 void usage();
138 void gplinfo();
139 int nextopt();
140 void set_geom();
141 int is_good_term(); /* 1 if good terminal */
142 FILE *open_rc_file(char *fn,char *mode);
143 #endif /* __XTERMSET_H__ */
144 
145