]>
Commit | Line | Data |
---|---|---|
981f7fb9 | 1 | --- src/misc.cpp.orig 2006-11-19 18:30:08.538643734 +0100 |
2 | +++ src/misc.cpp 2006-11-19 18:34:41.635711234 +0100 | |
3 | @@ -32,6 +32,7 @@ | |
4 | ||
5 | QFile f("/etc/fstab"); | |
6 | QString line; | |
7 | + QRegExp separator("\\s+"); | |
8 | ||
9 | if (f.open(IO_ReadOnly)) | |
10 | { // file opened successfully | |
11 | @@ -39,18 +40,15 @@ | |
12 | ||
13 | while (!t.eof()) | |
14 | { | |
15 | - line = t.readLine(); // line of text excluding '\n' | |
16 | + line = t.readLine().simplifyWhiteSpace(); // line of text excluding '\n' | |
17 | ||
18 | if(!line.startsWith("#") && !line.isEmpty()) | |
19 | { | |
20 | - if(((line.section("\t",1,1,QString::SectionSkipEmpty)).replace(QRegExp("/$"),"")).compare(cfgcdpath) == 0) | |
21 | - { | |
22 | - strcpy(devicename,(const char *)line.section("\t",0,0)); | |
23 | - } | |
24 | - if(((line.section(" " ,1,1,QString::SectionSkipEmpty)).replace(QRegExp("/$"),"")).compare(cfgcdpath) == 0) | |
25 | - { | |
26 | - strcpy(devicename,(const char *)line.section(" " ,0,0)); | |
27 | - } | |
28 | + if(line.section(separator, 1, 1, QString::SectionSkipEmpty).compare(cfgcdpath) == 0) | |
29 | + { | |
30 | + strncpy(devicename, (const char *) line.section(separator, 0, 0), 63); | |
31 | + break; | |
32 | + } | |
33 | } | |
34 | } | |
35 | f.close(); |