1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00
Commit Graph

22 Commits

Author SHA1 Message Date
Christophe CURIS
9f9ef6417e Utils: Use the constants added in config-paths.h for paths
Replace hard-coded directory names by the constants that have been
previously added to the common header.
2021-08-10 09:42:43 +01:00
Rodolfo García Peñas (kix)
7759d06851 wmgenmenu.c Removed format-truncation
This patch removes the format-truncation warning. The problem is because buf and comm are arrays with the same size (PATH_MAX). In the snprintf, comm is copied to buf, more some extra characters. The patch reduces the size for the array comm in the extra characters. Without the patch, the comm array is truncated. With the patch, the same characters are copied, without the warning.

wmgenmenu.c: In function ‘find_and_write’:
wmgenmenu.c:436:41: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
     snprintf(buf, sizeof(buf), "%s -e %s", terminal ? terminal : "xterm" , comm);
                                         ^
wmgenmenu.c:436:5: note: ‘snprintf’ output 5 or more bytes (assuming 4105) into a destination of size 4104
     snprintf(buf, sizeof(buf), "%s -e %s", terminal ? terminal : "xterm" , comm);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2019-06-20 22:04:31 +01:00
Christophe CURIS
3de5b8fb42 util: removed usage of external '__progname' because it is not portable
As reported by Milan Čermák, using this variable breaks compilation on
Solaris, because it is a hack which is not standard. To ensure portability,
we now rely on main's argv[0] which is always available.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:08:59 +01:00
Christophe CURIS
b75ac967d9 util: clarify a bit of the code for parsing commands in wmgenmenu
When a command is given for a menu to be run through a terminal, there is
a piece of code that removes everything from a '!' to the end of the line.

