--- p7zip_9.20.1/contrib/gzip-like_CLI_wrapper_for_7z/p7zip.orig	2007-07-25 15:10:47.000000000 -0400
+++ p7zip_9.20.1/contrib/gzip-like_CLI_wrapper_for_7z/p7zip	2011-06-26 17:43:45.555000000 -0400
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # gzip-like CLI wrapper for p7zip
 # version 2.0
 #
@@ -65,7 +65,7 @@ doit()
   trap "rm -f -- ${tmp}" 0
 
   if ${compress} ; then
-    if tty > /dev/null ; then
+    if tty -s <&1 > /dev/null ; then
       echo "$0: compressed data not written to a terminal."
       echo "For help, type: $0 -h"
       exit 1
@@ -120,6 +120,9 @@ while [ "$#" != "0" ] ; do
       shift
       break
       ;;
+    -*)
+      usage
+      ;;
     *)
 	doit ${compress} "$1"
         file="$1"
--- p7zip_16.02/install.sh.orig	2015-10-05 17:39:00.000000000 +0900
+++ p7zip_16.02/install.sh	2017-04-21 10:35:00.684088500 +0900
@@ -3,27 +3,28 @@
 installShared()
 {
   prg=$1
-  if [ -x bin/${prg} ]
+  if [ -x bin/${prg}${EXEEXT} ]
   then
     echo "- installing ${DEST_DIR}${DEST_BIN}/${prg}"
-    cp bin/${prg} "${DEST_DIR}${DEST_SHARE}/${prg}"
-    chmod 755 "${DEST_DIR}${DEST_SHARE}/${prg}"
-    strip     "${DEST_DIR}${DEST_SHARE}/${prg}"
+    cp bin/${prg} "${DEST_DIR}${DEST_SHARE}/${prg}${EXEEXT}"
+    chmod 755 "${DEST_DIR}${DEST_SHARE}/${prg}${EXEEXT}"
+    strip     "${DEST_DIR}${DEST_SHARE}/${prg}${EXEEXT}"
     echo "#! /bin/sh" > "${DEST_DIR}${DEST_BIN}/${prg}"
-    echo "\"${DEST_SHARE}/${prg}\" \"\$@\"" >> "${DEST_DIR}${DEST_BIN}/${prg}"
+    echo "\"${DEST_SHARE}/${prg}${EXEEXT}\" \"\$@\"" >> "${DEST_DIR}${DEST_BIN}/${prg}"
     chmod 755 "${DEST_DIR}${DEST_BIN}/${prg}"
   fi
 }
 
 # global install
-DEST_HOME=/usr/local
+DEST_HOME=/usr
 # for testing 
 # DEST_HOME=${HOME}/INSTALL/usr/local
 DEST_BIN=${DEST_HOME}/bin
 DEST_SHARE=${DEST_HOME}/lib/p7zip
-DEST_MAN=${DEST_HOME}/man
+DEST_MAN=${DEST_HOME}/share/man
 DEST_SHARE_DOC=${DEST_HOME}/share/doc/p7zip
 DEST_DIR=
+EXEEXT=
 [ "$1" ] && DEST_BIN="$1"
 [ "$2" ] && DEST_SHARE="$2"
 [ "$3" ] && DEST_MAN="$3"
@@ -39,34 +40,34 @@
   use_share="o"
 fi
 
-if [ -x bin/7z ]
+if [ -x bin/7z${EXEEXT} ]
 then
   use_share="o"
 fi
 
-if [ -x bin/7zG ]
+if [ -x bin/7zG${EXEEXT} ]
 then
   use_share="o"
 fi
 
-if [ -x bin/7zFM ]
+if [ -x bin/7zFM${EXEEXT} ]
 then
   use_share="o"
 fi
 
 # cleaning previous install
-rm -f  "${DEST_DIR}${DEST_BIN}/7z"
-rm -f  "${DEST_DIR}${DEST_BIN}/7za"
-rm -f  "${DEST_DIR}${DEST_BIN}/7zr"
-rm -f  "${DEST_DIR}${DEST_BIN}/7zG"
-rm -f  "${DEST_DIR}${DEST_BIN}/p7zipForFilemanager"
-rm -f  "${DEST_DIR}${DEST_BIN}/7zFM"
-rm -f  "${DEST_DIR}${DEST_SHARE}/7z"
-rm -f  "${DEST_DIR}${DEST_SHARE}/7za"
+rm -f  "${DEST_DIR}${DEST_BIN}/7z${EXEEXT}"
+rm -f  "${DEST_DIR}${DEST_BIN}/7za${EXEEXT}"
+rm -f  "${DEST_DIR}${DEST_BIN}/7zr${EXEEXT}"
+rm -f  "${DEST_DIR}${DEST_BIN}/7zG${EXEEXT}"
+rm -f  "${DEST_DIR}${DEST_BIN}/p7zipForFilemanager${EXEEXT}"
+rm -f  "${DEST_DIR}${DEST_BIN}/7zFM${EXEEXT}"
+rm -f  "${DEST_DIR}${DEST_SHARE}/7z${EXEEXT}"
+rm -f  "${DEST_DIR}${DEST_SHARE}/7za${EXEEXT}"
 rm -f  "${DEST_DIR}${DEST_SHARE}/7zCon.sfx"
