diff -ru cgi.orig/libgnats.pl cgi/libgnats.pl
--- cgi.orig/libgnats.pl	Thu Oct 23 17:21:18 1997
+++ cgi/libgnats.pl	Thu Oct 23 17:21:24 1997
@@ -1,10 +1,10 @@
-#!/usr/local/bin/perl
+#!/usr/bin/perl
 # libgnats.pl - a Perl interface to the GNATS bug tracking system
 # $Id: libgnats.pl,v 1.11 1996/09/03 14:01:20 karl Exp $
 
 $GNATS_BIN  = "/usr/local/bin"; # must be on nc
-$GNATS_LIB  = "/usr/local/lib";
-$GNATS_ROOT = "$GNATS_LIB/gnats/gnats-db" unless $GNATS_ROOT;
+$GNATS_LIB  = "/usr/local/libexec";
+$GNATS_ROOT = "/usr/local/share/gnats/gnats-db" unless $GNATS_ROOT;
 $GNATS_ADM  = "$GNATS_ROOT/gnats-adm";
 $PR_EDIT    = "$GNATS_LIB/gnats/pr-edit";
 $PR_ADDR    = "$GNATS_LIB/gnats/pr-addr";
@@ -41,6 +41,7 @@
 		"State",
 		"Responsible",
 		"Arrival-Date",
+		"Billing-Info", # Added for support of Billing
 	    );
 %fieldnames_single = (
 		"Submitter-Id", 1,
@@ -56,6 +57,7 @@
 		"State", 2,		# The fields with "2" are not submitted in SPRs.
 		"Responsible", 2,
 		"Arrival-Date", 2,
+		"Billing-Info", 1, # Added for support of Billing
 	    );
 
 # Multiple-line field names
diff -ru cgi.orig/pr.pl cgi/pr.pl
--- cgi.orig/pr.pl	Thu Oct 23 17:21:18 1997
+++ cgi/pr.pl	Thu Oct 23 17:21:24 1997
@@ -1,10 +1,13 @@
-#!/usr/local/bin/perl
+#!/usr/bin/perl
 # pr.pl - a WWW interface to the GNATS bug tracking system at NetCentric.
 # Original from http://alumni.caltech.edu/~dank.
 # 
 # $Id: pr.pl,v 1.47 1996/09/03 14:32:58 karl Exp $
 
-$cgi = "/usr/local/lib/www/cgi";
+#$cgi = "/usr/lib/cgi-bin";
+$cgi_dir = "/usr/lib";
+$cgi_subdir = "/cgi-bin";
+$cgi = $cgi_dir . $cgi_subdir;
 require "$cgi/libgnats.pl";
 require "$cgi/cgi-lib.pl";
 
@@ -16,22 +19,24 @@
 $LSPROG      = "/bin/ls";
 $TMPDIR = $ENV{"TMPDIR"} || "/tmp";
 
+
 # For owner-of.
 $ENV{"PATH"} .= ":/usr/local/bin";
 
 # Outside links:
-$doc = "http://nc.server.net/doc/bugdb";
+$gnats_www_site = "nc.server.net";
+$doc = "http://$gnats_www_site/doc/bugdb";
 $link{"categories"} = "$doc/categories.html";
-$link{"releases"} = "$doc/releases";
+$link{"releases"} = "$doc/releases.html";
 $link{"responsibles"} = "$doc/responsible";
 $link{"supercategories"} = "$doc/supercategories";
-$link{"fields"} = "\"/cgi/info2www?(gnats.info)Problem%20Report%20fields\"";
-$link{"states"} = "\"/cgi/info2www?(gnats.info)States\"";
+$link{"fields"} = "\"$cgi_subdir/info2www?(gnats.info)Problem%20Report%20fields\"";
+$link{"states"} = "\"$cgi_subdir/info2www?(gnats.info)States\"";
 $help_string = "Help for
 <a href=$link{'categories'}>categories</a>,
 <a href=$link{'fields'}>fields</a>,
 <a href=$link{'states'}>states</a>,
-<a href=\"/cgi/info2www?(gnats)\">overall system</a>.
+<a href=\"$cgi_subdir/info2www?(gnats)\">overall system</a>.
 ";
 
 
@@ -56,6 +61,12 @@
               "Priority",    "any"
           );
 
