|
[PATCH 5/11] .icewm/theme: avoid multi # lines: msg#00018window-managers.icewm.devel
after every theme switch a line is added to .icewm/theme and old lines are copied with a # in front, don't prepend this # if there is already one bert wesarg --- diff -urp old/src/themes.cc new/src/themes.cc --- old/src/themes.cc 2006-09-10 18:12:11.000000000 +0200 +++ new/src/themes.cc 2006-11-08 17:34:04.617939989 +0100 @@ -46,15 +46,13 @@ void setDefaultTheme(const char *theme) FILE *fdold = fopen(themeConf, "r"); if (fdold) { - char *tmpbuf = new char[300]; - if (tmpbuf) { - *tmpbuf = '#'; - for (int i = 0; i < 10; i++) - if (fgets(tmpbuf + 1, 298, fdold)) - write(fd, tmpbuf, strlen(tmpbuf)); - else - break; - delete[] tmpbuf; + char tmpbuf[300]; + for (int i = 0; i < 10; i++) { + if (!fgets(tmpbuf, 299, fdold)) + break; + if (tmpbuf[0] != '#') + write(fd, "#", 1); + write(fd, tmpbuf, strlen(tmpbuf)); } fclose(fdold); } ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [PATCH 4/11] improve genpref output: 00018, Bert Wesarg |
|---|---|
| Next by Date: | [PATCH 6/11] icesm: wait for the end of the .icewm/shutdown script: 00018, Bert Wesarg |
| Previous by Thread: | [PATCH 4/11] improve genpref outputi: 00018, Bert Wesarg |
| Next by Thread: | [PATCH 6/11] icesm: wait for the end of the .icewm/shutdown script: 00018, Bert Wesarg |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |