Chiudere Enlightenment
Mi ha sempre dato fastidio che chiudendo Enlightenment (0.16.x), costui
non si prendesse la briga di chiudere le finestre aperte, e quindi i
programmi venivano chiusi scorrettamente, scassandoti i maroni al
prossimo avvio...
E quando l'ho fatto notare mi hanno detto che gli sviluppatori si
stavano occupando solo di E 0.17 al momento...
Seh bella scusa del cavolo... il programmino che le chiude all'uscita
l'ho fatto in mezz'ora neanche... eccolo qui! :)
certo magari sarà un po' bacato, ma mi sembra che svolga il suo
compito...
--
"Our hardware runs better without windows"
- BMW advertisement
. /\ °
Real Name: Lorenzo Petrone <* >
Web: digilander.iol.it/lano666 \/ ·
/*
(c) 2002 Lorenzo Petrone <_lano_@libero.it>
NO WARRANTY OF ANY KIND FOR ANY REASON.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main (void) {
char **winid;
int stlen=16;
int nid=16;
int n=0,x;
FILE *out;
FILE *output;
char sysc[64];
if (system(">/tmp/exite.out")<0) {
fprintf(output,"couldn't write temp file\n");
exit(-1);
}
if ((out=fopen("/tmp/exite.out","rt"))==NULL) {
fprintf(output,"couldn't open temp file\n");
exit(-1);
}
if (fork()!=0)
exit(0);
if ((winid=(char**)malloc(sizeof(char*)*nid))==NULL) {
fprintf(output,"malloc error\n");
exit(-1);
}
for (x=n; x<nid; x++) {
if ((winid[x]=(char*)malloc(sizeof(char)*stlen))==NULL) {
fprintf(output,"malloc %d error\n",x);
exit(-1);
}
}
system("eesh -ewait \"window_list\" >/tmp/exite.out");
rewind(out);
n=-1;
while (1) {
n++;
if (n==nid) {
nid*=2;
if ((winid=(char**)realloc(winid,sizeof(char*)*nid))==NULL) {
fprintf(output,"realloc error\n");
exit(-1);
}
for (x=n; x<nid; x++) {
if ((winid[x]=(char*)malloc(sizeof(char)*stlen))==NULL) {
fprintf(output,"malloc %d error\n",x);
exit(-1);
}
}
}
fscanf(out,"%s",winid[n]);
while (1) {
if (feof(out))
goto fi;
if (fgetc(out)=='\n')
goto br;
}
br:
}
fi:
for (x=0; x<n; x++) {
printf("closing window %s\n",winid[x]);
snprintf(sysc,64,"eesh -e \"win_op %s close\"",winid[x]);
system(sysc);
}
system("eesh -e exit");
/*
sleep(4);
system("killall enlightenment");
*/
/*
system("killall -9 enlightenment");
system("ps a|grep startx >/tmp/exite.ouch");
fclose(out);
fopen("/tmp/exite.ouch","rt");
fscanf(out,"%d",x);
snprintf(sysc,64,"kill %d",x);
system(sysc);
snprintf(sysc,64,"kill -9 %d",x);
system(sysc);
*/
return 0;
}
Reply to: