Merge branch 'master' of ssh://github.com/fluxer/kdelibs into devinfo

This commit is contained in:
Ivailo Monev 2021-09-16 21:46:58 +03:00
commit 191f21e421
5 changed files with 23 additions and 158 deletions

View file

@ -1,21 +1,21 @@
IF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
ENDIF()
FILE(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"${file}\"")
IF(EXISTS "${file}")
EXECUTE_PROCESS(
COMMAND "@CMAKE_COMMAND@" -E remove \"${file}\"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\": ${rm_out}")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "${file}")
MESSAGE(STATUS "File \"${file}\" does not exist.")
ENDIF(EXISTS "${file}")
MESSAGE(STATUS "Uninstalling \"${file}\"")
IF(EXISTS "${file}")
EXECUTE_PROCESS(
COMMAND "@CMAKE_COMMAND@" -E remove "${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\": ${rm_out}")
ENDIF()
ELSE()
MESSAGE(STATUS "File \"${file}\" does not exist.")
ENDIF()
ENDFOREACH(file)

View file

@ -1481,7 +1481,7 @@ static void secondary_child_handler(int)
}
int main(int argc, char **argv, char **envp)
int main(int argc, char **argv)
{
setlocale (LC_ALL, "");
setlocale (LC_NUMERIC, "C");
@ -1570,7 +1570,7 @@ int main(int argc, char **argv, char **envp)
/** Prepare to change process name **/
#ifndef SKIP_PROCTITLE
proctitle_init(argc, argv, envp);
proctitle_init(argc, argv);
#endif
kdeinit_library_path();

View file

@ -28,12 +28,6 @@
#include <stdarg.h>
#include <stdlib.h>
#define PF_ARGV_NONE 0
#define PF_ARGV_NEW 1
#define PF_ARGV_WRITEABLE 2
#define PF_ARGV_PSTAT 3
#define PF_ARGV_PSSTRINGS 4
#ifdef HAVE_SETPROCTITLE
# define PF_ARGV_TYPE PF_ARGV_NONE
# ifdef HAVE_SYS_TYPES_H
@ -42,31 +36,7 @@
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif /* HAVE_UNISTD_H */
#else /* HAVE_SETPROCTITLE */
# ifdef __GNU_HURD__
# define PF_ARGV_TYPE PF_ARGV_NEW
# else /* __GNU_HURD__ */
# define PF_ARGV_TYPE PF_ARGV_WRITEABLE
# if defined(HAVE_SYS_PSTAT_H) && defined(HAVE_PSTAT)
# include <sys/pstat.h>
# undef PF_ARGV_TYPE
# define PF_ARGV_TYPE PF_ARGV_PSTAT
# endif /* HAVE_SYS_PSTAT_H && HAVE_PSTAT */
# ifdef HAVE_SYS_EXEC_H
# include <sys/exec.h>
# ifdef PS_STRINGS
# include <machine/vmparam.h>
# undef PF_ARGV_TYPE
# define PF_ARGV_TYPE PF_ARGV_PSSTRINGS
# endif /* PS_STRINGS */
# endif /* HAVE_SYS_EXEC_H */
# endif /* !__GNU_HURD__ */
#endif /* !HAVE_SETPROCTITLE */
#endif /* HAVE_SETPROCTITLE */
#ifdef HAVE___PROGNAME
extern char *__progname;
@ -76,57 +46,10 @@ extern char *__progname_full;
#endif /* HAVE___PROGNAME_FULL */
extern char **environ;
static char **Argv = NULL;
#if PF_ARGV_TYPE == PF_ARGV_WRITEABLE /* Only this mode uses LastArgv */
static char *LastArgv = NULL;
static char *cleanUpTo = NULL;
#endif
/**
* Set up the memory space for setting the proctitle
*/
void proctitle_init(int argc, char *argv[], char *envp[]) {
int i, envpsize;
char **p;
/* Move the environment so proctitle_set can use the space. */
for ( i = envpsize = 0; envp[i] != NULL; i++ ) {
envpsize += strlen(envp[i]) + 1;
}
if ((p = (char **) malloc((i + 1) * sizeof(char *))) != NULL) {
environ = p;
for (i = 0; envp[i] != NULL; i++) {
if ((environ[i] = static_cast<char *>(malloc(strlen(envp[i]) + 1))) != NULL) {
strcpy(environ[i], envp[i]);
}
}
environ[i] = NULL;
}
Argv = argv;
# if PF_ARGV_TYPE == PF_ARGV_WRITEABLE /* Only this mode uses LastArgv */
for (i = 0; i < argc; i++) {
if (!i || (LastArgv + 1 == argv[i])) {
LastArgv = argv[i] + strlen(argv[i]);
}
}
cleanUpTo = LastArgv;
for (i = 0; envp[i] != NULL; i++) {
/* must not overwrite XDG_SESSION_COOKIE */
if (!strncmp(envp[i], "XDG_", 4))
break;
if ((LastArgv + 1) == envp[i]) {
LastArgv = envp[i] + strlen(envp[i]);
}
}
#endif
void proctitle_init(int argc, char *argv[]) {
# ifdef HAVE___PROGNAME
/* Set the __progname variable so glibc and company
* don't go nuts.
@ -141,15 +64,6 @@ void proctitle_init(int argc, char *argv[], char *envp[]) {
void proctitle_set(const char *fmt, ...) {
va_list msg;
char statbuf[BUFSIZ];
#ifndef HAVE_SETPROCTITLE
# if PF_ARGV_TYPE == PF_ARGV_PSTAT
union pstun pst;
# endif /* PF_ARGV_PSTAT */
char *p;
int i;
#endif /* HAVE_SETPROCTITLE */
if ( !fmt ) {
return;
@ -157,9 +71,10 @@ void proctitle_set(const char *fmt, ...) {
va_start(msg, fmt);
#ifdef HAVE_SETPROCTITLE
char statbuf[BUFSIZ];
memset(statbuf, 0, sizeof(statbuf));
#ifdef HAVE_SETPROCTITLE
# if __FreeBSD__ >= 4 && !defined(FREEBSD4_0) && !defined(FREEBSD4_1)
/* FreeBSD's setproctitle() automatically prepends the process name. */
vsnprintf(statbuf, sizeof(statbuf), fmt, msg);
@ -174,56 +89,7 @@ void proctitle_set(const char *fmt, ...) {
# endif /* FREEBSD4 */
setproctitle("%s", statbuf);
#else /* HAVE_SETPROCTITLE */
/* Manually append the process name for non-setproctitle() platforms. */
snprintf(statbuf, sizeof(statbuf), "%s", "kdeinit4: ");
vsnprintf(statbuf + strlen(statbuf),
sizeof(statbuf) - strlen(statbuf),
fmt,
msg);
#endif /* HAVE_SETPROCTITLE */
va_end(msg);
#ifdef HAVE_SETPROCTITLE
return;
#else
i = strlen(statbuf);
# if PF_ARGV_TYPE == PF_ARGV_NEW
/* We can just replace argv[] arguments. Nice and easy. */
Argv[0] = statbuf;
Argv[1] = NULL;
# endif /* PF_ARGV_NEW */
# if PF_ARGV_TYPE == PF_ARGV_WRITEABLE
const int maxlen = (LastArgv - Argv[0]) - 1;
/* We can overwrite individual argv[] arguments. Semi-nice. */
snprintf(Argv[0], maxlen, "%s", statbuf);
p = &Argv[0][i];
/* Clear the rest used by arguments, but don't clear the memory
that is usually used for environment variables. Some
tools, like ConsoleKit must have access to the process'es initial
environment (more exact, the XDG_SESSION_COOKIE variable stored there).
If this code causes another side effect, we have to specifically
always append those variables to our environment. */
while (p < cleanUpTo)
*p++ = '\0';
Argv[1] = NULL;
# endif /* PF_ARGV_WRITEABLE */
# if PF_ARGV_TYPE == PF_ARGV_PSTAT
pst.pst_command = statbuf;
pstat(PSTAT_SETCMD, pst, i, 0, 0);
# endif /* PF_ARGV_PSTAT */
# if PF_ARGV_TYPE == PF_ARGV_PSSTRINGS
PS_STRINGS->ps_nargvstr = 1;
PS_STRINGS->ps_argvstr = statbuf;
# endif /* PF_ARGV_PSSTRINGS */
#endif /* HAVE_SETPROCTITLE */
}

View file

@ -29,9 +29,8 @@
*
* @param argc argc, as passed to main()
* @param argv argv, as passed to main()
* @param envp envp, as passed to main()
*/
void proctitle_init(int argc, char *argv[], char *envp[]);
void proctitle_init(int argc, char *argv[]);
/**
* Change the process title. It accepts a variable number

View file

@ -204,7 +204,7 @@ KRunMX1::expandEscapedMacro(const QString &str, int pos, QStringList &ret)
ret << service.entryPath().replace('%', "%%");
break;
case 'i':
ret << "--icon" << service.icon().replace('%', "%%");
ret << service.icon().replace('%', "%%");
break;
case 'm':
// ret << "-miniicon" << service.icon().replace( '%', "%%" );