kiss-stj

My KISS Linux repo for software I use on my computers.
git clone https://git.stjo.hn/kiss-stj
Log | Files | Refs | README | LICENSE

tar-dash-remove.patch (762B)


      1 From d50db4931d75ed1c8100f6a933175deb5976a196 Mon Sep 17 00:00:00 2001
      2 From: Ethan Sommer <e5ten.arch@gmail.com>
      3 Date: Thu, 14 May 2020 12:02:51 -0400
      4 Subject: [PATCH] tar: if first argument doesn't have a leading dash, prepend
      5  one
      6 
      7 this allows tar to be called in the common form "tar <key>" instead of only
      8 allowing "tar -<key>"
      9 ---
     10  tar.c | 6 ++++++
     11  1 file changed, 6 insertions(+)
     12 
     13 diff --git a/tar.c b/tar.c
     14 index 603e544..759402e 100644
     15 --- a/tar.c
     16 +++ b/tar.c
     17 @@ -520,6 +520,12 @@ main(int argc, char *argv[])
     18  	char *file = NULL, *dir = ".", mode = '\0';
     19  	int fd;
     20  
     21 +	if (argc >= 2 && argv[1][0] != '-') {
     22 +		char *argv1 = emalloc(strlen(argv[1] + 2));
     23 +		sprintf(argv1, "-%s", argv[1]);
     24 +		argv[1] = argv1;
     25 +	}
     26 +
     27  	ARGBEGIN {
     28  	case 'x':
     29  	case 'c':