#!/usr/local/bin/perl

       
@gif_file = pack("c43",
0x047, 0x049, 0x046, 0x038, 0x039, 0x061, 0x02, 0x00, 
0x01, 0x00, 0x080, 0x01, 0x00, 0x00, 0x00, 0x00, 
0x0ff, 0x0ff, 0x0ff, 0x021, 0x0f9, 0x04, 0x01, 0x00, 
0x00, 0x01, 0x00, 0x02c, 0x00, 0x00, 0x00, 0x00, 
0x02, 0x00, 0x01, 0x00, 0x040, 0x02, 0x02, 0x04c, 
0x0a, 0x00, 0x03b);


if (defined ($ENV{"PATH_TRANSLATED"})) {
    $path = $ENV{"PATH_TRANSLATED"};
 }
 else {
   &write_error("PATH_TRANSLATED missing");
   }
   
print "Content-TYPE: image/gif\n\n";

print  @gif_file;

open (CNTR, "+<$path") || &write_error("$path not found");

$input = <CNTR>;
$input =~ s/\n$//;
$input++;

seek(CNTR,0,0);
print CNTR $input;

close CNTR;


open(GIF, ">temp.gif");
binmode(GIF);
print (GIF @gif_file);

close GIF;

sub write_error {
    print "Content-TYPE: text/html\n\n";
    print "@_\n";
    exit 0;

}

# gifcnt.pl
# M. Turner - August 15/96
#
#Protocol for University of Manitoba Web Server is as follows:
#
# Usage:  <img src = "cgi-bin_path/gifcnt.pl/counter_file_path/counter_file">
# gifcnt.pl must be set to executable by all:
#     chmod a+x gifcnt.pl      
#cgi-bin_path: cgi-bin directory as accessed from HTML file 
#    or full URL:  "http://www.umanitoba.ca/cgi-bin/your_cgi_directory
#counter_file_path: path relative to Web domain name 
#     if full URL is: "http://www.umanitoba.ca/my_department/my_directory/
#         then relative path is: my_department/my_directory
#counter_file:  text file containing the number 0 or number 1 to start
#      if you start with 0 then the file will contain the number of
#         hits; if you start with 1, it will hold the number of hits + 1
#      this file must be set to read/write to all:
#         chmod a+rw count.fil
# 
      