+# order by meaning
+@order_fieldnames = ( "Category", "Release", "State", "Synopsis", "Billing-Info", "Description",
+                      "Environment", "Fix", "Confidential", "Severity",
+                      "Priority", "Responsible", "Class", "Arrival-Date",
+                      "Originator");
+
 # query-pr --sql output order.
 @sql_fieldnames = ( "Number", "Category", "Synopsis", "Confidential",
                      "Severity", "Priority", "Responsible", "State",
@@ -78,7 +89,7 @@
 
 &read_originator;
 &read_editor;
-&read_release;    # added - dougy - get the standard release numbers file
+#&read_release;    # added - dougy - get the standard release numbers file
 
 ### Submit a new PR
 if ($PATH_INFO =~ m,^/new_pr,) {
@@ -87,6 +98,18 @@
 } elsif ($PATH_INFO =~ m,^/handle_new_pr,) {
     &handle_new_pr ();
 
+### Upgrade status of PR
+} elsif ($PATH_INFO =~ m,^/handle_upgrade_status,) {
+    &handle_upgrade_status ();
+
+### Pequest Patch
+} elsif ($PATH_INFO =~ m,^/handle_request_patch,) {
+    &handle_request_patch ();
+
+### Upgrade status of PR
+} elsif ($PATH_INFO =~ m,^/handle_technical_support_rating,) {
+    &handle_technical_support_rating ();
+
 ### Edit an existing PR
 } elsif ($PATH_INFO =~ m,^/edit_pr,) {
     &edit_pr ($1);
@@ -306,7 +329,8 @@
 
     # Get arguments
     local($_)=scalar(<STDIN>);
-    chop; s/\r$//;
+    #chop; 
+    s/\r$//;
     local($i,%input);
     undef(%fieldvalues);	# Global!
     foreach (split(/&/)) {
@@ -337,12 +361,12 @@
     }
 
     local ($full_release) = $fieldvalues{"Release"};
-    $fieldvalues{"Release"} = $nRelease{$full_release};
+#    $fieldvalues{"Release"} = $nRelease{$full_release};
 
     # Use the login for both Submitter-Id and Originator.
     local ($fullname) = $fieldvalues{"Originator"};
-    $fieldvalues{"Submitter-Id"} = $fieldvalues{"Originator"}
-      = $nOriginator{$fullname};
+#    $fieldvalues{"Submitter-Id"} = $fieldvalues{"Originator"}
+#      = $nOriginator{$fullname};
 
     # kludge
     $fieldvalues{"Confidential"} = "no";
@@ -389,6 +413,7 @@
 <p>
 $help_string
 ";
+
 }
 
 
@@ -405,18 +430,27 @@
     local (*in);
     &cgi_extract ($QUERY_STRING, *in);
 
+    # Keep the widths short. karl, 23mar96.
+    local($width)= 64;
+    local($height)= $HTTP_AGENT=~/X Win/ ? 2 : 4;
+    local($height2)=$height*2;
+    local ($synwidth) = $width - 10;
+
     print "<form method=post action=\"http:$SCRIPT_NAME/handle_new_pr\">\n";
 
     local ($current_full_name) = $in{"Originator"} || &guess_current_user ();
-    print "Originator (you):\n";
-    print "<select name=Originator>\n";
-    for (sort keys %nOriginator) {
-	print "<option";
-	print " selected" if $_ eq $current_full_name;
-	print ">$_\n";
-    }
-    print "<option selected value=\"\">undefined\n" unless $in{"Originator"};
-    print "</select>\n";
+########
+#    print "Originator (you):\n";
+#    print "<select name=Originator>\n";
+#    for (sort keys %nOriginator) {
+#	print "<option";
+#	print " selected" if $_ eq $current_full_name;
+#	print ">$_\n";
+#    }
+#    print "<option selected value=\"\">undefined\n" unless $in{"Originator"};
+#    print "</select>\n";
+    print "E-mail address: <input name='Submitter-Id' size=15>\n";
+    print "Originator (you): <input name='Originator' size=15 value='$current_full_name'><br>\n";
 
     print "Organization:\n";
     $in{"Organization"} = "tech" unless $in{"Organization"};
@@ -428,6 +462,9 @@
     print "\n";
 
     print "<p>\n";
+    print "Billing information: <input name='Billing-Info' size=$synwidth><br>\n";
+
+    print "<p>\n";
     print "<a href=$link{'categories'}>";
     print "Category</a>:\n";
     print "<select name=Category>\n";
@@ -440,15 +477,17 @@
     print "<option selected value=\"\">undefined\n" unless $in{"Category"};
     print "</select>\n";
 
-    print "Release:\n";
+############
+#    print "Release:\n";
     $in{"Release"} = "Unsure" unless $in{"Release"};
-    print "<select name=Release>\n";
-    for (keys %nRelease) {
-	print "<option";
-	print " selected" if $_ eq $in{"Release"};
-	print ">$_\n";
-    }
-    print "</select>\n";
+#    print "<select name=Release>\n";
+#    for (keys %nRelease) {
+#	print "<option";
+#	print " selected" if $_ eq $in{"Release"};
+#	print ">$_\n";
+#    }
+#    print "</select>\n";
+    print "Release: <input name='Release' size=15 value='$in{Release}'>\n";
     print "<br>\n";
 
     print "<p>\n";
@@ -468,12 +507,6 @@
     }
     print "<br>\n";
 
