aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Gumz <akira@fluxbox.org>2015-01-28 19:28:58 (GMT)
committerMathias Gumz <akira@fluxbox.org>2015-01-28 19:28:58 (GMT)
commitaa39a1a666c6e9ec47bef9dfd570c3b6ca772b7b (patch)
tree26aedc4b567536cd2e7d1655f56d204acd9538e6
parent03ce82a4737b834767c03341db9362ada24c775a (diff)
downloadfluxbox-aa39a1a666c6e9ec47bef9dfd570c3b6ca772b7b.zip
fluxbox-aa39a1a666c6e9ec47bef9dfd570c3b6ca772b7b.tar.bz2
Fix mishandled [maxmized] statement in apps file
In f64727ca I removed one 'else' too much. As a result all [maximized] lines were mapped to MAX_NONE. Fixed. The rest of the commit is just some cosmetic to reduce indentation and shorten function names, easier to read.
-rw-r--r--src/ClientPattern.cc13
-rw-r--r--src/Remember.cc481
2 files changed, 248 insertions, 246 deletions
diff --git a/src/ClientPattern.cc b/src/ClientPattern.cc
index 696e70e..b848834 100644
--- a/src/ClientPattern.cc
+++ b/src/ClientPattern.cc
@@ -38,17 +38,8 @@
38#include <string> 38#include <string>
39#include <memory> 39#include <memory>
40#include <algorithm> 40#include <algorithm>
41#ifdef HAVE_CSTDIO 41#include <cstdio>
42 #include <cstdio> 42#include <cstring>
43#else
44 #include <stdio.h>
45#endif
46
47#ifdef HAVE_CSTRING
48 #include <cstring>
49#else
50 #include <string.h>
51#endif
52 43
53// needed as well for index on some systems (e.g. solaris) 44// needed as well for index on some systems (e.g. solaris)
54#include <strings.h> 45#include <strings.h>
diff --git a/src/Remember.cc b/src/Remember.cc
index 19ea5f0..a950005 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -60,6 +60,26 @@ using std::ofstream;
60using std::hex; 60using std::hex;
61using std::dec; 61using std::dec;
62 62
63using FbTk::StringUtil::getStringBetween;
64using FbTk::StringUtil::removeFirstWhitespace;
65using FbTk::StringUtil::removeTrailingWhitespace;
66using FbTk::StringUtil::toLower;
67using FbTk::StringUtil::toLower;
68using FbTk::StringUtil::extractNumber;
69using FbTk::StringUtil::expandFilename;
70
71namespace {
72
73inline bool isComment(std::string& line) {
74 removeFirstWhitespace(line);
75 removeTrailingWhitespace(line);
76 if (line.size() == 0 || line[0] == '#')
77 return true;
78 return false;
79}
80
81}
82
63/*------------------------------------------------------------------*\ 83/*------------------------------------------------------------------*\
64\*------------------------------------------------------------------*/ 84\*------------------------------------------------------------------*/
65 85
@@ -309,8 +329,7 @@ FbTk::Menu *createRememberMenu(BScreen &screen) {
309 329
310 _FB_USES_NLS; 330 _FB_USES_NLS;
311 331
312 typedef struct { bool is_alpha; const FbTk::BiDiString label; Remember::Attribute attr; } MenuEntry; 332 static const struct { bool is_alpha; const FbTk::BiDiString label; Remember::Attribute attr; } _entries[] = {
313 static const MenuEntry _entries[] = {
314 { false, _FB_XTEXT(Remember, Workspace, "Workspace", "Remember Workspace"), Remember::REM_WORKSPACE }, 333 { false, _FB_XTEXT(Remember, Workspace, "Workspace", "Remember Workspace"), Remember::REM_WORKSPACE },
315 { false, _FB_XTEXT(Remember, JumpToWorkspace, "Jump to workspace", "Change active workspace to remembered one on open"), Remember::REM_JUMPWORKSPACE }, 334 { false, _FB_XTEXT(Remember, JumpToWorkspace, "Jump to workspace", "Change active workspace to remembered one on open"), Remember::REM_JUMPWORKSPACE },
316 { false, _FB_XTEXT(Remember, Head, "Head", "Remember Head"), Remember::REM_HEAD}, 335 { false, _FB_XTEXT(Remember, Head, "Head", "Remember Head"), Remember::REM_HEAD},
@@ -346,15 +365,15 @@ FbTk::Menu *createRememberMenu(BScreen &screen) {
346// offset is the offset in the string that we start looking from 365// offset is the offset in the string that we start looking from
347// return true if all ok, false on error 366// return true if all ok, false on error
348bool handleStartupItem(const string &line, int offset) { 367bool handleStartupItem(const string &line, int offset) {
368
369 Fluxbox* fb = Fluxbox::instance();
370 unsigned int screen = fb->keyScreen()->screenNumber();
349 int next = 0; 371 int next = 0;
350 string str; 372 string str;
351 unsigned int screen = Fluxbox::instance()->keyScreen()->screenNumber();
352 373
353 // accept some options, for now only "screen=NN" 374 // accept some options, for now only "screen=NN"
354 // these option are given in parentheses before the command 375 // these option are given in parentheses before the command
355 next = FbTk::StringUtil::getStringBetween(str, 376 next = getStringBetween(str, line.c_str() + offset, '(', ')');
356 line.c_str() + offset,
357 '(', ')');
358 if (next > 0) { 377 if (next > 0) {
359 // there are some options 378 // there are some options
360 string option; 379 string option;
@@ -363,7 +382,7 @@ bool handleStartupItem(const string &line, int offset) {
363 if (pos > 0) { 382 if (pos > 0) {
364 option = str.substr(0, pos); 383 option = str.substr(0, pos);
365 if (strcasecmp(option.c_str(), "screen") == 0) { 384 if (strcasecmp(option.c_str(), "screen") == 0) {
366 error = !FbTk::StringUtil::extractNumber(str.c_str() + pos + 1, screen); 385 error = !extractNumber(str.c_str() + pos + 1, screen);
367 } else { 386 } else {
368 error = true; 387 error = true;
369 } 388 }
@@ -378,9 +397,7 @@ bool handleStartupItem(const string &line, int offset) {
378 next = 0; 397 next = 0;
379 } 398 }
380 399
381 next = FbTk::StringUtil::getStringBetween(str, 400 next = getStringBetween(str, line.c_str() + offset + next, '{', '}');
382 line.c_str() + offset + next,
383 '{', '}');
384 401
385 if (next <= 0) { 402 if (next <= 0) {
386 cerr<<"Error parsing [startup] at column "<<offset<<" - expecting {command}."<<endl; 403 cerr<<"Error parsing [startup] at column "<<offset<<" - expecting {command}."<<endl;
@@ -388,7 +405,7 @@ bool handleStartupItem(const string &line, int offset) {
388 } 405 }
389 406
390 // don't run command if fluxbox is restarting 407 // don't run command if fluxbox is restarting
391 if (Fluxbox::instance()->findScreen(screen)->isRestart()) 408 if (fb->findScreen(screen)->isRestart())
392 // the line was successfully read; we just didn't use it 409 // the line was successfully read; we just didn't use it
393 return true; 410 return true;
394 411
@@ -410,152 +427,146 @@ int parseApp(ifstream &file, Application &app, string *first_line = 0) {
410 _FB_USES_NLS; 427 _FB_USES_NLS;
411 int row = 0; 428 int row = 0;
412 while (! file.eof()) { 429 while (! file.eof()) {
413 if (first_line || getline(file, line)) { 430 if (!(first_line || getline(file, line))) {
414 if (first_line) { 431 continue;
415 line = *first_line; 432 }
416 first_line = 0;
417 }
418 433
419 row++; 434 if (first_line) {
420 FbTk::StringUtil::removeFirstWhitespace(line); 435 line = *first_line;
421 FbTk::StringUtil::removeTrailingWhitespace(line); 436 first_line = 0;
422 if (line.size() == 0 || line[0] == '#') 437 }
423 continue; //the line is commented or blank 438
424 439 row++;
425 int parse_pos = 0, err = 0; 440 if (isComment(line)) {
426 string str_key, str_option, str_label; 441 continue;
427 442 }
428 err = FbTk::StringUtil::getStringBetween(str_key,
429 line.c_str(),
430 '[', ']');
431 if (err > 0) {
432 int tmp;
433 tmp= FbTk::StringUtil::getStringBetween(str_option,
434 line.c_str() + err,
435 '(', ')');
436 if (tmp>0)
437 err += tmp;
438 }
439 if (err > 0 ) {
440 parse_pos += err;
441 FbTk::StringUtil::getStringBetween(str_label,
442 line.c_str() + parse_pos,
443 '{', '}');
444 } else
445 continue; //read next line
446 443
447 bool had_error = false; 444 string str_key, str_option, str_label;
445 int parse_pos = 0;
446 int err = getStringBetween(str_key, line.c_str(), '[', ']');
447 if (err > 0) {
448 int tmp = getStringBetween(str_option, line.c_str() + err, '(', ')');
449 if (tmp > 0)
450 err += tmp;
451 }
452 if (err > 0 ) {
453 parse_pos += err;
454 getStringBetween(str_label, line.c_str() + parse_pos, '{', '}');
455 } else
456 continue; //read next line
448 457
449 if (str_key.empty()) 458 bool had_error = false;
450 continue; //read next line
451 459
452 str_key = FbTk::StringUtil::toLower(str_key); 460 if (str_key.empty())
453 str_label = FbTk::StringUtil::toLower(str_label); 461 continue; //read next line
454 462
455 if (str_key == "workspace") { 463 str_key = toLower(str_key);
456 unsigned int w; 464 str_label = toLower(str_label);
457 if (FbTk::StringUtil::extractNumber(str_label, w)) 465
458 app.rememberWorkspace(w); 466 if (str_key == "workspace") {
459 else 467 unsigned int w;
460 had_error = true; 468 if (extractNumber(str_label, w))
461 } else if (str_key == "head") { 469 app.rememberWorkspace(w);
462 unsigned int h; 470 else
463 if (FbTk::StringUtil::extractNumber(str_label, h)) 471 had_error = true;
464 app.rememberHead(h); 472 } else if (str_key == "head") {
465 else 473 unsigned int h;
466 had_error = true; 474 if (extractNumber(str_label, h))
467 } else if (str_key == "layer") { 475 app.rememberHead(h);
468 int l = ResourceLayer::getNumFromString(str_label); 476 else
469 had_error = (l == -1); 477 had_error = true;
470 if (!had_error) 478 } else if (str_key == "layer") {
471 app.rememberLayer(l); 479 int l = ResourceLayer::getNumFromString(str_label);
472 } else if (str_key == "dimensions") { 480 had_error = (l == -1);
473 unsigned int h, w; 481 if (!had_error)
474 if (sscanf(str_label.c_str(), "%u %u", &w, &h) == 2) { 482 app.rememberLayer(l);
475 app.rememberDimensions(w, h, false); 483 } else if (str_key == "dimensions") {
476 } else if(sscanf(str_label.c_str(), "%u%% %u%%", &w, &h) == 2) { 484 unsigned int h, w;
477 app.rememberDimensions(w, h, true); 485 if (sscanf(str_label.c_str(), "%u %u", &w, &h) == 2) {
478 } else { 486 app.rememberDimensions(w, h, false);
479 had_error = true; 487 } else if(sscanf(str_label.c_str(), "%u%% %u%%", &w, &h) == 2) {
480 } 488 app.rememberDimensions(w, h, true);
481 } else if (str_key == "position") { 489 } else {
482 FluxboxWindow::ReferenceCorner r = FluxboxWindow::LEFTTOP; 490 had_error = true;
483 int x = 0, y = 0; 491 }
484 // more info about the parameter 492 } else if (str_key == "position") {
485 // in ::rememberPosition 493 FluxboxWindow::ReferenceCorner r = FluxboxWindow::LEFTTOP;
486 494 int x = 0, y = 0;
487 if (str_option.length()) 495 // more info about the parameter
488 r = FluxboxWindow::getCorner(str_option); 496 // in ::rememberPosition
489 had_error = (r == FluxboxWindow::ERROR); 497
490 498 if (str_option.length())
491 if (!had_error){ 499 r = FluxboxWindow::getCorner(str_option);
492 if(sscanf(str_label.c_str(), "%d %d", &x, &y) == 2) { 500 had_error = (r == FluxboxWindow::ERROR);
493 app.rememberPosition(x, y, false, r); 501
494 } else if (sscanf(str_label.c_str(), "%d%% %d%%", &x, &y) == 2){ 502 if (!had_error){
495 app.rememberPosition(x, y, true, r); 503 if(sscanf(str_label.c_str(), "%d %d", &x, &y) == 2) {
496 } 504 app.rememberPosition(x, y, false, r);
497 } else { 505 } else if (sscanf(str_label.c_str(), "%d%% %d%%", &x, &y) == 2){
498 had_error = true; 506 app.rememberPosition(x, y, true, r);
499 }
500 } else if (str_key == "shaded") {
501 app.rememberShadedstate(str_label == "yes");
502 } else if (str_key == "tab") {
503 app.rememberTabstate(str_label == "yes");
504 } else if (str_key == "focushidden") {
505 app.rememberFocusHiddenstate(str_label == "yes");
506 } else if (str_key == "iconhidden") {
507 app.rememberIconHiddenstate(str_label == "yes");
508 } else if (str_key == "hidden") {
509 app.rememberIconHiddenstate(str_label == "yes");
510 app.rememberFocusHiddenstate(str_label == "yes");
511 } else if (str_key == "deco") {
512 int deco = WindowState::getDecoMaskFromString(str_label);
513 if (deco == -1)
514 had_error = 1;
515 else
516 app.rememberDecostate((unsigned int)deco);
517 } else if (str_key == "alpha") {
518 int focused_a, unfocused_a;
519 switch (sscanf(str_label.c_str(), "%i %i", &focused_a, &unfocused_a)) {
520 case 1: // 'alpha <focus>'
521 unfocused_a = focused_a;
522 case 2: // 'alpha <focus> <unfocus>'
523 focused_a = FbTk::Util::clamp(focused_a, 0, 255);
524 unfocused_a = FbTk::Util::clamp(unfocused_a, 0, 255);
525 app.rememberAlpha(focused_a, unfocused_a);
526 break;
527 default:
528 had_error = true;
529 break;
530 } 507 }
531 } else if (str_key == "sticky") {
532 app.rememberStuckstate(str_label == "yes");
533 } else if (str_key == "focusnewwindow") {
534 app.rememberFocusNewWindow(str_label == "yes");
535 } else if (str_key == "minimized") {
536 app.rememberMinimizedstate(str_label == "yes");
537 } else if (str_key == "maximized") {
538 if (str_label == "yes")
539 app.rememberMaximizedstate(WindowState::MAX_FULL);
540 else if (str_label == "horz")
541 app.rememberMaximizedstate(WindowState::MAX_HORZ);
542 else if (str_label == "vert")
543 app.rememberMaximizedstate(WindowState::MAX_VERT);
544 app.rememberMaximizedstate(WindowState::MAX_NONE);
545 } else if (str_key == "fullscreen") {
546 app.rememberFullscreenstate(str_label == "yes");
547 } else if (str_key == "jump") {
548 app.rememberJumpworkspace(str_label == "yes");
549 } else if (str_key == "close") {
550 app.rememberSaveOnClose(str_label == "yes");
551 } else if (str_key == "end") {
552 return row;
553 } else { 508 } else {
554 cerr << _FB_CONSOLETEXT(Remember, Unknown, "Unknown apps key", "apps entry type not known")<<" = " << str_key << endl; 509 had_error = true;
555 } 510 }
556 if (had_error) { 511 } else if (str_key == "shaded") {
557 cerr<<"Error parsing apps entry: ("<<line<<")"<<endl; 512 app.rememberShadedstate(str_label == "yes");
513 } else if (str_key == "tab") {
514 app.rememberTabstate(str_label == "yes");
515 } else if (str_key == "focushidden") {
516 app.rememberFocusHiddenstate(str_label == "yes");
517 } else if (str_key == "iconhidden") {
518 app.rememberIconHiddenstate(str_label == "yes");
519 } else if (str_key == "hidden") {
520 app.rememberIconHiddenstate(str_label == "yes");
521 app.rememberFocusHiddenstate(str_label == "yes");
522 } else if (str_key == "deco") {
523 int deco = WindowState::getDecoMaskFromString(str_label);
524 if (deco == -1)
525 had_error = 1;
526 else
527 app.rememberDecostate((unsigned int)deco);
528 } else if (str_key == "alpha") {
529 int focused_a, unfocused_a;
530 switch (sscanf(str_label.c_str(), "%i %i", &focused_a, &unfocused_a)) {
531 case 1: // 'alpha <focus>'
532 unfocused_a = focused_a;
533 case 2: // 'alpha <focus> <unfocus>'
534 focused_a = FbTk::Util::clamp(focused_a, 0, 255);
535 unfocused_a = FbTk::Util::clamp(unfocused_a, 0, 255);
536 app.rememberAlpha(focused_a, unfocused_a);
537 break;
538 default:
539 had_error = true;
540 break;
558 } 541 }
542 } else if (str_key == "sticky") {
543 app.rememberStuckstate(str_label == "yes");
544 } else if (str_key == "focusnewwindow") {
545 app.rememberFocusNewWindow(str_label == "yes");
546 } else if (str_key == "minimized") {
547 app.rememberMinimizedstate(str_label == "yes");
548 } else if (str_key == "maximized") {
549 WindowState::MaximizeMode m = WindowState::MAX_NONE;
550 if (str_label == "yes")
551 m = WindowState::MAX_FULL;
552 else if (str_label == "horz")
553 m = WindowState::MAX_HORZ;
554 else if (str_label == "vert")
555 m = WindowState::MAX_VERT;
556 app.rememberMaximizedstate(m);
557 } else if (str_key == "fullscreen") {
558 app.rememberFullscreenstate(str_label == "yes");
559 } else if (str_key == "jump") {
560 app.rememberJumpworkspace(str_label == "yes");
561 } else if (str_key == "close") {
562 app.rememberSaveOnClose(str_label == "yes");
563 } else if (str_key == "end") {
564 return row;
565 } else {
566 cerr << _FB_CONSOLETEXT(Remember, Unknown, "Unknown apps key", "apps entry type not known")<<" = " << str_key << endl;
567 }
568 if (had_error) {
569 cerr<<"Error parsing apps entry: ("<<line<<")"<<endl;
559 } 570 }
560 } 571 }
561 return row; 572 return row;
@@ -709,8 +720,10 @@ void Remember::checkReload() {
709} 720}
710 721
711void Remember::reload() { 722void Remember::reload() {
712 string apps_string = FbTk::StringUtil::expandFilename(Fluxbox::instance()->getAppsFilename());
713 723
724 Fluxbox& fb = *Fluxbox::instance();
725 string apps_string = expandFilename(fb.getAppsFilename());
726 bool ok = true;
714 727
715 fbdbg<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl; 728 fbdbg<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl;
716 729
@@ -722,100 +735,98 @@ void Remember::reload() {
722 m_pats.reset(new Patterns()); 735 m_pats.reset(new Patterns());
723 m_startups.clear(); 736 m_startups.clear();
724 737
725 if (!apps_file.fail()) { 738 if (apps_file.fail()) {
726 if (!apps_file.eof()) { 739 ok = false;
727 string line; 740 cerr << "failed to open apps file " << apps_string << endl;
728 int row = 0; 741 }
729 bool in_group = false; 742
730 ClientPattern *pat = 0; 743 if (ok && apps_file.eof()) {
731 list<ClientPattern *> grouped_pats; 744 ok = false;
732 while (getline(apps_file, line) && ! apps_file.eof()) { 745 fbdbg<<"("<<__FUNCTION__<< ") Empty apps file" << endl;
733 row++; 746 }
734 FbTk::StringUtil::removeFirstWhitespace(line); 747
735 FbTk::StringUtil::removeTrailingWhitespace(line); 748 if (ok) {
736 if (line.size() == 0 || line[0] == '#') 749 string line;
737 continue; 750 int row = 0;
738 string key; 751 bool in_group = false;
739 int err=0; 752 ClientPattern *pat = 0;
740 int pos = FbTk::StringUtil::getStringBetween(key, 753 list<ClientPattern *> grouped_pats;
741 line.c_str(), 754 while (getline(apps_file, line) && ! apps_file.eof()) {
742 '[', ']'); 755 row++;
743 756
744 if (pos > 0 && (strcasecmp(key.c_str(), "app") == 0 || 757 if (isComment(line)) {
745 strcasecmp(key.c_str(), "transient") == 0)) { 758 continue;
746 ClientPattern *pat = new ClientPattern(line.c_str() + pos); 759 }
747 if (!in_group) { 760
748 if ((err = pat->error()) == 0) { 761 string key;
749 bool transient = (strcasecmp(key.c_str(), 762 int err=0;
750 "transient") == 0); 763 int pos = getStringBetween(key, line.c_str(), '[', ']');
751 Application *app = findMatchingPatterns(pat, 764 string lc_key = toLower(key);
752 old_pats, transient, false); 765
753 if (app) { 766 if (pos > 0 && (lc_key == "app" || lc_key == "transient")) {
754 app->reset(); 767 ClientPattern *pat = new ClientPattern(line.c_str() + pos);
755 reused_apps.insert(app); 768 if (!in_group) {
756 } else { 769 if ((err = pat->error()) == 0) {
757 app = new Application(transient, false); 770 bool transient = (lc_key == "transient");
758 } 771 Application *app = findMatchingPatterns(pat,
759 772 old_pats, transient, false);
760 m_pats->push_back(make_pair(pat, app)); 773 if (app) {
761 row += parseApp(apps_file, *app); 774 app->reset();
775 reused_apps.insert(app);
762 } else { 776 } else {
763 cerr<<"Error reading apps file at line "<<row<<", column "<<(err+pos)<<"."<<endl; 777 app = new Application(transient, false);
764 delete pat; // since it didn't work
765 } 778 }
779
780 m_pats->push_back(make_pair(pat, app));
781 row += parseApp(apps_file, *app);
766 } else { 782 } else {
767 grouped_pats.push_back(pat); 783 cerr<<"Error reading apps file at line "<<row<<", column "<<(err+pos)<<"."<<endl;
768 } 784 delete pat; // since it didn't work
769 } else if (pos > 0 && strcasecmp(key.c_str(), "startup") == 0 &&
770 Fluxbox::instance()->isStartup()) {
771 if (!handleStartupItem(line, pos)) {
772 cerr<<"Error reading apps file at line "<<row<<"."<<endl;
773 }
774 // save the item even if it was bad (aren't we nice)
775 m_startups.push_back(line.substr(pos));
776 } else if (pos > 0 && strcasecmp(key.c_str(), "group") == 0) {
777 in_group = true;
778 if (line.find('(') != string::npos)
779 pat = new ClientPattern(line.c_str() + pos);
780 } else if (in_group) {
781 // otherwise assume that it is the start of the attributes
782 Application *app = 0;
783 // search for a matching app
784 list<ClientPattern *>::iterator it = grouped_pats.begin();
785 list<ClientPattern *>::iterator it_end = grouped_pats.end();
786 while (!app && it != it_end) {
787 app = findMatchingPatterns(*it, old_pats, false,
788 in_group, pat);
789 ++it;
790 } 785 }
786 } else {
787 grouped_pats.push_back(pat);
788 }
789 } else if (pos > 0 && lc_key == "startup" && fb.isStartup()) {
790 if (!handleStartupItem(line, pos)) {
791 cerr<<"Error reading apps file at line "<<row<<"."<<endl;
792 }
793 // save the item even if it was bad (aren't we nice)
794 m_startups.push_back(line.substr(pos));
795 } else if (pos > 0 && lc_key == "group") {
796 in_group = true;
797 if (line.find('(') != string::npos)
798 pat = new ClientPattern(line.c_str() + pos);
799 } else if (in_group) {
800 // otherwise assume that it is the start of the attributes
801 Application *app = 0;
802 // search for a matching app
803 list<ClientPattern *>::iterator it = grouped_pats.begin();
804 list<ClientPattern *>::iterator it_end = grouped_pats.end();
805 for (; !app && it != it_end; ++it) {
806 app = findMatchingPatterns(*it, old_pats, false, in_group, pat);
807 }
791 808
792 if (!app) 809 if (!app)
793 app = new Application(false, in_group, pat); 810 app = new Application(false, in_group, pat);
794 else 811 else
795 reused_apps.insert(app); 812 reused_apps.insert(app);
796
797 while (!grouped_pats.empty()) {
798 // associate all the patterns with this app
799 m_pats->push_back(make_pair(grouped_pats.front(), app));
800 grouped_pats.pop_front();
801 }
802 813
803 // we hit end... probably don't have attribs for the group 814 while (!grouped_pats.empty()) {
804 // so finish it off with an empty application 815 // associate all the patterns with this app
805 // otherwise parse the app 816 m_pats->push_back(make_pair(grouped_pats.front(), app));
806 if (!(pos>0 && strcasecmp(key.c_str(), "end") == 0)) { 817 grouped_pats.pop_front();
807 row += parseApp(apps_file, *app, &line); 818 }
808 }
809 in_group = false;
810 } else
811 cerr<<"Error in apps file on line "<<row<<"."<<endl;
812 819
813 } 820 // we hit end... probably don't have attribs for the group
814 } else { 821 // so finish it off with an empty application
815 fbdbg<<"("<<__FUNCTION__<< ") Empty apps file" << endl; 822 // otherwise parse the app
823 if (!(pos>0 && lc_key == "end")) {
824 row += parseApp(apps_file, *app, &line);
825 }
826 in_group = false;
827 } else
828 cerr<<"Error in apps file on line "<<row<<"."<<endl;
816 } 829 }
817 } else {
818 cerr << "failed to open apps file" << endl;
819 } 830 }
820 831
821 // Clean up old state 832 // Clean up old state