Allow passing id as 6th argument

This commit is contained in:
Nikita Ivanov 2022-05-29 01:06:41 +05:00
parent 5bdf9d372b
commit d67d10af9f
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
3 changed files with 5 additions and 3 deletions

5
ctpv.c
View File

@ -106,12 +106,13 @@ static int preview(int argc, char *argv[])
return ERR;
}
char *f, *w, *h, *x, *y;
char *f, *w, *h, *x, *y, *id;
GET_PARG(f, 0);
GET_PARG(w, 1);
GET_PARG(h, 2);
GET_PARG(x, 3);
GET_PARG(y, 4);
GET_PARG(id, 5);
ERRCHK_RET_OK(check_file(f));
@ -124,7 +125,7 @@ static int preview(int argc, char *argv[])
PreviewArgs args = {
.ctpv = ctpv.ctpv_path,
.f = f, .w = w, .h = h, .x = x, .y = y
.f = f, .w = w, .h = h, .x = x, .y = y, .id = id
};
return run_preview(get_ext(f), mimetype, &args);

View File

@ -163,6 +163,7 @@ int run_preview(const char *ext, const char *mimetype, PreviewArgs *pa)
SET_PENV("h", pa->h);
SET_PENV("x", pa->x);
SET_PENV("y", pa->y);
SET_PENV("id", pa->id);
SET_PENV("m", mimetype);
SET_PENV("e", ext);

View File

@ -10,7 +10,7 @@ typedef struct {
} Preview;
typedef struct {
char *ctpv, *f, *w, *h, *x, *y;
char *ctpv, *f, *w, *h, *x, *y, *id;
} PreviewArgs;
void init_previews(Preview *ps, size_t len);