mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 05:18:06 +01:00
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>
This commit is contained in:
committed by
Carlos R. Mafra
parent
f90df24915
commit
b75ac967d9
@@ -424,9 +424,16 @@ static void find_and_write(const char *group, char *list[][2], int this_is_termi
|
||||
|
||||
/* delete character " !" from the command */
|
||||
ptr = strchr(comm, '!');
|
||||
while (ptr >= comm && (*ptr == '!' || isspace(*ptr)))
|
||||
*ptr-- = '\0';
|
||||
if (ptr != NULL) {
|
||||
while (ptr > comm) {
|
||||
if (!isspace(ptr[-1]))
|
||||
break;
|
||||
ptr--;
|
||||
}
|
||||
*ptr = '\0';
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s -e %s", terminal ? terminal : "xterm" , comm);
|
||||
|
||||
/* Root -> Applications -> <category> -> <application> */
|
||||
L3Menu = WMCreatePLArray(
|
||||
WMCreatePLString(_(list[i][0])),
|
||||
|
||||
Reference in New Issue
Block a user