logo       

[PATCH 5/11] .icewm/theme: avoid multi # lines: msg#00018

window-managers.icewm.devel

Subject: [PATCH 5/11] .icewm/theme: avoid multi # lines

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>
Google Custom Search

News | FAQ | advertise