-    # Keep the widths short. karl, 23mar96.
-    local($width)= 64;
-    local($height)= $HTTP_AGENT=~/X Win/ ? 2 : 4;
-    local($height2)=$height*2;
-    local ($synwidth) = $width - 10;
-
     print "<p>
 Synopsis: <input name=Synopsis size=$synwidth><br>
 Environment: <input name=Environment size=$synwidth><br>
@@ -481,6 +514,12 @@
 Description:<br>
 <textarea name=Description cols=$width rows=$height2></textarea><br>
 
+Fix:<br>
+<textarea name=Fix cols=$width rows=$height2></textarea><br>
+
+How-To-Repeat:<br>
+<textarea name=How-To-Repeat cols=$width rows=$height2></textarea><br>
+
 <p><input type=submit value=\"Send\">
 or <input type=reset value=\"Reset\">
 </form>
@@ -784,6 +823,30 @@
     return;
   }
 
+  # Upgrade status
+  if ($in{how} eq "upgrade status") { # If passed in from 'upgrade status' in main_menu, redirect.
+    &upgrade_status($pr, 'upgrade');
+    return;
+  }
+
+  # Upgrade status
+  if ($in{how} eq "follow-up information") { # If passed in from 'follow-up information' in main_menu, redirect.
+    &upgrade_status($pr, 'follow-up');
+    return;
+  }
+
+  # Request patch
+  if ($in{how} eq "request patch") { # If passed in from 'request patch' in main_menu, redirect.
+    &request_patch($pr);
+    return;
+  }
+
+  # technical support rating
+  if ($in{how} eq "technical support rating") { # If passed in from 'technical support rating' in main_menu, redirect.
+    &technical_support_rating($pr);
+    return;
+  }
+
   print "<head><title>$how of bug $pr</title></head><body>\n";
 
   if ($how ne "edit" && $how ne "claim fixed") {
@@ -1090,7 +1153,7 @@
     print "<form method=post action=\"http:$SCRIPT_NAME/csv_output\">";
     print "<input type=submit value=\"Output in CSV format\">";
     print "to file:";
-    print "<input name=csvfile value=\"/nfs/nc/tmp/gnats.csv\" size=24>";
+    print "<input name=csvfile value=\"/tmp/gnats.csv\" size=24>";
     print "<input name=bugs type=hidden value=\""
           . &html_escape ("@prs") ."\">";
     print "</form>\n";
@@ -1106,10 +1169,10 @@
 <td><a href=$link{'categories'}>Category</a>
 <td><a href=$link{'releases'}>Release</a>
 <td><a href=$link{'states'}>S</a>
-<td><a href=$link{'responsibles'}>Resp</a>
-<td><a href=$link{'responsibles'}>Orig</a>
+<td><a href=$link{'fields'}>Resp</a>
+<td><a href=$link{'fields'}>Orig</a>
 <td><a href=$link{'fields'}>P</a>
-<td><a href=fields{'states'}>V</a>
+<td><a href=$link{'states'}>V</a>
 <td><a href=$link{'fields'}>Synopsis</a>\n";
   foreach (@prs) {
     # This same list appears as strings in @sql_fieldnames, sigh.
@@ -1186,8 +1249,30 @@
   local ($data) = $in{"bugs"}; 
   $data =~ tr/,//d; # remove all existing commas
   $data =~ s/\|/,/g; # replace | with ,  
+
+  my @fields = ("bug-number","category","synopsis","confidental","severity","priority","responsible","state","class","submitter","arrival-date","originator","release");
+  my ($new_data, $new_line, $line) = '';
+  foreach $line (split("\n",$data)) {
+    $new_line = '';
+    @field_values = split(",", $line);
+    for ( $i=0; $i<scalar(@fields); $i++ ) {
+      next if ( $fields[$i] eq "submitter");
+      $new_line .= $field_values[$i] . ",";
+    }
+    chop $new_line;
+    $new_data .= $new_line . "\n";
+  }
+  $data = $new_data;
+    
   # Add field names:
-  $data = "bug-number,category,synopsis,confidental,severity,priority,responsible,state,class,submitter,arrival-date,originator,release\n" . $data;
+# $data = "bug-number,category,synopsis,confidental,severity,priority,responsible,state,class,submitter,arrival-date,originator,release\n" . $data;
+  my ($fields, $field) = '';
+  foreach $field (@fields) {
+    next if ( $field eq "submitter");
+    $fields .= $field . ",";
+  }
+  chop $fields;
+  $data = $fields . "\n" . $data;
 
   print "Writing to <tt>$CSV</tt>.\n";
   print "<pre>";
@@ -1704,21 +1789,30 @@
 	print "You must specify the number of the problem report to view.\n";
 	return;
     }
+#    $err = &query_pr (" " . $pr);
     $err = &read_pr($pr, "");
     if ($err ne "") {
 	print "$err\n";
     } else {
 	print "
 <form action=\"http:$SCRIPT_NAME/edit_pr\">
-<input type=submit name=how value=\"edit\">
-<input type=submit name=how value=\"claim fixed\">
 <input type=hidden name=pr  value=\"$pr\">
+<input type=submit name=how value=\"upgrade status\">
+<input type=submit name=how value=\"follow-up information\">
+<input type=submit name=how value=\"request patch\"><br>
 <b>Full text of PR number $pr:</b>
 </form>
 ";
 	print "<pre>\n";
 	$prtext = &html_escape (join ("", @oldpr));
-	print $prtext;
+#	print $prtext;
+        my $field;
+        foreach $field (@order_fieldnames) {
+          next if ( $field eq "Submitter-Id" or
+                    $field eq "Unformatted" or
+                    $field eq "envelope" );
+          print "<b>$field</b>: $fieldvalues{$field}\n";
+        }
 	print "</pre>\n";
     }
 }
