diff options
author | Martin Wilke <miwi@FreeBSD.org> | 2011-01-29 14:16:32 +0000 |
---|---|---|
committer | Martin Wilke <miwi@FreeBSD.org> | 2011-01-29 14:16:32 +0000 |
commit | b0073c87c8d336c991463d24952d20917d5c1edd (patch) | |
tree | d8531d90f500ff25f5d6dc828564bda173a358a3 /x11 | |
parent | - Update to 2.3.2 (diff) |
- Update to 1.4
PR: 153398
Submitted by: Alex Kozlov <spam@rm-rf.kiev.ua> (maintainer)
Feature safe: yes
Notes
Notes:
svn path=/head/; revision=268377
Diffstat (limited to 'x11')
-rw-r--r-- | x11/printscreen/Makefile | 3 | ||||
-rw-r--r-- | x11/printscreen/files/printscreen.in | 31 |
2 files changed, 19 insertions, 15 deletions
diff --git a/x11/printscreen/Makefile b/x11/printscreen/Makefile index 1e6792efcaef..383b11f6af08 100644 --- a/x11/printscreen/Makefile +++ b/x11/printscreen/Makefile @@ -6,8 +6,7 @@ # PORTNAME= printscreen -PORTVERSION= 1.3 -PORTREVISION= 2 +PORTVERSION= 1.4 CATEGORIES= x11 DISTFILES= diff --git a/x11/printscreen/files/printscreen.in b/x11/printscreen/files/printscreen.in index 3a2e7dbaacd7..29feaa18da03 100644 --- a/x11/printscreen/files/printscreen.in +++ b/x11/printscreen/files/printscreen.in @@ -1,7 +1,5 @@ #!/bin/sh -PATH=/bin:/usr/bin:/usr/local/bin - xwdcommon='-nobdrs' xwdroot='-root' @@ -10,9 +8,14 @@ OUTFMT=png STOREDIR="${HOME}/.screenshots" SHOTDATE="$(date +%Y.%m.%d-%H.%M.%S)" +have() +{ + type $1 >/dev/null 2>&1 && return 0 +} + parse_options() { - local OPT OPTARG OPTIND fmt fmtlist i + local OPT OPTARG OPTIND fmt fmtlist prefix while getopts d:f:bhlqs OPT; do # escape meta @@ -26,26 +29,28 @@ parse_options() unset INFMT for fmt in pnm pbm pgm ppm; do - if [ -x /usr/local/bin/${fmt}to${OUTFMT} ]; then - INFMT=${fmt} - break - fi + have "${fmt}to${OUTFMT}" && { INFMT=${fmt}; break; } done [ -z "${INFMT}" ] && usage ;; l) - for i in /usr/local/bin/p[nbgp]mto*; do - fmtlist="${fmtlist} $(echo ${i} | \ - sed -Ee's:/usr/local/bin/(pnm|pbm|pgm|ppm)to::')" - done + prefix=$(type ppmtoppm 2>/dev/null | \ + sed 's:ppmtoppm is \(.*\)ppmtoppm:\1:') + if [ -z "${prefix}" ]; then + echo 'Cannot find image converters. Make sure that netpbm are installed' + exit 1 + fi + + fmtlist=$(echo ${prefix}/p[nbgp]mto* | tr ' ' '\n' | \ + sed -E 's:^.*/(pnm|pbm|pgm|ppm)to::g') echo Supported output formats: echo ${fmtlist} exit 0 ;; q) xwdcommon="${xwdcommon} -silent";; s) unset xwdroot ;; - h|*) usage ;; + *) usage ;; esac done @@ -63,7 +68,7 @@ usage() echo ' -q be silent' echo ' -s interactively choose a window' echo - echo "Screenshots stored in ${HOME}/.screenshots" + echo "By default screenshots stored in ${STOREDIR}" echo exit 1 } |