summaryrefslogtreecommitdiffabout
path: root/lib/sitecing_util.cc
authorMichael Krelin <hacker@klever.net>2005-03-30 15:50:28 (UTC)
committer Michael Krelin <hacker@klever.net>2005-03-30 15:50:28 (UTC)
commit3ddbfeafde93d1aab16a710498d86eef4e787406 (patch) (unidiff)
treed53ef21cf3b2bddfeb957c98344d0be8759ed555 /lib/sitecing_util.cc
parent642dc685bd0a3f1526e22827a4539aa0e06aeff7 (diff)
downloadsitecing-3ddbfeafde93d1aab16a710498d86eef4e787406.zip
sitecing-3ddbfeafde93d1aab16a710498d86eef4e787406.tar.gz
sitecing-3ddbfeafde93d1aab16a710498d86eef4e787406.tar.bz2
1. preprocessor doesn't touch unchanged files anymore
2. doublechedk on whether file is up to date when making 3. changed the way preprocessor targets depend on the timestamp file 4. a bugfix in strip_suffix/strip_prefix
Diffstat (limited to 'lib/sitecing_util.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/sitecing_util.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sitecing_util.cc b/lib/sitecing_util.cc
index 5466b28..f892a60 100644
--- a/lib/sitecing_util.cc
+++ b/lib/sitecing_util.cc
@@ -47,31 +47,31 @@ namespace sitecing {
47 rv += *s; 47 rv += *s;
48 if( (*s) != '/' ) 48 if( (*s) != '/' )
49 notslash=rv.length(); 49 notslash=rv.length();
50 } 50 }
51 if(!(opts&strip_trailing_slash)) 51 if(!(opts&strip_trailing_slash))
52 notslash++; 52 notslash++;
53 if(notslash<rv.length()) 53 if(notslash<rv.length())
54 rv.erase(notslash); // XXX: check the logic of stripping/not strippling trailing slash 54 rv.erase(notslash); // XXX: check the logic of stripping/not strippling trailing slash
55 return rv; 55 return rv;
56 } 56 }
57 57
58 string strip_prefix(const string& str,const string& prefix) { 58 string strip_prefix(const string& str,const string& prefix) {
59 if(str.compare(0,prefix.length(),prefix)) 59 if( (str.length()<prefix.length()) || str.compare(0,prefix.length(),prefix))
60 throw utility_no_prefix(CODEPOINT,"no such prefix"); 60 throw utility_no_prefix(CODEPOINT,"no such prefix");
61 return str.substr(prefix.length()); 61 return str.substr(prefix.length());
62 } 62 }
63 63
64 string strip_suffix(const string& str,const string& suffix) { 64 string strip_suffix(const string& str,const string& suffix) {
65 if(str.compare(str.length()-suffix.length(),suffix.length(),suffix)) 65 if( (str.length()<suffix.length()) || str.compare(str.length()-suffix.length(),suffix.length(),suffix))
66 throw utility_no_suffix(CODEPOINT,"no such suffix"); 66 throw utility_no_suffix(CODEPOINT,"no such suffix");
67 return str.substr(0,str.length()-suffix.length()); 67 return str.substr(0,str.length()-suffix.length());
68 } 68 }
69 69
70 string dir_name(const string& filename) { 70 string dir_name(const string& filename) {
71 string::size_type sl = filename.find_last_of('/'); 71 string::size_type sl = filename.find_last_of('/');
72 if(sl==string::npos) 72 if(sl==string::npos)
73 return ""; // no slashes -- no dir. 73 return ""; // no slashes -- no dir.
74 string::size_type nosl = filename.find_last_not_of('/',sl); 74 string::size_type nosl = filename.find_last_not_of('/',sl);
75 if(nosl==string::npos) 75 if(nosl==string::npos)
76 return ""; // only slashes -- no dir. XXX: only slashes after the last slash... does it mean no dir? 76 return ""; // only slashes -- no dir. XXX: only slashes after the last slash... does it mean no dir?
77 return filename.substr(0,nosl+1); 77 return filename.substr(0,nosl+1);