aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Aulery <lkppo@free.fr>2012-01-12 02:03:51 +0100
committerGerd Hoffmann <kraxel@redhat.com>2012-01-17 09:36:18 +0100
commitf66d5fd21f83b3c041cd032effcccec20de52184 (patch)
treeaf25957b8773c413f5eaef0c1d86b1007fbcbcb5
parent6d690577ffa6cb51a101c15c5634e719583f1fec (diff)
downloadfbida-f66d5fd21f83b3c041cd032effcccec20de52184.tar.gz
Improved fbgs
* Support almost all fbi options * Add long versions of the options * Add option -b to make optional the ringer when the document is ready * Add option -r to render document with an arbitrary resolution * Add the options -fp and -lp to view a limited range of pages * Fix help text
-rwxr-xr-xfbgs82
-rw-r--r--fbgs.man63
2 files changed, 123 insertions, 22 deletions
diff --git a/fbgs b/fbgs
index eb41a8f..d9e03a4 100755
--- a/fbgs
+++ b/fbgs
@@ -11,8 +11,54 @@ gsopts=""
passwd=""
device="tiffpack"
opt=1
+bell="off"
+helptext="
+This program displays PostScript/pdf files using the linux framebuffer device.
+It is a simple wrapper script for GhostScript and fbi.
+
+usage: fbgs [fbgs options] [fbi options] file
+
+ -b --bell emit a beep when the document is ready
+ -h --help print this help text
+ -p --password <arg> a <password> passed to the PDF
+ -fp --firstpage <arg> begins on the <arg> page
+ -lp --lastpage <arg> stops on the <arg> page
+ -c --color pages in color
+ -l pages rendered with 100 dpi
+ -xl pages rendered with 120 dpi
+ -xxl pages rendered with 150 dpi
+ -r --resolution <arg> choose resolution of <arg> dpi
+
+Read the fbgs(1) and fbi(1) manpages for more details.
+"
+
while test "$opt" = "1"; do
case "$1" in
+ # fbgs options
+ -b | --bell)
+ bell="on"
+ shift
+ ;;
+ -h | --help)
+ printf "$helptext"
+ exit 1
+ ;;
+ -p | --password)
+ password="$2"
+ shift; shift
+ ;;
+ -fp | --firstpage)
+ gsopts="$gsopts -dFirstPage=$2"
+ shift; shift
+ ;;
+ -lp | --lastpage)
+ gsopts="$gsopts -dLastPage=$2"
+ shift; shift
+ ;;
+ -c | --color)
+ device="png16m"
+ shift
+ ;;
-l) gsopts="$gsopts -r100x100"
shift
;;
@@ -22,23 +68,33 @@ while test "$opt" = "1"; do
-xxl) gsopts="$gsopts -r150x150"
shift
;;
- -q | -a | --fitwidth)
+ -r | --resolution)
+ gsopts="$gsopts -r$2x$2"
+ shift; shift
+ ;;
+ # fbi options without argument
+ -a | --autozoom | \
+ --autoup | --noautoup | \
+ --autodown | --noautodown | \
+ --fitwidth | --nofitwidth | \
+ -v | --verbose | --noverbose | \
+ -u | --random | --norandom | \
+ -1 | --once | --noonce)
fbiopts="$fbiopts $1"
shift
;;
- -d | -m | -t | -g | -f)
+ # fbi options with one argument
+ -T | --vt | \
+ -s | --scroll | \
+ -t | --timeout | \
+ -g | --gamma | \
+ -f | --font | \
+ -d | --device | \
+ -m | --mode)
fbiopts="$fbiopts $1 $2"
shift; shift
;;
- -p) password="$2"
- shift; shift
- ;;
- -h) echo fixme: help text
- exit 1
- ;;
- -c) device="png16m"
- shift
- ;;
+ # others options
-*) echo "unknown option: $1"
exit 1
;;
@@ -58,7 +114,9 @@ gs -dSAFER -dNOPAUSE -dBATCH \
"$1"
# tell the user we are done :-)
-echo -ne "\\007"
+if test "$bell" = "on"; then
+ printf "\a"
+fi
# sanity check
pages=`ls $DIR/ps*.tiff 2>/dev/null | wc -l`
diff --git a/fbgs.man b/fbgs.man
index 51a29d9..90e714e 100644
--- a/fbgs.man
+++ b/fbgs.man
@@ -1,4 +1,4 @@
-.TH FBGS 1 "(c) 1999\-2003 Gerd Knorr" "FBGS 2.07" "PostScript/pdf viewer for the linux framebuffer console"
+.TH FBGS 1 "(c) 1999\-2012 Gerd Knorr" "FBGS 2.08" "PostScript/pdf viewer for the linux framebuffer console"
\#
\#
.SH NAME
@@ -6,7 +6,15 @@ fbgs \- Poor man's PostScript/pdf viewer for the linux framebuffer console.
\#
\#
.SH SYNOPSIS
-\fBfbgs\fP\ [\fB\-l\fP|\fB\-xl\fP|\fB\-xxl\fP]\ [\fB\-c\fP]\ [\fB\-p\fP\ \fIpassword\fP]\ [\fIfbi\ options\fP]\ \fIfile\fP
+\fBfbgs\fP\
+ [\fB\-l\fP|\fB\-xl\fP|\fB\-xxl\fP|\fB\-r\fP \fIn\fP]\
+ [\fB\-c\fP]\
+ [\fB\-b\fP]\
+ [\fB\-p\fP\ \fIpassword\fP]\
+ [\fB\--fp\fP\ \fInumber\fP]\
+ [\fB\--lp\fP\ \fInumber\fP]\
+ [\fIfbi\ options\fP]\
+ \fIfile\fP
\#
\#
.SH DESCRIPTION
@@ -22,23 +30,40 @@ to display them.
.BR Fbgs
understands all
.BR fbi (1)
-options (they are passed through).
+options (they are passed through), except: store, list, text, (no)comments, e,
+(no)edit, (no)backup, (no)preserve, (no)readahead, cachemem, blend.
+.P
Additionally you can specify:
.TP
-\fB\-l\fP
+.B -h, --help
+Print usage info (overwrites fbi option).
+.TP
+.B -b, --bell
+Emit a beep when the document is ready.
+.TP
+.B -c, --color
+To render the pages in color (default is N&B).
+.TP
+.B -l
To get the pages rendered with 100 dpi (default is 75).
.TP
-\fB\-xl\fP
+.B -xl
To get the pages rendered with 120 dpi.
.TP
-\fB\-xxl\fP
+.B -xxl
To get the pages rendered with 150 dpi.
.TP
-\fB\-c\fP
-To render the pages in color (default is N&B).
+.BI "-r" "\ n" ", --resolution" "\ n"
+To get the pages rendered with \fIn\fP dpi (overwrites fbi option).
.TP
-\fB\-p\fP \fIpassword\fP
-You can use on if your PDF file requires password.
+.BI "-fp" "\ number" ", --firstpage" "\ number"
+Begins interpreting on the designated page of the document.
+.TP
+.BI "-lp" "\ number" ", --lastpage" "\ number"
+Stops interpreting after the designated page of the document.
+.TP
+.BI "-p" "\ password" ", --password" "\ password"
+You can use this option if your PDF file requires a \fIpassword\fP.
\#
\#
.SH AUTHOR
@@ -49,3 +74,21 @@ Gerd Knorr
.SH SEE ALSO
.BR fbi (1),
.BR gs (1)
+\#
+\#
+.SH COPYRIGHT
+Copyright (c) 1999-2012 Gerd Knorr <kraxel@bytesex.org>
+.P
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+.P
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+.P
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.