libexplain
1.4.D001
|
00001 /* 00002 * libexplain - Explain errno values returned by libc functions 00003 * Copyright (C) 2008-2010, 2013 Peter Miller 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Lesser General Public License as 00007 * published by the Free Software Foundation; either version 3 of the 00008 * License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #include <libexplain/ac/sys/stat.h> 00020 00021 #include <libexplain/buffer/note/still_exists.h> 00022 00023 00024 void 00025 explain_buffer_note_still_exists(explain_string_buffer_t *sb, 00026 const char *caption) 00027 { 00028 sb = sb->footnotes; 00029 explain_string_buffer_puts(sb, "; "); 00030 explain_string_buffer_printf_gettext 00031 ( 00032 sb, 00033 /* 00034 * xgettext: This message is used to supplement a 00035 * rename(2) error explanation, and oldpath still 00036 * exists. 00037 * 00038 * %1$s => the name of the relevant system call argument 00039 */ 00040 i18n("note that %s still exists"), 00041 caption 00042 ); 00043 } 00044 00045 00046 void 00047 explain_buffer_note_if_still_exists(explain_string_buffer_t *sb, 00048 const char *pathname, const char *caption) 00049 { 00050 struct stat st; 00051 00052 if (lstat(pathname, &st) == 0) 00053 explain_buffer_note_still_exists(sb, caption); 00054 } 00055 00056 00057 void 00058 explain_buffer_note_exists(explain_string_buffer_t *sb, 00059 const char *caption) 00060 { 00061 sb = sb->footnotes; 00062 explain_string_buffer_puts(sb, "; "); 00063 explain_string_buffer_printf_gettext 00064 ( 00065 sb, 00066 /* 00067 * xgettext: This message is used to supplement a 00068 * rename(2) error explanation, and oldpath still 00069 * exists. 00070 * 00071 * %1$s => the name of the relevant system call argument 00072 */ 00073 i18n("note that %s exists"), 00074 caption 00075 ); 00076 } 00077 00078 00079 void 00080 explain_buffer_note_if_exists(explain_string_buffer_t *sb, 00081 const char *pathname, const char *caption) 00082 { 00083 struct stat st; 00084 00085 if (lstat(pathname, &st) == 0) 00086 explain_buffer_note_exists(sb, caption); 00087 } 00088 00089 00090 /* vim: set ts=8 sw=4 et : */