Texis Web Script source code for: /texis/site/demos/unixman.vs
Note: Click on links to view the documentation for HTML tags which are special to the Vortex compiler.
<script language=vortex>

<uses demonav=demonav><!--simple look and feel module-->
<entryfunc=init>              <!-- init function for every invocation -->

<!-- --------------------------------------------------------------------- -->
<a name=init private>
  <sum "%s" $SERVER_ROOT "/texis"><db = $ret>  <!-- set the database -->
</a>

<!---------------------------------------------------------------------------
Header and footer macros
--------------------------------------------------------------------------->

<a name=hdr>
  <demolook title="Texis Code Examples: Unix Manual Pages">
<if $subtitle neq "">
$subtitle -
</if>
<if $usection eq "">
    <$usection = "">
</if>
</a>

<a name=ftr>
<hr>
<h6 align=right><a href=/>Copyright © 1996 Thunderstone - EPI, Inc.</a></h6>
</demolook>
</a>

<!---------------------------------------------------------------------------
Show the specified manual page from the DB
--------------------------------------------------------------------------->

<a name=manpage PUBLIC>
 <verifytable>
 <sql max=1 "select section,title,name,synopsis,description,seealso, " $extrafields " 
             texttomm(title\name\synopsis\description) uquery
             from " $table " where id= $id">
  <$subtitle=$title>
  <hdr>
  <h3>$manual</h3>
  <h5 align=right><a href="$url/">[New Search]</a><br><send "<">a href="$url/?uquery=<fmt "%U" $uquery>&table=<fmt '%U">' $table>[Find similar documents]<send "</a>"></h5>
  <b>$title($section)</b><if $cmd neq ""> - $cmd</if><p>
  <dl>
  <dt><b>NAME</b><dd>$name<p>
  <dt><b>SYNOPSIS</b><dd><pre>$synopsis</pre><p>
  <dt><b>DESCRIPTION</b><dd><pre>$description</pre><p>
  <if $seealso neq "">
    <strfmt "<a href=./main.html\\?uquery=\\1\\&table=%U>\\1</a>" $table>
    <sandr "\+" "\\\+" $ret> 
    <sandr  "[\alpha_.]{2,}\F(=" $ret $seealso>
    <!--<sandr  "[\alpha\_.]{2,}\F(=" "<a href=./main.html\?uquery=\1>\1</a>" $seealso>-->
  <else>
     <$ret=none>
  </if>
  <dt><b>SEE ALSO</b><dd><pre>
  <send $ret>
  </pre><p>
  </dl>
</sql>
<hr><i>Note: Not all manual pages that are referenced by <tt>SEE ALSO</tt> actually exist.
This program will try to find the best match if this is the case</i> 
<ftr>
</a>


<!---------------------------------------------------------------------------
Search the specified manual page DB by section
--------------------------------------------------------------------------->

<a name=bysection>
<verifytable>
<searchform>
<nobr>
<sql "select id,section,title,name from " $table "
               where section matches $usection
               order by title">
  <a href=$url/manpage.html?id=$id&table=$table><b>$title ($section)</b></a>$name<p>
  </sql>
</nobr>
</a>

<!---------------------------------------------------------------------------
Search the specified manual page DB 
--------------------------------------------------------------------------->

<a name=bysearch>
<verifytable>
<searchform>
<sandr "\." " " $uquery><$uquery=$ret><!-- cleanup "see also" queries -->
<sql null="" max=50 "select id,section,title,name from " $table "
              where  title\name\synopsis\description\seealso likep $uquery
              and section matches $usection">
  <dt><a href=$url/manpage.html?id=$id&table=$table><b>$title ($section)</b></a><dd>$name<p>
  </sql>
</a>

<!---------------------------------------------------------------------------
Describe the app.
--------------------------------------------------------------------------->
<a name=entry PUBLIC>
<table border=0>
<tr><td>
<if $m eq ''>
    <h3>Select A Manual To Search: </h3>
    <a href="$url/?m=irix">Silicon Graphics Irix 4</a><br>
    <a href="$url/?m=linux">Linux (Redhat)</a><br>
    <a href="$url/?m=solaris">Sun Solaris 2.5.1</a><br>
    <a href="$url/?m=alpha">Dec Alpha Unix</a><br>
<else>
    <searchform>