@@ -1763,7 +1857,7 @@
   @lines = <BUGS>;
   close (BUGS); # || warn "close($cmd) failed: $!";
   # Do not bother to complain if the close fails; we get stuff like this:
-  # close(/homes/gnats/bin/bugs nav) failed: No child processes at /var/httpd/htdocs/cgi/pr.pl line 1685.
+  # close(/homes/gnats/bin/bugs nav) failed: No child processes at /var/httpd/htdocs$cgi_subdir/pr.pl line 1685.
   # often, and it doesn't mean anything.
 
   print "Bugs sorted by: category, priority, severity, bug number.<br>\n";
@@ -1829,19 +1923,29 @@
       print "$link{'fields'}>$_</a>: ";
     }
 
-    # Refer to arrays @nCategory, @nState, @nResponsible as appropriate.
-    # Note use of eval.
-    print "<select $mode name=$_>\n";
-    foreach $option (eval "\@n$_") {
-      $option = "any" unless $option;
-      print "<option";
-      # This is a kludge, but the right thing (allow a list for
-      # the default values) would cause more trouble.
-      print " selected" if $option eq $quickrestr{$_}
-                           || $option eq "analyzed" && $_ eq "State";
-      print ">$option\n";
+    {
+      if ( $_ eq "Responsible" ) {
+        print "<input name=$_ size=15>\n";
+        last;
+      }
+      if ( $_ eq "Originator" ) {
+        print "<input name=$_ size=15>\n";
+        last;
+      }
+      # Refer to arrays @nCategory, @nState, @nResponsible as appropriate.
+      # Note use of eval.
+      print "<select $mode name=$_>\n";
+      foreach $option (eval "\@n$_") {
+        $option = "any" unless $option;
+        print "<option";
+        # This is a kludge, but the right thing (allow a list for
+        # the default values) would cause more trouble.
+        print " selected" if $option eq $quickrestr{$_}
+        || $option eq "analyzed" && $_ eq "State";
+        print ">$option\n";
+      }
+      print "</select>";
     }
-    print "</select>";
   }
 
   print "<li>Bugs
@@ -1858,7 +1962,7 @@
 
   # Loop over freeform search restrictions (Text, Multitext).
   print "...and/or specifying a 
-<a href=\"/cgi/info2www?(gnats.info)Regexps\">freeform text search</a>
+<a href=\"$cgi_subdir/info2www?(gnats.info)Regexps\">freeform text search</a>
 on
 <a href=$link{'fields'}>any GNATS field</a>.\n";
   print "<ul>";
@@ -1893,9 +1997,13 @@
 to
 <input type=submit name=how value=\"view\">
 or
-<input type=submit name=how value=\"claim fixed\">
+<input type=submit name=how value=\"upgrade status\">
+or
+<input type=submit name=how value=\"follow-up information\">
 or
-<input type=submit name=how value=\"edit\">
+<input type=submit name=how value=\"request patch\">
+or
+<input type=submit name=how value=\"technical support rating\">
 .
 </form>
 
@@ -1906,20 +2014,20 @@
     print "<li><a href=http:$SCRIPT_NAME/full_search>Search bugdb</a>
 via query on any field(s).\n";
 
-    # Stoppers.
-    print "<li><a href=/cgi/stoppers>Generate stopper list</a>.";
+#    # Stoppers.
+#    print "<li><a href=$cgi_subdir/stoppers>Generate stopper list</a>.";
 
