]> git.pld-linux.org Git - packages/blackbox.git/blob - blackbox-pipe.patch
ab9453cd92263dcca5e154ad67c13591
[packages/blackbox.git] / blackbox-pipe.patch
1 --- blackbox-0.62.1/src/Screen.cc       Sat Jan 12 12:13:09 2002
2 +++ blackbox-0.62.1.with_pipe/src/Screen.cc     Sun Mar  3 20:32:30 2002
3 @@ -1710,7 +1710,13 @@
4    Bool defaultMenu = True;
5  
6    if (blackbox->getMenuFilename()) {
7 -    FILE *menu_file = fopen(blackbox->getMenuFilename(), "r");
8 +    int pipe_menu = 0;
9 +       FILE *menu_file;
10 +       if (*(blackbox->getMenuFilename()) == '|') {
11 +               pipe_menu = 1;
12 +               menu_file = popen((blackbox->getMenuFilename()) + 1, "r");
13 +       } 
14 +    else menu_file = fopen(blackbox->getMenuFilename(), "r");
15  
16      if (!menu_file) {
17        perror(blackbox->getMenuFilename());
18 @@ -1758,7 +1764,8 @@
19           }
20         }
21        }
22 -      fclose(menu_file);
23 +         if (pipe_menu) pclose(menu_file);
24 +      else fclose(menu_file);
25      }
26    }
27  
28 @@ -1958,12 +1965,18 @@
29             }
30  
31             if (newfile) {
32 -             FILE *submenufile = fopen(newfile, "r");
33 +                 int pipe_submenu = 0;
34 +                 FILE *submenufile;
35 +                 if (*newfile == '|') {
36 +                   pipe_submenu = 1;
37 +                       submenufile = popen(newfile + 1, "r");
38 +                 }
39 +             else submenufile = fopen(newfile, "r");
40  
41               if (submenufile) {
42                  struct stat buf;
43 -                if (fstat(fileno(submenufile), &buf) ||
44 -                    (! S_ISREG(buf.st_mode))) {
45 +                if (!pipe_submenu && (fstat(fileno(submenufile), &buf) ||
46 +                    (! S_ISREG(buf.st_mode)))) {
47                    fprintf(stderr,
48                           i18n->getMessage(ScreenSet, ScreenINCLUDEErrorReg,
49                              "BScreen::parseMenuFile: [include] error: "
50 @@ -1974,8 +1987,8 @@
51                 if (! feof(submenufile)) {
52                   if (! parseMenuFile(submenufile, menu))
53                     blackbox->saveMenuFilename(newfile);
54 -
55 -                 fclose(submenufile);
56 +          if (pipe_submenu) pclose(submenufile);
57 +                 else fclose(submenufile);
58                 }
59               } else
60                 perror(newfile);
This page took 0.08131 seconds and 3 git commands to generate.