summaryrefslogtreecommitdiffstats
path: root/src/xattr.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:06:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:06:57 +0000
commita3eed2c248067f0319cb72bcc8b5e2c7054ea6dc (patch)
treefd79d650c7ffee81608955be5f4fd8edd791834e /src/xattr.h
parentInitial commit. (diff)
downloadwget-a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc.tar.xz
wget-a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc.zip
Adding upstream version 1.20.1.upstream/1.20.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/xattr.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/xattr.h b/src/xattr.h
new file mode 100644
index 0000000..40c7a8d
--- /dev/null
+++ b/src/xattr.h
@@ -0,0 +1,46 @@
+/* xattr.h -- POSIX Extended Attribute function mappings.
+
+ Copyright (C) 2016, 2018 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <url.h>
+
+#ifndef _XATTR_H
+#define _XATTR_H
+
+/* Store metadata name/value attributes against fp. */
+int set_file_metadata (const struct url *origin_url, const struct url *referrer_url, FILE *fp);
+
+#if defined(__linux)
+/* libc on Linux has fsetxattr (5 arguments). */
+# include <sys/xattr.h>
+# define USE_XATTR
+#elif defined(__APPLE__)
+/* libc on OS/X has fsetxattr (6 arguments). */
+# include <sys/xattr.h>
+# define fsetxattr(file, name, buffer, size, flags) \
+ fsetxattr ((file), (name), (buffer), (size), 0, (flags))
+# define USE_XATTR
+#elif defined(__FreeBSD_version) && (__FreeBSD_version > 500000)
+/* FreeBSD */
+# include <sys/types.h>
+# include <sys/extattr.h>
+# define fsetxattr(file, name, buffer, size, flags) \
+ extattr_set_fd ((file), EXTATTR_NAMESPACE_USER, (name), (buffer), (size))
+# define USE_XATTR
+#endif
+
+#endif /* _XATTR_H */