</if>
</td></tr>
<tr><td>
This application shows how <i>smart</i> Texis can be in the areas of
retrieval and dynamic html formatting. If you've ever had to surf Unix
manuals you'll appreciate this code example.<p>
The database contains all of the manual pages that are included within
the <a href=http://www.sun.com/><tt>Solaris 2.5.1 x86</tt></a>,
<a href=http://www.redhat.com/><tt>Linux (Redhat)</tt></a>,
<tt>Dec Alpha Unix</tt>, and
<a href=http://www.sgi.com><tt>Silicon Graphics Irix 4</tt></a> distribution.
Some of the pages have botched formats, and these pages will sometimes
create oddities in the results listings. We didn't have the time to fix
them during importation, but felt they should be included. <p>
</td></tr></table>
</a>

<!---------------------------------------------------------------------------
Spew out the query form
--------------------------------------------------------------------------->

<a name=searchform PUBLIC>
<form method=post action=$url/>
  <switch $m>
    <case solaris>
       <$sectexps= ""  "1%" "2%" "3%" "4%" "5%" "6%" "7%" "9%">
       <$sections= all 
                  "1 Commands"  
                  "2 System Calls" 
                  "3 Subroutines"  
                  "4 File Formats" 
                  "5 Tables and Macros" 
                  "6 Games"  
                  "7 Devices"  
                  "9 Kernel Ref.">
       <$table="mansolx86">
       <$manual="Sun Solaris 2.5.1">
    <case linux>
       <$sectexps= ""  "1%" "2%" "3%" "4%" "5%" "6%" "7%" "8%" "9%" TCL N>
       <$sections= all 
                  "1 Commands"  
                  "2 System Calls" 
                  "3 Subroutines"  
                  "4 Devices" 
                  "5 File Formats" 
                  "6 Games"  
                  "7 Misc."  
                  "8 System Admin"  
                  "9 Kernel Ref." 
                  "TCL"
                  "N New Stuff">
       <$table="manrh60">
       <$manual="Linux (Redhat)">
    <case alpha>
       <$sectexps= ""  "1%" "2%" "3%" "4%" "5%" "7%" "8%" "9%">
       <$sections= all 
                  "1 Commands"  
                  "2 System Calls" 
                  "3 Subroutines"  
                  "4 File Formats" 
                  "5 Tables and Macros" 
                  "7 Devices" 
                  "8 Admin" 
                  "9 Kernel Ref.">
       <$table="manalpha">
       <$manual="Dec Alpha Unix">
    <case irix>
       <$sectexps= ""  1% 2% 3% 4% 5% 6% 7%>
       <$sections= all 1  2  3  4  5  6  7 >
       <$table="manpages">
       <$manual="Silicon Graphics Irix 4">
    <default>
  </switch>
  <table>
    <tr><td colspan=2><h3>$manual<h3></td></tr>
   <tr>
    <td>Search term(s):</td>
    <td><input name=uquery value="$uquery"> </td>
       <td valign=bottom><h5 align=right><a href=$url/>[New Search]</a></h5>
     </td></tr>
   <tr>
    <td>Section:</td>
    <td>
       <select name=usection><options $sectexps $usection $sections></select> 
       <input type=hidden name=table value=$table>
       <input type=hidden name=m value=$m>
       <input type=hidden name=manual value=$manual>
       <input type=submit value="Go"></td>
   </tr>
  </table>
</form>
</a>

<!---------------------------------------------------------------------------
Verify the table name
--------------------------------------------------------------------------->
<a name=verifytable PUBLIC>
  <switch $table>
    <case mansolx86>
        <$manual="Sun Solaris 2.5.1"><$m="solaris"><$extrafields="cmd,"><return>
    <case manrh60>
        <$manual="Linux (Redhat)"><$m="linux"><$extrafields=""><return>
    <case manalpha>
        <$manual="Dec Alpha Unix"><$m="alpha"><$extrafields="cmd,"><return>
    <case manpages>
        <$manual="Silicon Graphics Irix 4"><$m="irix"><$extrafields=""><return>
    <default>
       Invalid table name<exit>
  </switch>
</a>

<!---------------------------------------------------------------------------
Main: The entry point to this application
--------------------------------------------------------------------------->

<a name=main PUBLIC>
<hdr>
<if $uquery eq "">
  <if $usection neq "">
     <bysection>
  <else>
    <entry>
  </if>
<else>
 <bysearch>
</if>
<ftr> 
</a>

</script>

<!---------------------------------------------------------------------------
Thats all folks!
--------------------------------------------------------------------------->

Back to the Code Example List

The Source Viewer is also a Code Example.
Click Here to see its source.
Copyright © 1992-1999 Thunderstone Software
Copyright © 2024 Thunderstone Software LLC. All rights reserved.