mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 11:55:59 +01:00
Fixed print command with additional arguments.
Previous version ignored second argument if more than 2 were given and quoted the additional arguments leading to lp thinking they represented a filename. Before: :print HPF300 14-15 -o side=onesided -> lp -d HPF300 -P 1-38 ' -o side=onesided' 'filename' Now: :print HPF300 14-15 -o side=onesided -> lp -d HPF300 -P 14-15 -o side=onesided 'filename' Signed-off-by: mlq <mlq@pwmt.org>
This commit is contained in:
parent
64fe1f132d
commit
d7e82969a5
1 changed files with 2 additions and 4 deletions
|
@ -3529,7 +3529,7 @@ cmd_print(int argc, char** argv)
|
|||
}
|
||||
|
||||
char* printer = argv[0];
|
||||
char* sites = (argc == 2) ? g_strdup(argv[1]) : g_strdup_printf("1-%i", Zathura.PDF.number_of_pages);
|
||||
char* sites = (argc >= 2) ? g_strdup(argv[1]) : g_strdup_printf("1-%i", Zathura.PDF.number_of_pages);
|
||||
GString *addit = g_string_new("");
|
||||
|
||||
int i;
|
||||
|
@ -3542,13 +3542,11 @@ cmd_print(int argc, char** argv)
|
|||
}
|
||||
|
||||
char* escaped_filename = g_shell_quote(Zathura.PDF.file);
|
||||
char* escaped_addit = addit->len ? g_shell_quote(addit->str) : g_strdup("");
|
||||
char* command = g_strdup_printf(print_command, printer, sites, escaped_addit, escaped_filename);
|
||||
char* command = g_strdup_printf(print_command, printer, sites, addit->str, escaped_filename);
|
||||
system(command);
|
||||
|
||||
g_free(sites);
|
||||
g_free(escaped_filename);
|
||||
g_free(escaped_addit);
|
||||
g_free(command);
|
||||
g_string_free(addit, TRUE);
|
||||
|
||||
|
|
Loading…
Reference in a new issue