]>
Commit | Line | Data |
---|---|---|
a01c4bc9 MY |
1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
2 | #pragma once | |
3 | ||
78e32003 | 4 | #include <stdbool.h> |
a01c4bc9 | 5 | |
6e5d0e31 MY |
6 | #define DROPIN_MARKER_START "### Anything between here and the comment below will become the contents of the drop-in file" |
7 | #define DROPIN_MARKER_END "### Edits below this comment will be discarded" | |
8 | ||
043db340 YW |
9 | typedef struct EditFile EditFile; |
10 | typedef struct EditFileContext EditFileContext; | |
11 | ||
12 | struct EditFile { | |
13 | EditFileContext *context; | |
a01c4bc9 | 14 | char *path; |
9a11b4f9 MY |
15 | char *original_path; |
16 | char **comment_paths; | |
17 | char *temp; | |
a01c4bc9 | 18 | unsigned line; |
043db340 | 19 | }; |
a01c4bc9 | 20 | |
043db340 | 21 | struct EditFileContext { |
9a11b4f9 MY |
22 | EditFile *files; |
23 | size_t n_files; | |
24 | const char *marker_start; | |
25 | const char *marker_end; | |
26 | bool remove_parent; | |
329050c5 ZJS |
27 | bool overwrite_with_origin; /* Always overwrite target with original file. */ |
28 | bool stdin; /* Read contents from stdin instead of launching an editor. */ | |
043db340 | 29 | }; |
a01c4bc9 | 30 | |
9a11b4f9 MY |
31 | void edit_file_context_done(EditFileContext *context); |
32 | ||
33 | bool edit_files_contains(const EditFileContext *context, const char *path); | |
a01c4bc9 | 34 | |
9a11b4f9 MY |
35 | int edit_files_add( |
36 | EditFileContext *context, | |
37 | const char *path, | |
38 | const char *original_path, | |
39 | char * const *comment_paths); | |
a01c4bc9 | 40 | |
9a11b4f9 | 41 | int do_edit_files_and_install(EditFileContext *context); |