-rm -f  "${DEST_DIR}${DEST_SHARE}/7zr"
-rm -f  "${DEST_DIR}${DEST_SHARE}/7zG"
-rm -f  "${DEST_DIR}${DEST_SHARE}/7zFM"
+rm -f  "${DEST_DIR}${DEST_SHARE}/7zr${EXEEXT}"
+rm -f  "${DEST_DIR}${DEST_SHARE}/7zG${EXEEXT}"
+rm -f  "${DEST_DIR}${DEST_SHARE}/7zFM${EXEEXT}"
 rm -f  "${DEST_DIR}${DEST_SHARE}/7z.so"
 chmod -R 777 "${DEST_DIR}${DEST_SHARE}/Codecs" 2> /dev/null
 chmod -R 777 "${DEST_DIR}${DEST_SHARE}/Formats" 2> /dev/null
@@ -112,22 +113,22 @@
   fi
 
 else
-  if [ -x bin/7za ]
+  if [ -x bin/7za${EXEEXT} ]
   then
     echo "- installing ${DEST_DIR}${DEST_BIN}/7za"
     mkdir -p "${DEST_DIR}${DEST_BIN}"
-    cp bin/7za "${DEST_DIR}${DEST_BIN}/7za"
-    chmod 755  "${DEST_DIR}${DEST_BIN}/7za"
-    strip      "${DEST_DIR}${DEST_BIN}/7za"
+    cp bin/7za${EXEEXT} "${DEST_DIR}${DEST_BIN}/7za${EXEEXT}"
+    chmod 755  "${DEST_DIR}${DEST_BIN}/7za${EXEEXT}"
+    strip      "${DEST_DIR}${DEST_BIN}/7za${EXEEXT}"
   fi
 
-  if [ -x bin/7zr ]
+  if [ -x bin/7zr${EXEEXT} ]
   then
     echo "- installing ${DEST_DIR}${DEST_BIN}/7zr"
     mkdir -p "${DEST_DIR}${DEST_BIN}"
-    cp bin/7zr "${DEST_DIR}${DEST_BIN}/7zr"
-    chmod 755  "${DEST_DIR}${DEST_BIN}/7zr"
-    strip      "${DEST_DIR}${DEST_BIN}/7zr"
+    cp bin/7zr${EXEEXT} "${DEST_DIR}${DEST_BIN}/7zr${EXEEXT}"
+    chmod 755  "${DEST_DIR}${DEST_BIN}/7zr${EXEEXT}"
+    strip      "${DEST_DIR}${DEST_BIN}/7zr${EXEEXT}"
   fi
 fi
 
@@ -186,14 +187,14 @@
 
 use_lang="n"
 
-if [ -x bin/7zG ]
+if [ -x bin/7zG${EXEEXT} ]
 then
   use_lang="o"
-  cp GUI/p7zipForFilemanager "${DEST_DIR}${DEST_BIN}/"
+  cp GUI/p7zipForFilemanager${EXEEXT} "${DEST_DIR}${DEST_BIN}/"
   chmod 755 "${DEST_DIR}${DEST_BIN}/"
 fi
 
-if [ -x bin/7zFM ]
+if [ -x bin/7zFM${EXEEXT} ]
 then
   use_lang="o"
 fi
--- p7zip_16.02/makefile.common.orig	2017-04-21 13:40:34.127837600 +0900
+++ p7zip_16.02/makefile.common	2017-04-21 13:43:09.756008300 +0900
@@ -1,10 +1,10 @@
 MKDIR = mkdir -p
 
-DEST_HOME=/usr/local
+DEST_HOME=/usr
 DEST_BIN=$(DEST_HOME)/bin
 DEST_SHARE=$(DEST_HOME)/lib/p7zip
 DEST_SHARE_DOC=$(DEST_HOME)/share/doc/p7zip
-DEST_MAN=$(DEST_HOME)/man
+DEST_MAN=$(DEST_HOME)/share/man
 
 .PHONY: default all all2 7za 7zG 7zFM sfx 7z 7zr Client7z common common7z LangAndHelp tar_bin depend test test_7z test_7zr test_7zG test_Client7z LzmaCon test_LzmaCon  all_test app cppcheck lzham test_lib other
 
--- p7zip_16.02/makefile.cygwin_asm.orig	2015-09-19 18:49:28.000000000 +0900
+++ p7zip_16.02/makefile.cygwin_asm	2017-04-21 13:37:25.518175700 +0900
@@ -11,7 +11,7 @@
 CXX=g++
 CC=gcc
 LINK_SHARED=-shared
-ASM=nasm -f gnuwin32
+ASM=nasm -f win32
 
 # Cygwin does not need -ldl
 LOCAL_LIBS=-lpthread
