commit c4717ff2329974a2745e805d30f9c75517d0aa70 from: Alexander Arkhipov date: Thu Mar 16 18:01:39 2023 UTC add options -t and -T commit - 417fa86fa1a841aa16414c52299710368b22b9f9 commit + c4717ff2329974a2745e805d30f9c75517d0aa70 blob - ccb53132f63f154c8b5b632bdd9adfe72c44a3d7 blob + 20bd1acc4322253d57a0ec5159b75045ef2e351f --- rmc +++ rmc @@ -4,11 +4,11 @@ use strict; use warnings; use Getopt::Std; -our ($opt_e, $opt_c, $opt_p) = 0; +our ($opt_c, $opt_e, $opt_p, $opt_t, $opt_T) = 0; # usage() prints usage information to stderr and dies. sub usage { - die "usage: $0 [-ecp] file\n"; + die "usage: $0 [-ceptT] file\n"; } # shquote($s) returns string $s with all shell metacharacters quoted. @@ -196,7 +196,7 @@ sub docmd { my $dofork = 0; if (!$term) { $dofork = 1; - } elsif (!$opt_p && !(-t && -t STDOUT)) { + } elsif (!$opt_p && ($opt_T || !($opt_t || (-t && -t STDOUT)))) { $dofork = 1; unless (exists $ENV{'DISPLAY'}) { rmtemp(); @@ -223,7 +223,7 @@ sub docmd { my $file; my ($typ, $styp) = ''; -usage if !getopts('ecp') || $#ARGV < 0; +usage if !getopts('ceptT') || $#ARGV < 0; $file = $ARGV[0]; my $typfile = $ENV{'MIMETYPES'}; blob - 15140897695cfdc1e0639a15ad1fe5caef503d8a blob + 3928d924570e8909ce4e0c6ab6cce107c4fa45d0 --- rmc.1 +++ rmc.1 @@ -6,7 +6,7 @@ .Nd view, edit, compose or print a file, directory or URL .Sh SYNOPSIS .Nm -.Op Fl ecp +.Op Fl ceptT .Ar file .Sh DESCRIPTION The @@ -34,12 +34,18 @@ command. .Pp The options are as follows: .Bl -tag -width Ds -.It Fl e -Use the edit-command istead of the view-command. .It Fl c Use the compose-command istead of the view-command. +.It Fl e +Use the edit-command istead of the view-command. .It Fl p Use the print-command istead of the view-command. +.It Fl t +Don't spawn a new terminal even if needsterminal is set, and either stdin, +stdout, or both are not associated to a terminal. +.It Fl T +Always spawn a new terminal when needsterminal is set, even if both stdin and +stdout are associated with a terminal. .El .Ss The mailcap file The mailcap file describes commands to execute depending on the file's