73 fprintf(stderr,
"unable to allocate %lu bytes for name_list\n",
78 nptr->
next = *list_head;
79 nptr->
name = strdup(name);
80 nptr->
ptr = (
ptr == NULL) ? (
char *)1 :
ptr;
106 for(nptr = list_head; nptr != NULL; nptr = nptr->
next) {
114 for(nptr = list_head; nptr != NULL; nptr = nptr->
next) {
121 for(nptr = list_head; nptr != NULL; nptr = nptr->
next) {
122 if(
match(nptr->
name, class->res_class)) {
150 for(nptr = list_head; nptr != NULL; nptr = nptr->
next)
156 for(nptr = list_head; nptr != NULL; nptr = nptr->
next)
161 for(nptr = list_head; nptr != NULL; nptr = nptr->
next)
162 if(
match(nptr->
name, class->res_class)) {
195 XClassHint *
class, Pixel *
ptr)
200 for(nptr = list_head; nptr != NULL; nptr = nptr->
next)
202 save =
Scr->FirstTime;
203 Scr->FirstTime =
true;
205 Scr->FirstTime = save;
210 for(nptr = list_head; nptr != NULL; nptr = nptr->
next)
212 save =
Scr->FirstTime;
213 Scr->FirstTime =
true;
215 Scr->FirstTime = save;
219 for(nptr = list_head; nptr != NULL; nptr = nptr->
next)
220 if(
match(nptr->
name, class->res_class)) {
221 save =
Scr->FirstTime;
222 Scr->FirstTime =
true;
224 Scr->FirstTime = save;
244 for(nptr = *list; nptr != NULL;) {
255bool match(
const char *pattern,
const char *
string)
260 if((pattern == NULL) || (
string == NULL)) {
263 error = regcomp(&preg, pattern, REG_EXTENDED | REG_NOSUB);
266 regerror(error, &preg, buf,
sizeof buf);
267 fprintf(stderr,
"%s : %s\n", buf, pattern);
270 error = regexec(&preg,
string, 5, 0, 0);
286static int is_pattern(
char *p)
308 char range_start, range_end;
313 for(; *p; p++, t++) {
315 return (*p ==
'*' && *++p ==
'\0') ? TRUE :
ABORT;
325 if(*p ==
'!' || *p ==
'^') {
332 member_match = FALSE;
340 range_start = range_end = *++p;
343 range_start = range_end = *p;
350 if(range_end ==
'\0' || range_end ==
']') {
353 if(range_end ==
'\\') {
358 if(range_start < range_end) {
359 if(*t >= range_start && *t <= range_end) {
365 if(*t >= range_end && *t <= range_start) {
371 if((invert && member_match) || !(invert || member_match)) {
404 while((*p ==
'?') || (*p ==
'*')) {
422 while(mat == FALSE) {
423 if(nextp == *t || nextp ==
'[') {
433int match(
const char *p,
const char *t)
435 if((p == NULL) || (t == NULL)) {
438 return ((
regex_match(p, t) == TRUE) ? TRUE : FALSE);
void DoShutdown(void)
Cleanup and exit ctwm.
bool GetColorFromList(name_list *list_head, char *name, XClassHint *class, Pixel *ptr)
void * LookInNameList(name_list *list_head, const char *name)
int match(const char *p, const char *t)
int regex_match_after_star(const char *p, const char *t)
bool IsInList(name_list *list_head, TwmWindow *twin)
void * LookInListWin(name_list *list_head, TwmWindow *twin)
void FreeList(name_list **list)
int regex_match(const char *p, const char *t)
void * LookPatternInList(name_list *list_head, const char *name, XClassHint *class)
void AddToList(name_list **list_head, const char *name, void *ptr)
void * LookInList(name_list *list_head, const char *name, XClassHint *class)
void * LookPatternInNameList(name_list *list_head, const char *name)
Info and control for every X Window we take over.
char * name
Current window name. Points into TwmWindow::names.
XClassHint class
Window class info. From XGetClassHint().
void GetColor(int kind, Pixel *what, const char *name)
Get info from the server about a given color.