The original code was too dense and not really optimal, so this patch
proposes a more explicit code, mainly for maintainability.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-07-06 01:07:55 +01:00
Christophe CURIS
36ac3b3344 util: fix possible buffer overrun in the function that create L2 menus (Coverity #50219)
As pointed by Coverity, the buffer used to store the command for the menu
has a fixed size, so a check is welcome to avoid buffer overflow.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-16 20:00:09 +01:00
Carlos R. Mafra
17c93f0947 wmgenmenu: Write paths according to options set at configure time
As reported by Shawn W Dunn, the configuration strings written by wmgenmenu
in $HOME/GNUstep/Defaults/WMRootMenu were not reflecting his installation
directories choices.

Fix this by writing strings composed with PKGDATADIR.
2014-04-24 10:47:45 +01:00
Christophe CURIS
5770e53c50 Fixed a few improper macro usages
Added compiler checks for some improper macro usage and fixed the problems
pointed by gcc.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:13:33 +00:00
Christophe CURIS
f8b6871371 util: Added noreturn attribute to appropriate functions
clang is a bit more strict on the attribute usage, so let's comply.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
5d03c455fc util: Added 'const' attribute to function parameters 2013-05-12 01:01:19 +01:00
Carlos R. Mafra
6bf5f947a9 wmgenmenu: Fix "Save Theme"
Dario Niedermann reported on 27.11.2011:

       Selecting "Save Theme" from WMaker's root menu results in dialog box
       asking for theme name, but then nothing is saved.

       This feature used to work in 0.92.0.

and the reason for it (if he uses a WMRootMenu generated by wmgenmenu) is
the incorrect use of the option "-t" instead of "-p" to getstyle.

Furthermore, let the invocation of getstyle reflect the new default location
for the themes.
2012-01-15 04:12:14 +00:00
Tamas TEVESZ
5fa8b979b9 Amend recent wmgenmenu changes
Raise MAX_NR_APPS to account for the more menu entries
2011-04-10 22:13:29 -07:00
Tamas TEVESZ
f65b99e615 Remove warnings
* Remove assigned but not used variables (GCC 4.6)
* Bump _XOPEN_SOURCE to 600, ridding of FreeBSD warnings (this probably need
  to be tweaked on a per-implementation basis as problems arise)
2011-03-24 16:19:52 +01:00
Andreas Metzler
be8a5d4a45 Do not mark product names as translatable
There is no point in trying to translate trademarks/product names like
Window Maker or OpenSUSE, stop marking these strings as translatable.
2010-10-07 12:04:29 +02:00
Carlos R. Mafra
be065e3bf4 Add /usr/local/share/WindowMaker dir to wmgenmenu 2010-08-29 14:55:14 +02:00
Tamas TEVESZ
4247ac9f82 Add i18n labels to wmgenmenu 2010-04-12 09:58:37 +02:00
Tamas TEVESZ
22978af5a6 Add nice labels to wmgenmenu 2010-04-12 09:58:37 +02:00
Tamas TEVESZ
68a55be998 Poke wmgenmenu some more
- change some variable names to better reflect their purpose, do a little
  write-up how a menu is built
- auto-detect what terminal to use for apps in need of a terminal
- fix the chunk that adds the terminal-based apps
2010-04-08 15:53:50 +02:00
Tamas TEVESZ
c165beeb4b Poke wmgenmenu, part 2
- Convert to using WINGs PropList functions
- Add mwm to other_wm, remove ee from Graphics while here
2010-04-02 10:15:58 +02:00
Tamas TEVESZ
daad5ed828 Poke wmgenmenu
- add help and usage, to bring it in line with other tools
- if no item in any particular group was found, don't write an
  empty group
2010-04-02 10:13:15 +02:00
Renato Botelho
0f5c36a67e Fix non-I18N build
* Remove directly include of <libintl.h> and include src/wconfig.h, that
already include libintl.h and declare _() function
* Replace some gettext() calls to _()

These changes fixes build with LINGUAS is unset, and removes I18N
support in this case.
2010-03-26 21:08:17 +01:00
Carlos R. Mafra
5178465bb6 Remove DEBUG statements, #if 0 etc
...and some other cleanups.
2010-03-20 18:42:56 +01:00
Carlos R. Mafra
1861880239 wmgenmenu: A Window Maker menu generator
The inspiration comes from Geir T. Kristiansen's 'genmenu' shell script
(http://gtk.no/genmenu) which I have been hapilly using for
the last 9 years or so.

That script generates the Window Maker menu by asking a few questions
and checks whether the applications in a predefined list exist in
the user's $PATH, so that the menu contains only the applications
which are guaranteed to exist and which the user cares about.

However I always thought it was a bit slow to finish, even
when having a file containing the answers to the questions to
be piped in.

And as Kristiansen states in his webpage, his script does not
support internationalization:

   "If you want internationalization I really suggest you rewrite
    genmenu from scratch anyway in a more sensible language and remove
    other limitations while you are at it."

so I decided to rewrite in C and make it support internationalization
(only English and German so far). While I am not sure yet if I removed
"other limitations while you are at it" I definitely made it finish faster.
This C program does not make you questions though.

But in the same spirit as the author of 'genmenu', who says:

    "Genmenu is a hack, deal with it, it just happens to serve my needs."

I present you 'wmgenmenu', which you can use like this:

wmgenmenu > /home/mafra/GNUstep/Defaults/WMRootMenu

and the menu is automatically generated from the list of
predefined apps which are contained in the C sources (wmgenmenu.h).

And when you generate the WMRootMenu as above, wmaker will automatically
load the new menu for you (due to the 'inotify' mechanism in wmaker-crm).

As for 'wmgenmenu' being faster than 'genmenu':

[mafra@Pilar:~]$ time ./genmenu.sh < answers.txt &> /dev/null

real    0m3.626s
user    0m0.968s
sys     0m1.830s

[mafra@Pilar:~]$ time wmgenmenu &> /dev/null

real    0m0.020s
user    0m0.006s
sys     0m0.013s
2010-02-21 11:51:00 +01:00