|
|
| version 1.50, 2001/04/23 10:19:02 | version 1.52, 2001/04/26 14:55:28 |
|---|---|
| Line 163 void file_delete(Pool& pool, const Strin | Line 163 void file_delete(Pool& pool, const Strin |
| rmdir(file_spec, 1); | rmdir(file_spec, 1); |
| } | } |
| static bool entry_readable(const String& file_spec, bool need_dir) { | |
| const char *fname=file_spec.cstr(String::UL_FILE_NAME); | |
| struct stat finfo; | |
| if(access(fname, R_OK)==0 && stat(fname, &finfo)==0) { | |
| bool is_dir=(bool)(finfo.st_mode&S_IFDIR); | |
| return is_dir==need_dir; | |
| } | |
| return false; | |
| } | |
| bool file_readable(const String& file_spec) { | bool file_readable(const String& file_spec) { |
| return access(file_spec.cstr(String::UL_FILE_NAME), R_OK)==0; | return entry_readable(file_spec, false); |
| } | |
| bool dir_readable(const String& file_spec) { | |
| return entry_readable(file_spec, true); | |
| } | } |
| bool file_executable(const String& file_spec) { | bool file_executable(const String& file_spec) { |
| return access(file_spec.cstr(String::UL_FILE_NAME), X_OK)==0; | return access(file_spec.cstr(String::UL_FILE_NAME), X_OK)==0; |
| Line 293 const char *unescape_chars(Pool& pool, c | Line 306 const char *unescape_chars(Pool& pool, c |
| return s; | return s; |
| } | } |
| /// used by attributed_meaning_to_string / append_attribute_subattribute | |
| struct Attributed_meaning_info { | struct Attributed_meaning_info { |
| String::Untaint_lang lang; | String *header; // header line being constructed |
| String *header; | String::Untaint_lang lang; // language in which to append to that line |
| }; | }; |
| static void append_attribute_subattribute(const Hash::Key& akey, Hash::Val *avalue, | static void append_attribute_subattribute(const Hash::Key& akey, Hash::Val *avalue, |
| void *info) { | void *info) { |
| Line 319 const String& attributed_meaning_to_stri | Line 333 const String& attributed_meaning_to_stri |
| result.append(value->as_string(), lang, true); | result.append(value->as_string(), lang, true); |
| Attributed_meaning_info attributed_meaning_info={ | Attributed_meaning_info attributed_meaning_info={ |
| lang, | &result, |
| &result | lang |
| }; | }; |
| hash->for_each(append_attribute_subattribute, &attributed_meaning_info); | hash->for_each(append_attribute_subattribute, &attributed_meaning_info); |
| } else // result value | } else // result value |