zgv? or other console-based graphics viewer

zgv? or other console-based graphics viewer

Post by Itchy and Scratch » Fri, 26 Apr 2002 19:43:51



Howdy,

I tried to build zgv on my FreeBSD 4.5-STABLE system and the process
failed right away, with some obscure errors in the Makefile (e.g.
after parsing the line VERSION=5.5, make died complaining about a
missing parameter); there is no official port in the ports collection
and its home page (http://www.svgalib.org/rus/zgv/index.html) says
nothing about FreeBSD. OK, so maybe I should give up trying to use
this little proggie. But - does anybody know about a similar
application i.e. a console-based graphic viewer? I don't need nothing
sophisticated, anything able to view JPEGs will do.

TIA

 
 
 

zgv? or other console-based graphics viewer

Post by Harley Sportsma » Sat, 27 Apr 2002 11:17:51


cd /usr/ports/graphics/seejpeg && make install && make clean && cd
/dir/with/images/ && seejpeg *.jpg *.gif

etc etc
you're welcome,
and take care
sponix

yes, zgv would be very nice, but I think it has lots of stuff in it that
needs glibc/linux



Quote:> Howdy,

> I tried to build zgv on my FreeBSD 4.5-STABLE system and the process
> failed right away, with some obscure errors in the Makefile (e.g.
> after parsing the line VERSION=5.5, make died complaining about a
> missing parameter); there is no official port in the ports collection
> and its home page (http://www.svgalib.org/rus/zgv/index.html) says
> nothing about FreeBSD. OK, so maybe I should give up trying to use
> this little proggie. But - does anybody know about a similar
> application i.e. a console-based graphic viewer? I don't need nothing
> sophisticated, anything able to view JPEGs will do.

> TIA


 
 
 

zgv? or other console-based graphics viewer

Post by Itchy and Scratch » Sat, 27 Apr 2002 11:32:59


On Thu, 25 Apr 2002 21:17:51 -0500


> cd /usr/ports/graphics/seejpeg && make install && make clean && cd
> /dir/with/images/ && seejpeg *.jpg *.gif

> etc etc

Well, already tried that (before posting my initial message). No joy,
though - seejpeg refuses to work with my NVIDIA MX200 card - all I get
is a garbled image on the console (and on any subsequent consoles I
would open). Anyway, I was hoping to find something with a nice&clean
interface, like zgv's, suitable for browsing through directories - and
seejpeg isn't exactly that kind of proggie.

Quote:> etc etc
> you're welcome,
> and take care
> sponix

> yes, zgv would be very nice, but I think it has lots of stuff in it that
> needs glibc/linux

Hm, I'm not very sure about that. I think the problem it's related to
BSD's make; tried to use gmake - this one went further with the build
process, but eventually coughed&died nevertheless.

No luck with this nice little application, it seems.  And there is no
other similar proggie for FreeBSD. Damn! :-(

 
 
 

zgv? or other console-based graphics viewer

Post by Lars Eighne » Sat, 27 Apr 2002 12:24:05


In our last episode, <liehcugk1eqn4kge8ejb08ot8mrmtgb...@4ax.com>,
the lovely and talented Itchy and Scratchy broadcast on
comp.unix.bsd.freebsd.misc:

> No luck with this nice little application, it seems.  And there is no
> other similar proggie for FreeBSD. Damn! :-(

Okay, I'm only going to do this once.

I am an idiot.  I know nothing about C, graphics, or FreeBSD
security.  If you do this you are a big idiot too, especially
if you have other users.  I have got zgv to work.  I don't know
how I did it, but I am pretty sure I did lots of bad things
to security and all kind of other stuff.

Zgv only works if you launch it from the console (i.e. ttyv0),
so in every application that uses zqv (e.g. as an image viewer
in lynx) must call a script to test whether it is in the console
before it launches zgv because if you launch zgv as I have it
from any other virtual term the system *WILL* lock up and you will
have to reboot, and you will be lucky if you can get a clean shutdown
with the three finger salute before the reboot.  Obviously for
command line use you should alias zgv to a similar script.

If your computer blows up, your security lets Hong Kong gain
control of your computer, or your hard disks crash, it is because
you were an idiot and followed these instructions, so don't
come crying to me.

First install svgalib.  At the time I think I had to hack the
hell out of svgalib to get it to work, but there is a port now.
I am not 100% certain the port svgalib will work, but it comes
with test stuff (I think) so get it up and running first.

Now am about to give you the diffs for zgv-5.1.  I am pretty sure
some of the hacks serve no useful purpose.  I am positive that
I have not done it elegantly.  And it is a good bet you security
will be screwed.

Here are the diffs.  What you do with them is your own damn
business.  May the Daemon have mercy on your soul

diff -C 2 -r share/zgv-5.1/Makefile zgv-5.1/Makefile
*** share/zgv-5.1/Makefile      Thu Jun  1 09:48:58 2000
--- zgv-5.1/Makefile    Wed Oct 11 17:25:57 2000
***************
*** 29,33 ****
  all: src man infowarn

! src: zgv src/install-info

  # We try this the whole time, as the dependancies are a bit
--- 29,33 ----
  all: src man infowarn

! src: zgv

  # We try this the whole time, as the dependancies are a bit
***************
*** 36,41 ****
        $(MAKE) -C src zgv

! src/install-info: src/install-info.c
!       $(MAKE) -C src install-info

  man: doc/zgv.1
--- 36,41 ----
        $(MAKE) -C src zgv

! #src/install-info: src/install-info.c
! #     $(MAKE) -C src install-info

  man: doc/zgv.1
diff -C 2 -r share/zgv-5.1/config.mk zgv-5.1/config.mk
*** share/zgv-5.1/config.mk     Thu Jun  1 09:53:23 2000
--- zgv-5.1/config.mk   Wed Oct 11 20:00:07 2000
***************
*** 14,18 ****
  # Usually it will be simpler to just set PREFIX.
  #
! PREFIX=/usr

  # comment this out to use traditional info/man locations, e.g.
--- 14,18 ----
  # Usually it will be simpler to just set PREFIX.
  #
! PREFIX=/usr/local

  # comment this out to use traditional info/man locations, e.g.
***************
*** 20,24 ****
  # /usr/share/info and /usr/share/man/man1.
  #
! SHARE_INFIX=/share

  BINDIR=$(PREFIX)/bin
--- 20,24 ----
  # /usr/share/info and /usr/share/man/man1.
  #
! #SHARE_INFIX=/share

  BINDIR=$(PREFIX)/bin
***************
*** 33,37 ****
  # you) you should uncomment this to prevent `make install' doing that.
  #
! #INFO_DIR_UPDATE=no

--- 33,37 ----
  # you) you should uncomment this to prevent `make install' doing that.
  #
! INFO_DIR_UPDATE=no

diff -C 2 -r share/zgv-5.1/doc/Makefile zgv-5.1/doc/Makefile
*** share/zgv-5.1/doc/Makefile  Thu Jun  1 09:52:43 2000
--- zgv-5.1/doc/Makefile        Wed Oct 11 20:19:33 2000
***************
*** 30,38 ****

  # I think this one's getting just a tiny bit confusing :-}
! ifeq ($(INFO_DIR_UPDATE),no)
  install:
! else
! install: ../src/install-info
! endif
        install -m 444 zgv.1 $(MANDIR)
        install -m 444 zgv zgv-? $(INFODIR)
--- 30,38 ----

  # I think this one's getting just a tiny bit confusing :-}
! #ifeq ($(INFO_DIR_UPDATE),no)
  install:
! #else
! #install: ../src/install-info
! #endif
        install -m 444 zgv.1 $(MANDIR)
        install -m 444 zgv zgv-? $(INFODIR)
***************
*** 40,55 ****
  # Info always uses a dir file in preference to a dir.gz, so we don't use
  # dir.gz unless it's the only game in town.
! ifneq ($(INFO_DIR_UPDATE),no)
!       if [ -f $(INFODIR)/dir.gz -a ! -f $(INFODIR)/dir ]; then \
!         gzip -d $(INFODIR)/dir.gz; \
!         ../src/install-info zgv $(INFODIR)/dir; \
!         gzip $(INFODIR)/dir; \
!       else \
!         ../src/install-info zgv $(INFODIR)/dir; \
!       fi
! endif
!
! ../src/install-info: ../src/install-info.c
!       make -C ../src install-info

  # can't easily fix dir :-/, but do remove the files.
--- 40,55 ----
  # Info always uses a dir file in preference to a dir.gz, so we don't use
  # dir.gz unless it's the only game in town.
! #ifneq ($(INFO_DIR_UPDATE),no)
! #     if [ -f $(INFODIR)/dir.gz -a ! -f $(INFODIR)/dir ]; then \
! #       gzip -d $(INFODIR)/dir.gz; \
! #       ../src/install-info zgv $(INFODIR)/dir; \
! #       gzip $(INFODIR)/dir; \
! #     else \
! #       ../src/install-info zgv $(INFODIR)/dir; \
! #     fi
! #endif
!       install-info $(INFODIR)/zgv $(INFODIR)/dir
! #../src/install-info: ../src/install-info.c
! #     make -C ../src install-info

  # can't easily fix dir :-/, but do remove the files.
Only in share/zgv-5.1/doc: zgv
Only in share/zgv-5.1/doc: zgv-1
Only in share/zgv-5.1/doc: zgv-2
Only in share/zgv-5.1/doc: zgv-3
Only in share/zgv-5.1/doc: zgv-4
diff -C 2 -r share/zgv-5.1/src/Makefile zgv-5.1/src/Makefile
*** share/zgv-5.1/src/Makefile  Thu Jun  1 09:51:08 2000
--- zgv-5.1/src/Makefile        Wed Oct 11 18:34:18 2000
***************
*** 17,22 ****
  CFLAGS = $(WARNOPTS) $(PCDDEF) \
        -DRGB_DB_FILE=\"$(RGB_DB)\" \
!       -O2 -fomit-frame-pointer -finline-functions
!
  ZGV_LIBS = -lvgagl -lvga -ljpeg -lpng -lz -lm
  ifeq ($(PCDDEF),-DPCD_SUPPORT)
--- 17,22 ----
  CFLAGS = $(WARNOPTS) $(PCDDEF) \
        -DRGB_DB_FILE=\"$(RGB_DB)\" \
!       -O2 -fomit-frame-pointer -finline-functions \
!       -idirafter /usr/local/include -idirafter /usr/local -L /usr/local/lib
  ZGV_LIBS = -lvgagl -lvga -ljpeg -lpng -lz -lm
  ifeq ($(PCDDEF),-DPCD_SUPPORT)
***************
*** 28,32 ****
  # (It would also be weird to have it made by the `doc' Makefile, IMHO.)

! all: zgv install-info

  ZGV_OBJS = zgv.o vgadisp.o font.o 3deffects.o mousecur.o \
--- 28,32 ----
  # (It would also be weird to have it made by the `doc' Makefile, IMHO.)

! all: zgv

  ZGV_OBJS = zgv.o vgadisp.o font.o 3deffects.o mousecur.o \
***************
*** 49,57 ****
        $(CC) $(CFLAGS) -o bdf2h bdf2h.o

! install-info: install-info.c
!       $(CC) $(INFODIRDEF) -o install-info install-info.c

  install: all
!       install -m 4511 -o root -g root -s zgv $(BINDIR)

  uninstall:
--- 49,57 ----
        $(CC) $(CFLAGS) -o bdf2h bdf2h.o

! #install-info: install-info.c
! #     $(CC) $(INFODIRDEF) -o install-info install-info.c

  install: all
!       install -m 4511 -o root -g wheel -s zgv $(BINDIR)

  uninstall:
***************
*** 70,74 ****
  helppage.o: helppage.c 3deffects.h font.h readnbkey.h rc_config.h \
   rcfile.h mousecur.h zgv.h
! install-info.o: install-info.c
  magic.o: magic.c magic.h
  mousecur.o: mousecur.c rc_config.h rcfile.h zgv.h
--- 70,74 ----
  helppage.o: helppage.c 3deffects.h font.h readnbkey.h rc_config.h \
   rcfile.h mousecur.h zgv.h
! #install-info.o: install-info.c
  magic.o: magic.c magic.h
  mousecur.o: mousecur.c rc_config.h rcfile.h zgv.h
diff -C 2 -r share/zgv-5.1/src/readnbkey.c zgv-5.1/src/readnbkey.c
*** share/zgv-5.1/src/readnbkey.c       Thu Mar  9 22:02:03 2000
--- zgv-5.1/src/readnbkey.c     Wed Oct 11 18:47:36 2000
***************
*** 17,21 ****
  #include <vgamouse.h>
  #include <vgakeyboard.h>        /* for SCANCODE_{F1,F11} */
! #include <linux/kd.h>
  #include "zgv.h"
  #include "readnbkey.h"
--- 17,21 ----
  #include <vgamouse.h>
  #include <vgakeyboard.h>        /* for SCANCODE_{F1,F11} */
! #include <sys/kbio.h>       /* #include <linux/kd.h> */
  #include "zgv.h"
  #include "readnbkey.h"
***************
*** 46,55 ****
  int is_logical_keymap(int ttyfd)
  {
! struct kbentry ent1,ent2;

  /* this is horrible, but I really do need the scancodes to check this :-(
   * as the mapping is done at that level.
   */
! ent1.kb_table=K_NORMTAB;
  ent1.kb_index=SCANCODE_F11;
  ent2.kb_table=K_SHIFTTAB;
--- 46,55 ----
  int is_logical_keymap(int ttyfd)
  {
! /* struct kbentry ent1,ent2; */

  /* this is horrible, but I really do need the scancodes to check this :-(
   * as the mapping is done at that level.
   */
! /* ent1.kb_table=K_NORMTAB;
  ent1.kb_index=SCANCODE_F11;
  ent2.kb_table=K_SHIFTTAB;
***************
*** 60,64 ****

  if(ent1.kb_value==ent2.kb_value)
!   return(0);

  return(1);
--- 60,64 ----

  if(ent1.kb_value==ent2.kb_value)
!   return(0); */

  return(1);
diff -C 2 -r share/zgv-5.1/src/zgv.c zgv-5.1/src/zgv.c
*** share/zgv-5.1/src/zgv.c     Thu Apr 13 11:02:18 2000
--- zgv-5.1/src/zgv.c   Wed Oct 11 19:14:14 2000
***************
*** 34,38 ****
  #include <sys/file.h>
  #include <sys/ioctl.h>
! #include <sys/vt.h>
  #include <errno.h>
  #include <vga.h>
--- 34,38 ----
  #include <sys/file.h>
  #include <sys/ioctl.h>
! #include <sys/consio.h>  /* #include <sys/vt.h> */
  #include <errno.h>
  #include <vga.h>
***************
*** 3109,3113 ****
  static char vt_filename[128];
  struct stat sbuf;
! struct vt_stat vts;
  int major,minor;
  int fd;
--- 3109,3113 ----
  static char vt_filename[128];
  struct stat sbuf;
! int vts;
  int major,minor;
  int fd;
***************
*** 3120,3124 ****
  zgv_vt=minor=sbuf.st_rdev&0xff;
  close(fd);
! if(major==4 && minor<64)
    return(1);  /* if on a console, already ok */

--- 3120,3124 ----
  zgv_vt=minor=sbuf.st_rdev&0xff;
  close(fd);
! if(major==12 && minor<64)
    return(1);  /* if on a console, already ok */

***************
*** 3131,3136 ****
  /* still root perms, so this shouldn't be a problem...
...

read more »

 
 
 

zgv? or other console-based graphics viewer

Post by Itchy and Scratch » Sat, 27 Apr 2002 12:51:26


On Fri, 26 Apr 2002 03:24:05 GMT

[Mother-Of-All-Disclaimers deleted ;-)]

Thanks for the diffs, I'll go experimenting on my home machine, in a
couple of hours.

Still wondering: am I the only dinosaur left? there is no X on my
machine and I intend to keep it this way (it would be REALLY
ridiculous to install X as a dependency for a graphic viewer). Am I
the only one with such a setup? if not, don't you fellows dinosaurs
feel the need for a zgv port? I don't really understand why it hasn't
been done (and no, *I can't* do it, I'm just a sysadmin, I am
definitely no programmer).

 
 
 

zgv? or other console-based graphics viewer

Post by Lars Eighne » Sat, 27 Apr 2002 13:29:52



the lovely and talented Itchy and Scratchy broadcast on
comp.unix.bsd.freebsd.misc:

> On Fri, 26 Apr 2002 03:24:05 GMT

> [Mother-Of-All-Disclaimers deleted ;-)]
> Thanks for the diffs, I'll go experimenting on my home machine, in a
> couple of hours.

Okay, let me tell you what I remember, which isn't much.  Basically
there are a couple of headers that don't exist in BSD but for which
BSD headers can be substituted.  sys/kbio.h is bsd for linux/kd.h
and sys/consio.h for sys/vt.h are two I can remember.  

For linux /dev/tty? you must substitute bsd /dev/ttyv?

There's some stuff where it is testing for the console which
I just couldn't get to work right, so I just stepped on it,
and that is why you must call it with a script that tests
for the console.  And by the by, the only way I could figure how to
do that was to set a variable on login if in ttyv0.

Otherwise, it has been about 6 months since I did this, so it
might as well have been done by a space alien so far as my
ability to understand what I did is concerned.

Quote:> Still wondering: am I the only dinosaur left? there is no X on my
> machine and I intend to keep it this way (it would be REALLY
> ridiculous to install X as a dependency for a graphic viewer).

I have X but I seldom use it.  And yes, I think I have found some
applications - ones you wouldn't think of as being particularly
graphic which have dependencies in X.

Quote:> Am I
> the only one with such a setup? if not, don't you fellows dinosaurs
> feel the need for a zgv port? I don't really understand why it hasn't
> been done (and no, *I can't* do it, I'm just a sysadmin, I am
> definitely no programmer).

BSD is very server-oriented and there are many security concerns that
are not really necessary for your own personal computer that isn't
going to have any remote logins.  Anyway, console graphics seem
to send BSD developers into serious paranoid episodes.  And they
just can't see why people don't want to use X, which is the most
bloated piece of software on earth, not excluding MS products.

If you get arachne running in a BSD console, let me know.

--

       Health is merely the slowest possible rate at which one can die.

 
 
 

zgv? or other console-based graphics viewer

Post by Harley Sportsma » Mon, 29 Apr 2002 04:08:26


you probably need to edit the /usr/local/etc/vga/libvga.config for svgalib
to support your card right and seejpeg to work properly, or at least I find
it very common.

take care,
sponix



> On Thu, 25 Apr 2002 21:17:51 -0500

> > cd /usr/ports/graphics/seejpeg && make install && make clean && cd
> > /dir/with/images/ && seejpeg *.jpg *.gif

> > etc etc
> Well, already tried that (before posting my initial message). No joy,
> though - seejpeg refuses to work with my NVIDIA MX200 card - all I get
> is a garbled image on the console (and on any subsequent consoles I
> would open). Anyway, I was hoping to find something with a nice&clean
> interface, like zgv's, suitable for browsing through directories - and
> seejpeg isn't exactly that kind of proggie.

> > etc etc
> > you're welcome,
> > and take care
> > sponix

> > yes, zgv would be very nice, but I think it has lots of stuff in it that
> > needs glibc/linux
> Hm, I'm not very sure about that. I think the problem it's related to
> BSD's make; tried to use gmake - this one went further with the build
> process, but eventually coughed&died nevertheless.

> No luck with this nice little application, it seems.  And there is no
> other similar proggie for FreeBSD. Damn! :-(