Blame


1 1411938b 2018-02-12 stsp /*
2 1411938b 2018-02-12 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 1411938b 2018-02-12 stsp *
4 1411938b 2018-02-12 stsp * Permission to use, copy, modify, and distribute this software for any
5 1411938b 2018-02-12 stsp * purpose with or without fee is hereby granted, provided that the above
6 1411938b 2018-02-12 stsp * copyright notice and this permission notice appear in all copies.
7 1411938b 2018-02-12 stsp *
8 1411938b 2018-02-12 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 1411938b 2018-02-12 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 1411938b 2018-02-12 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 1411938b 2018-02-12 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 1411938b 2018-02-12 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 1411938b 2018-02-12 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 1411938b 2018-02-12 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 1411938b 2018-02-12 stsp */
16 1411938b 2018-02-12 stsp
17 1411938b 2018-02-12 stsp /* Utilities for dealing with filesystem paths. */
18 1411938b 2018-02-12 stsp
19 86c3caaf 2018-03-09 stsp #define GOT_DEFAULT_FILE_MODE (S_IRUSR|S_IWUSR | S_IRGRP | S_IROTH)
20 86c3caaf 2018-03-09 stsp #define GOT_DEFAULT_DIR_MODE (S_IRWXU | S_IRGRP|S_IXGRP | S_IROTH|S_IXOTH)
21 86c3caaf 2018-03-09 stsp
22 1411938b 2018-02-12 stsp /* Determine whether a path is an absolute path. */
23 1411938b 2018-02-12 stsp int got_path_is_absolute(const char *);
24 1411938b 2018-02-12 stsp
25 1411938b 2018-02-12 stsp /*
26 1411938b 2018-02-12 stsp * Return an absolute version of a relative path.
27 1411938b 2018-02-12 stsp * The result is allocated with malloc(3).
28 1411938b 2018-02-12 stsp */
29 1411938b 2018-02-12 stsp char *got_path_get_absolute(const char *);
30 1411938b 2018-02-12 stsp
31 1411938b 2018-02-12 stsp /*
32 1411938b 2018-02-12 stsp * Normalize a path for internal processing.
33 1411938b 2018-02-12 stsp * The result is allocated with malloc(3).
34 1411938b 2018-02-12 stsp */
35 1411938b 2018-02-12 stsp char *got_path_normalize(const char *);
36 1411938b 2018-02-12 stsp
37 1411938b 2018-02-12 stsp /* Open a new temporary file for writing.
38 1411938b 2018-02-12 stsp * The file is not visible in the filesystem. */
39 1411938b 2018-02-12 stsp FILE *got_opentemp(void);