cf9a010802
Submitted by Peter Stromberg <home@wilfried.net>. This dock-app kills (and restarts) netscape when you click on the icon! You can now specify which program to kill and if you want to restart it or not.
32 lines
1.1 KiB
Plaintext
32 lines
1.1 KiB
Plaintext
$OpenBSD: patch-wmNetscapeKiller_c,v 1.1.1.1 2001/01/11 23:23:17 naddy Exp $
|
|
--- wmNetscapeKiller.c.orig Tue Aug 8 00:24:03 2000
|
|
+++ wmNetscapeKiller.c Thu Jan 11 18:37:47 2001
|
|
@@ -64,15 +64,15 @@ void DoExpose() {
|
|
// Getionnaire evenement bouton souris
|
|
void DoButtonPress() {
|
|
int retour ;
|
|
- char* command;
|
|
- sprintf(command,"killall -9 %s",prog_victim) ;
|
|
+ char command[1024];
|
|
+ snprintf(command,sizeof(command),"skill -9 %s",prog_victim) ;
|
|
retour = system(command) ;
|
|
// retour = system("killall -12 netscape") ;
|
|
if(retour!= -1 && retour != 127 && retour != 256 && restart == TRUE)
|
|
{
|
|
nXPM = KILLED_XPM ;
|
|
DoExpose() ;
|
|
- sprintf(command,"%s&",prog_victim) ;
|
|
+ snprintf(command,sizeof(command),"%s&",prog_victim) ;
|
|
system(command) ;
|
|
}
|
|
else
|
|
@@ -118,7 +118,7 @@ int main(int argc, char *argv[])
|
|
else
|
|
{
|
|
|
|
- strncpy(prog_victim,argv[1],255) ;
|
|
+ strlcpy(prog_victim,argv[1],sizeof(prog_victim)) ;
|
|
if(argc == 3) // il faut etudier le deuxieme aussi
|
|
{
|
|
if(!strcmp(argv[2],"restart"))
|