encode_uint32 second parameter should be uint32_t, not unsigned long
[git-daemon2.git] / client / home.h
blob842cd8c1eeeb7e49f7d226c99ee8714380aa2478
1 /*
2 * Copyright (C) Ilari Liusvaara 2009-2010
4 * This code is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8 #ifndef _home__h__included__
9 #define _home__h__included__
11 #include <sys/types.h>
14 * Ensure that directory specified exists. If it does not, attempt
15 * to create it.
17 *Input:
18 * path The directory to ensure.
20 *Output:
21 * Return value 0 on success, -1 on failure.
23 *Notes:
24 * - Path starting with $HOME is special, it is
25 * relative to user home directory.
26 * - Paths starting with $XDG_CONFIG_HOME and $XDG_DATA_HOME
27 * are special. Those are interpretted as relative to XDG
28 * base dir spec directories.
30 int ensure_directory(const char *path);
33 * Open the specified regular file. Leading path components are
34 * automatically created if file needs to be created.
36 *Input:
37 * path The file to open.
38 * flags Flags to pass to open.
39 * mode Mode to pass to open.
41 *Output:
42 * Return value File descriptor. -1 on failure.
44 *Notes:
45 * - Path starting with $HOME is special, it is
46 * relative to user home directory.
47 * - Paths starting with $XDG_CONFIG_HOME and $XDG_DATA_HOME
48 * are special. Those are interpretted as relative to XDG
49 * base dir spec directories.
51 int open_create_dirs(const char *path, int flags, mode_t mode);
54 * Expand the specified path.
56 *Input:
57 * path The path to expand.
59 *Output:
60 * Return value Mallocced copy of expanded path.
62 *Notes:
63 * - Path starting with $HOME is special, it is
64 * relative to user home directory.
65 * - Paths starting with $XDG_CONFIG_HOME and $XDG_DATA_HOME
66 * are special. Those are interpretted as relative to XDG
67 * base dir spec directories.
69 char *expand_path(const char *path);
71 #endif