-    # Summaries.
-    local ($summarize) = "href=http:$SCRIPT_NAME/summarize";
-    print "<li>Generate bug summary by
-<a $summarize?how=supercategory+and+priority>supercategory/priority</a>,
-<a $summarize?how=responsible-priority>responsible/priority</a>,
-<a $summarize?how=submitter-priority>submitter/priority</a>,
-<a $summarize?how=person+and+age>person/age</a>,
-<a $summarize?how=person+and+state>person/state</a>,
-<a $summarize?how=category+and+state>category/state</a>.";
-# Better on search page, so leave this out for now.
-# <a $summarize?how=date+and+state>date/state</a>,
+#    # Summaries.
+#    local ($summarize) = "href=http:$SCRIPT_NAME/summarize";
+#    print "<li>Generate bug summary by
+#<a $summarize?how=supercategory+and+priority>supercategory/priority</a>,
+#<a $summarize?how=responsible-priority>responsible/priority</a>,
+#<a $summarize?how=submitter-priority>submitter/priority</a>,
+#<a $summarize?how=person+and+age>person/age</a>,
+#<a $summarize?how=person+and+state>person/state</a>,
+#<a $summarize?how=category+and+state>category/state</a>.";
+## Better on search page, so leave this out for now.
+## <a $summarize?how=date+and+state>date/state</a>,
 
     # Help.
     print "<li>$help_string\n";
@@ -1927,18 +2035,20 @@
     # Bug lists by person.
     print "<p><li><form action=\"http:$SCRIPT_NAME/priority_sort\">";
     print "<input type=submit value=\"Generate Bug List\">\n";
-    print " for/by ";
+#    print " for/by ";
     #
     foreach ("Person") {
-      print "<select name=$_>\n";
-      foreach $option (@nOriginator) {
-	$option = "any" unless $option;
-	print "<option",
-              ($option eq $quickrestr{$_}) ? " selected" : "",
-              ">$option\n";
-      }
-      print "</select>";
-      print "or matching <input name=string size=12>";
+      print "<input type=hidden name=$_ value=any>\n";
+#      print "<select name=$_>\n";
+#      foreach $option (@nOriginator) {
+#	$option = "any" unless $option;
+#	print "<option",
+#              ($option eq $quickrestr{$_}) ? " selected" : "",
+#              ">$option\n";
+#      }
+#      print "</select>";
+#      print "or matching <input name=string size=12>";
+      print "with text matching <input name=string size=12>";
     }
     print "</form>\n";
 
@@ -1954,6 +2064,679 @@
 ";
 }
 
