1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: menubar.c |
2 | * File: menubar.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA> |
5 | * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA> |
|
|
6 | * Copyright (c) 2004 Marc Lehmann <pcg@goof.com> |
6 | * |
7 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * (at your option) any later version. |
… | |
… | |
22 | * summary that appears at the end of this file was taken from there. |
23 | * summary that appears at the end of this file was taken from there. |
23 | *----------------------------------------------------------------------*/ |
24 | *----------------------------------------------------------------------*/ |
24 | |
25 | |
25 | #include "../config.h" /* NECESSARY */ |
26 | #include "../config.h" /* NECESSARY */ |
26 | |
27 | |
27 | #include <stdlib.h> |
28 | #include <cstdlib> |
28 | #include <wchar.h> |
|
|
29 | |
29 | |
30 | #include "rxvt.h" /* NECESSARY */ |
30 | #include "rxvt.h" /* NECESSARY */ |
31 | #ifdef MENUBAR |
31 | #ifdef MENUBAR |
32 | #include "version.h" |
32 | #include "version.h" |
33 | #include "menubar.h" |
33 | #include "menubar.h" |
… | |
… | |
1707 | } |
1707 | } |
1708 | } |
1708 | } |
1709 | else if ((n = rxvt_Str_match (str, "pixmap:")) != 0) |
1709 | else if ((n = rxvt_Str_match (str, "pixmap:")) != 0) |
1710 | { |
1710 | { |
1711 | str += n; |
1711 | str += n; |
1712 | xterm_seq (XTerm_Pixmap, str, CHAR_ST); |
1712 | process_xterm_seq (XTerm_Pixmap, str, CHAR_ST); |
1713 | } |
1713 | } |
1714 | #if (MENUBAR_MAX > 1) |
1714 | #if (MENUBAR_MAX > 1) |
1715 | else if ((n = rxvt_Str_match (str, "rm")) != 0) |
1715 | else if ((n = rxvt_Str_match (str, "rm")) != 0) |
1716 | { |
1716 | { |
1717 | str += n; |
1717 | str += n; |
… | |
… | |
1760 | sprintf (buffer, "/tmp/" RESCLASS "-%u", |
1760 | sprintf (buffer, "/tmp/" RESCLASS "-%u", |
1761 | (unsigned int)getpid ()); |
1761 | (unsigned int)getpid ()); |
1762 | |
1762 | |
1763 | if ((fp = fopen (buffer, "wb")) != NULL) |
1763 | if ((fp = fopen (buffer, "wb")) != NULL) |
1764 | { |
1764 | { |
1765 | xterm_seq (XTerm_title, buffer, CHAR_ST); |
1765 | process_xterm_seq (XTerm_title, buffer, CHAR_ST); |
1766 | menubar_dump (fp); |
1766 | menubar_dump (fp); |
1767 | fclose (fp); |
1767 | fclose (fp); |
1768 | } |
1768 | } |
1769 | } |
1769 | } |
1770 | else if (!STRCMP (str, "next")) |
1770 | else if (!STRCMP (str, "next")) |
… | |
… | |
1847 | if (name != NULL || str != NULL) |
1847 | if (name != NULL || str != NULL) |
1848 | { |
1848 | { |
1849 | if (name == NULL || str == NULL || str <= (name + 1) |
1849 | if (name == NULL || str == NULL || str <= (name + 1) |
1850 | || (name > path && name[-1] != '/')) |
1850 | || (name > path && name[-1] != '/')) |
1851 | { |
1851 | { |
1852 | rxvt_print_error ("menu error <%s>\n", path); |
1852 | rxvt_warn ("menu error A<%s>, continuing.\n", path); |
1853 | break; |
1853 | break; |
1854 | } |
1854 | } |
1855 | if (str[1] == MENUITEM_BEG) |
1855 | if (str[1] == MENUITEM_BEG) |
1856 | { |
1856 | { |
1857 | name2 = (str + 2); |
1857 | name2 = (str + 2); |
1858 | str = STRCHR (name2, MENUITEM_END); |
1858 | str = STRCHR (name2, MENUITEM_END); |
1859 | |
1859 | |
1860 | if (str == NULL) |
1860 | if (str == NULL) |
1861 | { |
1861 | { |
1862 | rxvt_print_error ("menu error <%s>\n", path); |
1862 | rxvt_warn ("menu error B<%s>, continuing.\n", path); |
1863 | break; |
1863 | break; |
1864 | } |
1864 | } |
1865 | name2[-2] = '\0'; /* remove prev MENUITEM_END */ |
1865 | name2[-2] = '\0'; /* remove prev MENUITEM_END */ |
1866 | } |
1866 | } |
1867 | if (name > path && name[-1] == '/') |
1867 | if (name > path && name[-1] == '/') |