comparison: src/server/util/util.c
src/server/util/util.c
- changeset 63
- 66442f81f823
- parent 62
- c47e081b6c0f
- child 69
- 4a10bc0ee80d
equal
deleted
inserted
replaced
299 } |
299 } |
300 newstr.ptr[newstr.length] = '\0'; |
300 newstr.ptr[newstr.length] = '\0'; |
301 |
301 |
302 return newstr; |
302 return newstr; |
303 } |
303 } |
|
304 |
|
305 sstr_t util_path_remove_last(sstr_t path) { |
|
306 int i; |
|
307 for(i=path.length-1;i>=0;i--) { |
|
308 char c = path.ptr[i]; |
|
309 if(c == '/') { |
|
310 path.ptr[i] = 0; |
|
311 path.length = i; |
|
312 break; |
|
313 } |
|
314 } |
|
315 if(i < 0) { |
|
316 path.ptr = NULL; |
|
317 path.length = 0; |
|
318 } |
|
319 return path; |
|
320 } |