| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "shared-forward.h" |
| 5 |
|
| 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 |
|
| 9 |
typedef struct EditFile EditFile; |
| 10 |
|
| 11 |
typedef struct EditFileContext { |
| 12 |
EditFile *files; |
| 13 |
size_t n_files; |
| 14 |
const char *marker_start; |
| 15 |
const char *marker_end; |
| 16 |
bool remove_parent; |
| 17 |
bool overwrite_with_origin; /* Always overwrite target with original file. */ |
| 18 |
bool read_from_stdin; /* Read contents from stdin instead of launching an editor. */ |
| 19 |
} EditFileContext; |
| 20 |
|
| 21 |
void edit_file_context_done(EditFileContext *context); |
| 22 |
|
| 23 |
bool edit_files_contains(const EditFileContext *context, const char *path); |
| 24 |
|
| 25 |
int edit_files_add( |
| 26 |
EditFileContext *context, |
| 27 |
const char *path, |
| 28 |
const char *original_path, |
| 29 |
char * const *comment_paths); |
| 30 |
|
| 31 |
int do_edit_files_and_install(EditFileContext *context); |