+
+
+sub upgrade_status {
+
+  my ($pr, $kind) = @_;
+
+  $pr =~ s/\'/\\\'/g;
+
+  if ($pr eq "") {
+    print "<H3>Sorry</H3>\n";
+    print "You must specify the number of the problem report.\n";
+    return;
+  }
+
+  my ($cmd) = "query-pr '$pr'";
+
+  my $resp = `$cmd 2>&1`;
+
+  if ( $? >> 8 ) {
+    $resp =~ s/^query-pr://;
+    print "<head><title>Error</title></head>
+<body>
+ <center>
+  Error reading problem report #$pr: $resp
+  <p>
+  <form action=\"http:$SCRIPT_NAME\">
+   <input type=submit value=\"Back\">
+  </form>
+ </center>
+</body>
+";
+    return;
+  }
+
+  my ($category, $synopsis, $state, $submitter_id );
+  my (@lines, $line, $name, $value) = split("\n", $resp );
+  foreach $line (@lines) {
+    $line =~ /^>(.*):\s*(.*)/;
+    $name = $1;
+    $value = $2;
+    $category = $value, next
+      if ( $name eq 'Category' );
+    $synopsis = $value, next
+      if ( $name eq 'Synopsis' );
+    $state = $value, next
+      if ( $name eq 'State' );
+#    $submitter_id = $value, next
+#      if ( $name eq 'Submitter-Id' );
+  }
+
+  {
+    my (@def_err) = ();
+    push @def_err, "Category"
+      unless ( defined($category) );
+    push @def_err, "Synopsis"
+      unless ( defined($synopsis) );
+    push @def_err, "State"
+      unless ( defined($state) );
+#    push @def_err, "Submitter-Id"
+#      unless ( defined($submitter_id) );
+
+    last unless ( scalar(@def_err) );
+
+    my ($err) = join( ", ", @def_err );
+    print "<head><title>Error</title></head>
+<body>
+<center><H1>$err not defined</H1></center>
+<form action=\"http:$SCRIPT_NAME\">
+<input type=submit value=\"Back\">
+</form>
+</body>
+";
+
+    return;
+  }
+  
+  my $title;
+  if ( $kind eq 'upgrade' ) {
+    $title = "Upgrade Status";
+  } else {
+    $title = "Follow-up information";
+  }
+
+  print "
+<head>
+ <title>$title</title>
+</head>
+<body>
+ <center>
+  <H1>$title</H1>
+  <form action=\"http:$SCRIPT_NAME/handle_upgrade_status\">
+   <input type=hidden name=kind value=\"$kind\">
+   <input type=hidden name=pr value=\"$pr\">
+   <input type=hidden name=category value=\"$category\">
+   <table>
+    <tr>
+     <td>
+      PR Number:
+     </td>
+     <td>
+      $pr
+     </td>
+    </tr>
+    <tr>
+     <td>
+      Category:
+     </td>
+     <td>
+      $category
+     </td>
+    </tr>
+    <tr>
+     <td>
+      Synopsis:
+     </td>
+     <td>
+      $synopsis
+     </td>
+    </tr>
+    <tr>
+     <td>
+      State:
+     </td>
+     <td>
+      $state
+     </td>
+    </tr>
+    <tr>
+     <td>
+      E-mail address:
+     </td>
+     <td>
+      <input type=text name=submitter_id value=\"\">
+     </td>
+    </tr>
+";
+  if ( $kind eq 'upgrade' ) {
+    print 
+"    <tr>
+     <td>
+      Billing Information:
+     </td>
+     <td>
+      <input type=text name=billing_info value=\"\">
+     </td>
+    </tr>
+";
+  } else {
+    print 
+"    <tr>
+     <td>
+      Environment:
+     </td>
+     <td>
+      <textarea name=environment cols=60 rows=2></textarea>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      Description:
+     </td>
+     <td>
+      <textarea name=description cols=60 rows=2></textarea>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      How-To-Repeat:
+     </td>
+     <td>
+      <textarea name=how_to_repeat cols=60 rows=2></textarea>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      Fix:
+     </td>
+     <td>
+      <textarea name=fix cols=60 rows=2></textarea>
+     </td>
+    </tr>
+";
+  }
+
+  print
+"   </table>
+<input type=submit name=how value=\"Submit\">
+<input type=submit name=how value=\"Back\">
+</form>
+</body>
+";
+
+  return;
+
+}
+
+sub handle_upgrade_status {
+
+  local (*in);
+  &cgi_extract ($QUERY_STRING, *in);
+  my ($kind) = $in{"kind"};
+  my ($pr) = $in{"pr"};
+  my ($how) = $in{"how"};
+  my ($submitter_id) = $in{"submitter_id"};
+  my ($category) = $in{"category"};
+  my ($billing_info) = $in{"billing_info"};
+  my ($environment) = $in{"environment"};
+  my ($description) = $in{"description"};
+  my ($how_to_repeat) = $in{"how_to_repeat"};
+  my ($fix) = $in{"fix"};
+
+  if ($in{how} eq "Back") {
+    &main_menu();
+    return;
+  }
+
+  open(MAIL, "|$MAILER") || die "Error while invoking sendmail";
+  print MAIL
+"To: $GNATS_ADDR
+Subject: Upgrade status request
+From: $submitter_id
+Reply-To: $submitter_id
+X-send-pr-version: $GNATS_VER
+
+>Submitter-Id: $submitter_id
+>Category: $category
+";
+  if ( $kind eq 'upgrade' ) {
+    print MAIL
+">Billing-Info: $billing_info PR $pr
+";
+  } else {
+    print MAIL
+">Billing-Info: PR $pr
+>Environment: $environment
+>Description: $description
+>How-To-Repeat: $how_to_repeat
+>Fix: $fix
+";
+  }
+    close(MAIL);
+
+  if ( $kind eq 'upgrade' ) {
+    print "Your status upgrade request for the problem report #<a href=\"$SCRIPT_NAME/full/$pr\">$pr</a> was sent to the GNATS server.
+It will take about three minutes to process your request.
+";
+  } else {
+    print "Your follow-up information for the problem report #<a href=\"$SCRIPT_NAME/full/$pr\">$pr</a> was sent to the GNATS server.
+It will take about three minutes to process your request.
+";
+  }
+
+}
+
+sub request_patch {
+
+  my ($pr) = @_;
+
+  $pr =~ s/\'/\\\'/g;
+
+  if ($pr eq "") {
+    print "<H3>Sorry</H3>\n";
+    print "You must specify the number of the problem report.\n";
+    return;
+  }
+
+  my ($cmd) = "query-pr '$pr'";
+
+  my $resp = `$cmd 2>&1`;
+
+  if ( $? >> 8 ) {
+    $resp =~ s/^query-pr://;
+    print "<head><title>Error</title></head>
+<body>
+ <center>
+  Error reading problem report #$pr: $resp
+  <p>
+  <form action=\"http:$SCRIPT_NAME\">
+   <input type=submit value=\"Back\">
+  </form>
+ </center>
+</body>
+";
+    return;
+  }
+
+  my ($category, $synopsis, $state, $submitter_id, $release);
+  my (@lines, $line, $name, $value) = split("\n", $resp );
+  foreach $line (@lines) {
+    $line =~ /^>(.*):\s*(.*)/;
+    $name = $1;
+    $value = $2;
+    $category = $value, next
+      if ( $name eq 'Category' );
+    $synopsis = $value, next
+      if ( $name eq 'Synopsis' );
+    $state = $value, next
+      if ( $name eq 'State' );
+    $release = $value, next
+      if ( $name eq 'Release' );
+#    $submitter_id = $value, next
+#      if ( $name eq 'Submitter-Id' );
+  }
+
+  {
+    my (@def_err) = ();
+    push @def_err, "Category"
+      unless ( defined($category) );
+    push @def_err, "Synopsis"
+      unless ( defined($synopsis) );
+    push @def_err, "State"
+      unless ( defined($state) );
+    push @def_err, "Release"
+      unless ( defined($release) );
+#    push @def_err, "Submitter-Id"
+#      unless ( defined($submitter_id) );
+
+    last unless ( scalar(@def_err) );
+
+    my ($err) = join( ", ", @def_err );
+    print "<head><title>Error</title></head>
+<body>
+<center><H1>$err not defined</H1></center>
+<form action=\"http:$SCRIPT_NAME\">
+<input type=submit value=\"Back\">
+</form>
+</body>
+";
+
+    return;
+  }
+  
+  # Patch not ready responce if State ne Feedback or Closed
+  if ( $state ne "feedback" and $state ne "closed" ) {
+    print "<head><title>Sorry</title></head>
+<body>
+ <center>
+  Sorry, the patch for the problem report #$pr is not ready
+  <p>
+  <form action=\"http:$SCRIPT_NAME\">
+   <input type=submit value=\"Back\">
+  </form>
+ </center>
+</body>
+";
+    return;
+  }
+
+  my $title = "Request Patch";
+
+  print "
+<head>
+ <title>$title</title>
+</head>
+<body>
+ <center>
+  <H1>$title</H1>
+  <form action=\"http:$SCRIPT_NAME/handle_request_patch\">
+   <input type=hidden name=pr value=\"$pr\">
+   <input type=hidden name=category value=\"$category\">
+   <table>
+    <tr>
+     <td>
+      PR Number:
+     </td>
+     <td>
+      $pr
+     </td>
+    </tr>
+    <tr>
+     <td>
+      Category:
+     </td>
+     <td>
+      $category
+     </td>
+    </tr>
+    <tr>
+     <td>
+      Synopsis:
+     </td>
+     <td>
+      $synopsis
+     </td>
+    </tr>
+    <tr>
+     <td>
+      State:
+     </td>
+     <td>
+      $state
+     </td>
+    </tr>
+    <tr>
+     <td>
+      Release:
+     </td>
+     <td>
+      <input type=text name=release value=\"$release\">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      E-mail address:
+     </td>
+     <td>
+      <input type=text name=submitter_id value=\"\">
+     </td>
+    </tr>
+   </table>
+<input type=submit name=how value=\"Submit\">
+<input type=submit name=how value=\"Back\">
+</form>
+</body>
+";
+
+  return;
+
+}
+
+sub handle_request_patch {
+
+  local (*in);
+  &cgi_extract ($QUERY_STRING, *in);
+  my ($pr) = $in{"pr"};
+  my ($how) = $in{"how"};
+  my ($submitter_id) = $in{"submitter_id"};
+  my ($category) = $in{"category"};
+  my ($release) = $in{"release"};
+
+  if ($in{how} eq "Back") {
+    &main_menu();
+    return;
+  }
+
+  open(MAIL, "|$MAILER") || die "Error while invoking sendmail";
+  print MAIL
+"To: $GNATS_ADDR
+Subject: Request For Patch
+From: $submitter_id
+Reply-To: $submitter_id
+X-send-pr-version: $GNATS_VER
+
+>Number: $pr
+>Submitter-Id: $submitter_id
+>Category: $category
+>Release: $release
+";
+    close(MAIL);
+
+    print "Your request has been sent to the GNATS server. The patch will be sent to you through e-mail in several minutes.
+";
+
+}
+
+sub technical_support_rating {
+
+  my ($pr) = @_;
+
+  $pr =~ s/\'/\\\'/g;
+
+  if ($pr eq "") {
+    print "<H3>Sorry</H3>\n";
+    print "You must specify the number of the problem report.\n";
+    return;
+  }
+
+  my ($cmd) = "query-pr '$pr'";
+
+  my $resp = `$cmd 2>&1`;
+
+  if ( $? >> 8 ) {
+    $resp =~ s/^query-pr://;
+    print "<head><title>Error</title></head>
+<body>
+ <center>
+  Error reading problem report #$pr: $resp
+  <p>
+  <form action=\"http:$SCRIPT_NAME\">
+   <input type=submit value=\"Back\">
+  </form>
+ </center>
+</body>
+";
+    return;
+  }
+
+  my ($category, $state);
+  my (@lines, $line, $name, $value) = split("\n", $resp );
+  foreach $line (@lines) {
+    $line =~ /^>(.*):\s*(.*)/;
+    $name = $1;
+    $value = $2;
+    $category = $value, next
+      if ( $name eq 'Category' );
+    $state = $value, next
+      if ( $name eq 'State' );
+  }
+
+  {
+    my (@def_err) = ();
+    push @def_err, "Category"
+      unless ( defined($category) );
+    push @def_err, "State"
+      unless ( defined($state) );
+
+    last unless ( scalar(@def_err) );
+
+    my ($err) = join( ", ", @def_err );
+    print "<head><title>Error</title></head>
+<body>
+<center><H1>$err not defined</H1></center>
+<form action=\"http:$SCRIPT_NAME\">
+<input type=submit value=\"Back\">
+</form>
+</body>
+";
+
+    return;
+  }
+
+  # if State ne Closed
+  if ( $state ne "closed" ) {
+    print "<head><title>Sorry</title></head>
+<body>
+ <center>
+  Sorry, you are unable to supply rating report until the problem report will be closed.
+  <p>
+  <form action=\"http:$SCRIPT_NAME\">
+   <input type=submit value=\"Back\">
+  </form>
+ </center>
+</body>
+";
+    return;
+  }
+
+
+  my $title = "Technical Support Rating";
+
+  print "
+<head>
+ <title>$title</title>
+</head>
+<body>
+ <center>
+  <H1>$title</H1>
+  <form action=\"http:$SCRIPT_NAME/handle_technical_support_rating\">
+   <input type=hidden name=pr value=\"$pr\">
+   <input type=hidden name=category value=\"$category\">
+   <table>
+    <tr>
+     <td>
+      PR Number:
+     </td>
+     <td>
+      $pr
+     </td>
+    </tr>
+    <tr>
+     <td>
+      Category:
+     </td>
+     <td>
+      $category
+     </td>
+    </tr>
+    <tr>
+     <td>
+      E-mail address:
+     </td>
+     <td>
+      <input type=text name=submitter_id value=\"\">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      How well was your problem solved:
+     </td>
+     <td>
+      <select name=quality>
+       <option>Excellent
+       <option>Good
+       <option>So-so
+       <option>Bad
+       <option>Awfully
+      </select>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      How quickly did you receive your initial response:
+     </td>
+     <td>
+      <select name=speed>
+       <option>Instantaneous
+       <option>Quick
+       <option>Rather-quick
+       <option>Slow
+       <option>Very-slow
+      </select>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      How courteous was the response:
+     </td>
+     <td>
+      <select name=courtesy>
+       <option>Courteous
+       <option>Normal
+       <option>Not-courteous
+      </select>
+     </td>
+    </tr>
+    <tr>
+     <td colspan=2>
+      Commentary:<br>
+      <textarea name=unformatted cols=64 rows=8></textarea>
+     </td>
+    </tr>
+   </table>
+<input type=submit name=how value=\"Submit\">
+<input type=submit name=how value=\"Back\">
+</form>
+</body>
+";
+
+  return;
+
+}
+
+sub handle_technical_support_rating {
+
+  local (*in);
+  &cgi_extract ($QUERY_STRING, *in);
+  my ($pr) = $in{"pr"};
+  my ($category) = $in{"category"};
+  my ($how) = $in{"how"};
+  my ($submitter_id) = $in{"submitter_id"};
+  my ($quality) = $in{"quality"};
+  my ($speed) = $in{"speed"};
+  my ($courtesy) = $in{"courtesy"};
+  my ($unformatted) = $in{"unformatted"};
+
+  if ($in{how} eq "Back") {
+    &main_menu();
+    return;
+  }
+
+  open(MAIL, "|$MAILER") || die "Error while invoking sendmail";
+  print MAIL
+"To: $GNATS_ADDR
+Subject: Technical Support Rating
+From: $submitter_id
+Reply-To: $submitter_id
+X-send-pr-version: $GNATS_VER
+
+>Number: $pr
+>Category: $category
+>Submitter-Id: $submitter_id
+>Response-Quality: $quality
+>Response-Speed: $speed
+>Response-Courtesy: $courtesy
+>Rating-Comments: $unformatted
+";
+    close(MAIL);
+
+  &main_menu();
+
+}
+
+
 ### Modification log:
 # $Log: pr.pl,v $
 # Revision 1.47  1996/09/03 14:32:58  karl
