File: appendixC.html

package info (click to toggle)
wn 2.0.5-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 2,208 kB
  • ctags: 1,499
  • sloc: ansic: 14,439; sh: 2,430; perl: 1,360; makefile: 291
file content (1035 lines) | stat: -rw-r--r-- 32,535 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
  <head>
    <title>Parsed Document Syntax for the WN Server</title>

    <link rev="made" href="mailto:john@math.nwu.edu">

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
    <meta http-equiv="last-modified" content="Fri, 09 Oct 1998 18:18:09 GMT">
    <meta http-equiv="keywords" content="WN parsing syntax">
  </head>

  <body bgcolor="#FFFFFF">
    <p>
      <a href="http://hopf.math.nwu.edu/"><img
        src="images/powered.jpg"
        border="0"
        width="190"
        height="41"
        align="right"
        alt="WN home page"
      ></a>
    </p>

    <strong>Version 2.0.3</strong>

    <br>

    <!-- pnuts --> <a href="appendixB.html">[Previous]</a> <a href="appendixD.html">[Next]</a> <a href="manual.html">[Up]</a> <a href="manual.html">[Top]</a> <a href="dosearch.html">[Search]</a> <a href="docindex.html">[Index]</a>



    <br clear="right">

    <hr size="4">
    <!-- #start -->

    <h2 align="center">Parsed Document Syntax for the <em>WN</em> Server</h2>
    <hr size="4">

    <p>
      This is a list of all parsing instructions recognized by <em>WN</em>
      while parsing a text document.  They all use one of the two equivalent
      forms:
    </p>

     <blockquote>
      <code>
        &lt;!--&nbsp;#something&nbsp;--&gt;
      </code>
    </blockquote>

    <p>
      or:
    </p>

    <blockquote>
      <code>
        &lt;?WN&nbsp;something&gt;
      </code>
    </blockquote>

    <p>
      There is a maximum allowed size of 2K bytes for the entire
      "<code>&lt;!--&nbsp;#something&nbsp;--&gt;</code>" expression.  Current
      versions of <em>WN</em> no longer require this expression to be on a line
      by itself.
    </p>

    <p>
      The second form is considered more <a
      href="http://www.sil.org/sgml/">SGML/XML</a> friendly by many as
      "<code>&lt;?WN&nbsp;something&nbsp;&gt;</code>" indicates a processing
      instruction specific to <em>WN</em> rather than a comment.  For
      historical reasons this manual describes the other form, but either may
      be used.  With the first form the '<code>#</code>' is required but with
      the other you may use either:
    </p>

     <blockquote>
      <code>
        &lt;?WN&nbsp;#something&gt;
      </code>
    </blockquote>

    <p>
      or:
    </p>

     <blockquote>
      <code>
        &lt;?WN&nbsp;something&gt;
      </code>
    </blockquote>

    <p>
      Also "<code>&lt;?wn&nbsp;#something&gt;</code>" is fine.  The case of the
      <code>WN</code> is not significant.
    </p>


    <h3>C.1 <a name="match">Matching Regular Expressions: <code>#if</code> and
    <code>#elif</code></a></h3>

    <p>
      This section describes the use of conditionally included text of the
      form:
    </p>

    <blockquote>
      <code>
        &lt;!--&nbsp;#if&nbsp;some_condition&nbsp;--&gt;
        <br>
        &nbsp;&nbsp;Some conditional text goes here.
        <br>
        &lt;!--&nbsp;#elif&nbsp;another_condition&nbsp;--&gt;
        <br>
        &nbsp;&nbsp;Some other conditional text goes here.
        <br>
        &lt;!--&nbsp;#else&nbsp;--&gt;
        <br>
        &nbsp;&nbsp;Alternate text.
        <br>
        &lt;!--&nbsp;#endif&nbsp;--&gt;
      </code>
    </blockquote>

    <p>
      Which will insert the first conditional text only if
      <code>some_condition</code> is satisfied.  The
      "<code>&lt;!--&nbsp;#elif&nbsp;another_condition&nbsp;--&gt;</code>" and
      "<code>&lt;!--&nbsp;#else&nbsp;&gt;</code>" are optional.  There may be
      multiple "<code>#elif</code>" lines.
    </p>

    <p>
      In all the examples below the use of the equal-tilde string
      '<code>=~</code>' to indicate a matching regular expression can be
      replaced with the two characters '<code>!~</code>' in which case the if
      clause will be true when the regular expression fails to match.
    </p>

    <p>
      Also in the examples of the form
      "<code>&lt;--&nbsp;#if&nbsp;accept&nbsp;file="foo"&nbsp;--&gt;</code>"
      the file <code>foo</code> is assumed to be relative to the current
      directory unless it begins with a '<code>/</code>' in which case it is
      taken relative to the <em>WN</em> data hierarchy root.  The format of
      these files is a list of <code>grep(1)</code> like regular expressions,
      one per line with any white space being taken as part of the expression.
      Lines beginning with '<code>#</code>' are taken to be comments.  If a
      regular expression is preceded with the character '<code>!</code>' then
      that character is skipped but the truth value of any matches with the
      expression is reversed.
    </p>

    <p>
      The regular expressions recognized by the <em>WN</em> server are the same
      as those of the UNIX <code><a
      href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
      utility (though this utility is not used as the server has its own
      regular expression functions).  The more general regular expressions used
      for example in the UNIX <code><a
      href="http://linux-howto.com/man/man1/egrep.1.html">egrep(1)</a></code>
      utility are not supported by <em>WN</em>.
    </p>

    <p>
      The condition in the "<code>#if</code>" or "<code>#elif</code>" tags can
      be made more complex than those described above by combining simple
      conditions using the logical operations '<code>&amp;&amp;</code>' for
      '<code>and</code>', '<code>||</code>' for '<code>or</code>' and
      '<code>!</code>' for '<code>not</code>'.  Parentheses may be used for
      grouping.  For example:
    </p>

    <blockquote>
      <code>
        &lt;!--&nbsp;#if&nbsp;cond_1&nbsp;&amp;&amp;&nbsp;cond_2&nbsp;--&gt;
        <br>
        &nbsp;&nbsp;Text to show if cond_1 and cond_2 are satisfied.
        <br>
        &lt;!--&nbsp;#endif&nbsp;--&gt;
      </code>
    </blockquote>

    <p>
      Other examples are:
    </p>

    <blockquote>
      <code>
        &lt;!--&nbsp;#if&nbsp;cond_1&nbsp;||&nbsp;cond_2&nbsp;--&gt;
        <br>
        &lt;!--&nbsp;#if&nbsp;!cond_1&nbsp;--&gt;
        <br>
        &lt;!--&nbsp;#if&nbsp;(cond_1&nbsp;||&nbsp;cond_2)&nbsp;&amp;&amp;&nbsp;!cond_3&nbsp;--&gt;
      </code>
    </blockquote>

    <p>
      The '<code>&amp;&amp;</code>' and '<code>||</code>' operations have equal
      precedence and associate from right to left.
    </p>


    <h4>C.1.1 <a name="match.conditions"><code>#if</code> and
    <code>#elif</code> Conditions</a></h4>

    <dl>
      <dt>
        <a name="match.conditions.accept"><code>#if accept</code></a> -- Match
        client's <code>Accept</code> headers
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;accept&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;accept&nbsp;file&nbsp;=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specify that this text segment should be served if (in the first
          case) the UNIX <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches any of
          the <code>Accept</code> headers supplied by the client.  Or for the
          second line if the file "<code>foo</code>" contains a regular
          expression matching any of the <code>Accept</code> headers.
        </p>
      </dd>

      <dt>
        <a name="match.conditions.after"><code>#if&nbsp;after</code> and
        <code>#if&nbsp;before</code></a> -- Select text based on date
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;after&nbsp;"date"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;before&nbsp;"date"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specify that this text segment should be served if the current time
          is after (or before) the specified date.  That is, the line:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;after&nbsp;"22&nbsp;Oct&nbsp;1996&nbsp;17:41:26"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          will cause the text segment to be served only after
          "<code>22&nbsp;Oct&nbsp;1996&nbsp;17:41:26</code>" local time.  The
          date format is rather rigid.  It must be in precisely the format
          shown above (specified by <a
          href="http://linux-howto.com/rfc/rfc1000-1499/rfc1123.txt">RFC
          1123</a>) and with a single space between each field.  Only local
          time of the server is supported.
        </p>
      </dd>

      <dt>
        <a name="match.conditions.cookie"><code>#if&nbsp;cookie</code></a> --
        Match client's <code>Cookie</code> headers
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;cookie&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;cookie&nbsp;file=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specifies that this text segment should be served if the UNIX
          <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression <code>regexp</code> matches any of
          the <code>Cookie</code> headers supplied by the client.
        </p>

        <p>
          More information about the proposed HTTP <code>Set-Cookie</code>
          header is available at <a
          href="http://home.netscape.com/newsref/std/cookie_spec.html">http://home.netscape.com/newsref/std/cookie_spec.html</a>.
        </p>
      </dd>

      <dt>
        <a name="match.conditions.field"><code>#if&nbsp;field</code></a> --
        Match document's user defined field
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;field3&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;field3&nbsp;file=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specify that this text segment should be served if the UNIX <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches the
          contents of the <a href="field.html">user defined field</a> number 3
          (in the first case) or if the file "<code>foo</code>" contains a
          matching regular expression (in the second) case.  Any valid field
          number may be used in place of 3.
        </p>
      </dd>

      <dt>
        <a name="match.conditions.hostname"><code>#if&nbsp;hostname</code></a>
        -- Match client's hostname
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;hostname&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;hostname&nbsp;file=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specify that this text segment should be served if the UNIX <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches the
          hostname of the client (in the first case) or if the file
          "<code>foo</code>" contains a matching regular expression (in the
          second) case.  For an alternate method of doing this see the "<a
          href="#match.control"><code>#if&nbsp;accessfile</code></a>" syntax
          described below.
        </p>

        <p>
          Be aware that the character '<code>.</code>' (dot) has a special
          meaning in regular expressions and must be escaped with a
          '<code>\</code>' to have its usual meaning.
        </p>
      </dd>

      <dt>
        <a
        name="match.conditions.host_header"><code>#if&nbsp;host_header</code></a>
        -- Match server's virtual hostname from client's HTTP Host header
      </dt>
      <dd>
        <p>
          The line:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;host_header&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specify that this text segment should be served if the UNIX <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches the
          contents of the HTTP "<code>Host:</code>" header supplied by the
          client in its request.
        </p>

        <p>
          Be aware that the character '<code>.</code>' (dot) has a special
          meaning in regular expressions and must be escaped with a
          '<code>\</code>' to have its usual meaning.
        </p>
      </dd>

      <dt>
        <a name="match.conditions.ip"><code>#if&nbsp;IP</code></a> -- Match
        client's IP address
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;IP&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;IP&nbsp;file=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specify that this text segment should be served if the UNIX <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches the IP
          address of the client (in the first case) or if the file
          "<code>foo</code>" contains a matching regular expression (in the
          second case).  For an alternate method of doing this see the "<a
          href="#match.control"><code>#if&nbsp;accessfile</code></a>" syntax
          described below.
        </p>

        <p>
          Be aware that the character '<code>.</code>' (dot) has a special
          meaning in regular expressions and must be escaped with a
          '<code>\</code>' to have its usual meaning.
        </p>
      </dd>

      <dt>
        <a name="match.conditions.language"><code>#if&nbsp;language</code></a>
        -- Match client's <code>Accept-Language</code> headers
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;language&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;language&nbsp;file&nbsp;=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specify that this text segment should be served if (in the first
          case) the UNIX <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches any of
          the <code>Accept-Language</code> headers supplied by the client.  Or
          for the second line if the file "<code>foo</code>" contains a regular
          expression matching any of the <code>Accept-Language</code> headers.
        </p>
      </dd>

      <dt>
        <a name="match.conditions.query"><code>#if&nbsp;query</code></a> --
        Match query string supplied in request URL
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;query&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;query&nbsp;file&nbsp;=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specifies that this text segment should be served if the UNIX
          <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches the
          query string supplied by the client in the URL (in the first case) or
          if the file "<code>foo</code>" contains a matching regular expression
          (in the second case).
        </p>
      </dd>

      <dt>
        <a name="match.conditions.request"><code>#if&nbsp;request</code></a> --
        Match client's request
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;request&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;request&nbsp;file&nbsp;=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specify that this text segment should be served if the UNIX <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches the
          contents of the full text of the request supplied by the client (in
          the first case) or if the file "<code>foo</code>" contains a matching
          regular expression (in the second case).  The full request contains
          the "method" (<code>GET</code> or <code>POST</code>) followed by the
          URL requested with the "<code>http://host</code>" part having been
          removed (by the client).
        </p>
      </dd>

      <dt>
        <a name="match.conditions.referer"><code>#if&nbsp;referer</code></a> --
        Match client supplied <code>Referer:</code> header
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;referer&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;referer&nbsp;file&nbsp;=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specify that this text segment should be served if the UNIX <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches the
          contents of the <code>Referer:</code> header supplied by the client
          or if the file "<code>foo</code>" contains a matching regular
          expression (in the second case).  The <code>Referer:</code> header
          contains the URL of the document containing the link accessed to
          obtain the current document.
        </p>
      </dd>

      <dt>
        <a name="match.conditions.ua"><code>#if&nbsp;UA</code></a> -- Match
        client's <code>User-Agent:</code> header
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;UA&nbsp;=~&nbsp;"regexp"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;UA&nbsp;file&nbsp;=&nbsp;"foo"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specifies that this text segment should be served if the UNIX
          <code><a
          href="http://linux-howto.com/man/man1/grep.1.html">grep(1)</a></code>
          utility like regular expression "<code>regexp</code>" matches the
          <code>User-Agent:</code> header supplied by the client (in the first
          case) or if the file "<code>foo</code>" contains a matching regular
          expression (in the second case).
        </p>
      </dd>

      <dt>
        <a name="match.conditions.true"><code>#if&nbsp;true</code> and
        <code>#if&nbsp;false</code></a> -- Include or exclude text segment
      </dt>
      <dd>
        <p>
          The line:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;false&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specifies that the corresponding text segment should not be served.
          It may be useful for "commenting out" a part of a document which is
          under construction.  The "<code>#if&nbsp;true</code>" construct is
          present for logical completeness.
        </p>
      </dd>
    </dl>


    <h4>C.1.2 <a name="match.control">Access Control Files</a></h4>

    <p>
      The normal <a href="access.html">access control files</a> used by
      <em>WN</em> to limit access to a directory can also be used to
      conditionally permit or deny access to text segments.
    </p>

    <dl>
      <dt>
        <a
        name="match.control.accessfile"><code>#if&nbsp;accessfile="filename"</code></a>
        -- Check access control file
      </dt>
      <dd>
        <p>
          The line:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;accessfile="/dir/accessfile"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specifies that the file <code>/dir/accessfile</code> is to be used to
          determine access privileges (by hostname or IP address) for this text
          segment.  The path <code>/dir/accessfile</code> is relative to the
          server root directory.  If this path does not begin with a
          '<code>/</code>' then the path is relative to the directory
          containing the file with this text.  See the chapter "<a
          href="access.html">Limiting Access to Your <em>WN</em> Hierarchy</a>"
          in this guide.
        </p>
      </dd>
    </dl>


    <h3>C.2 <a name="insert">Inserting the Contents of a File</a></h3>

    <dl>
      <dt>
        <a name="insert.include"><code>#include</code></a> -- Insert the
        contents of a file
      </dt>
      <dd>
        <p>
          The line:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#include&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specifies that the contents of next file listed in the <a
          href="parse.html">includes or wrappers</a> should be inserted at this
          point.  It is permissible to add the name of this file, as in:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#include&nbsp;&nbsp;foo.txt&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          but this acts only as a comment.  The actual file inserted depends
          only on the "<code><a
          href="appendixD.html#includes">Includes=</a></code>" and "<code><a
          href="appendixD.html#wrappers">Wrappers=</a></code>" directives in
          the <a href="index_desc.html#index"><code>index</code></a> file (or
          more precisely the <code>index.cache</code> file created from it).
        </p>
      </dd>

      <dt>
        <a name="insert.section"><code>#section</code></a> -- Insert part of
        the contents of a file
      </dt>
      <dd>
        <p>
          The line:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#section&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specifies that part of the contents of next file listed in the <a
          href="parse.html">includes or wrappers</a> should be inserted at this
          point.  It is permissible to add the name of this file, as in:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#section&nbsp;&nbsp;foo.txt&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          but this acts only as a comment.  The actual file inserted depends
          only on the "<code><a
          href="appendixD.html#includes">Includes=</a></code>" and "<code><a
          href="appendixD.html#wrappers">Wrappers=</a></code>" directives in
          the <a href="index_desc.html#index"><code>index</code></a> file (or
          more precisely the <code>index.cache</code> file created from it).
        </p>

        <p>
          The part of the file actually included is that portion of the
          document between the special comments
          "<code>&lt;!--&nbsp;#start&nbsp;--&gt;</code>" and
          "<code>&lt;!--&nbsp;#end&nbsp;--&gt;</code>" inserted in that
          document.  This requires that these starting and ending comments
          occur in the HTML document on lines by themselves. For more
          information see the section "<a href="parse.html#section">More on
          Including: the <code>section</code> Marker</a>" in this guide.
        </p>
      </dd>

      <dt>
        <a name="insert.start"><code>#start</code> and <code>#end</code></a> --
        Mark the beginning and end of text to be included
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#start&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          and:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#end&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          mark the beginning and end of the portion of the text to be inserted
          from an include or wrapper in response to encountering
          "<code>&lt;!--&nbsp;#section&nbsp;--&gt;</code>" in the text of a
          document being parsed.  There can be more than one
          "<code>#start</code>/<code>#end</code>" pair in a document.  For more
          information see the section "<a href="parse.html#section">More on
          Including: the <code>section</code> Marker</a>" in this guide.
        </p>
      </dd>

      <dt>
        <a name="insert.title"><code>#title</code>, <code>#query</code>, and
        <code>#field</code></a> -- Insert the title, current search string, or
        a user defined field
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#title&nbsp;--&gt;
            <br>
            &lt;!--&nbsp;#query&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          or:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#field&nbsp;3&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          in a parsed document instruct the server to include the title of the
          current document, the current search term from the client or the
          value of user defined "<code>field&nbsp;#3</code>" for the current
          document.  All of these markers must occur on a line by themselves.
          For more information see the section "<a
          href="parse.html#section">Including Title, Query, Fields and
          Environment Variables</a>" in this guide.
        </p>
      </dd>

      <dt>
        <a name="insert.environ"><code>#environ</code></a> -- Insert the
        contents of an environment variable
      </dt>
      <dd>
        <p>
          The lines:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#environ&nbsp;=&nbsp;"WHATEVER"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          in a parsed document instructs the server to include the contents of
          the environment variable <code>WHATEVER</code>.  Remember to use an
          "<code><a
          href="appendixB.html#attributes.parse">Attributes=parse</a></code>"
          line when using this construct and to use an "<code><a
          href="appendixB.html#attributes.parse">Attributes=cgi</a></code>"
          when it is a <a href="appendixD.html">CGI variable</a> like <a
          href="appendixD.html#http_referer"><code>HTTP_REFERER</code></a>
          which is to be included.
        </p>
      </dd>
    </dl>


    <h3><a name="redirect">Conditional Redirecting</a></h3>

    <dl>
      <dt>
        <a name="redirect.redirect"><code>#redirect</code></a> -- Redirect to a
        different URL
      </dt>
      <dd>
        <p>
          The line:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#redirect&nbsp;=&nbsp;"url"&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          specifies that if no text has yet been sent the server should send an
          HTTP redirect to the given URL.  This might be used as follows.  If
          the text:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;hostname&nbsp;=~&nbsp;"\.uk$"&nbsp;--&gt;
            <br>
            &lt;!--&nbsp;#redirect&nbsp;=&nbsp;"UK_mirror_url"&nbsp;--&gt;
            <br>
            &lt;!--&nbsp;#endif&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          is included at the beginning of an HTML document then any request
          from a <code>uk</code> host will automatically be redirected to the
          specified URL, the <code>UK_mirror_url</code> in this case.  This
          mechanism could also be used to redirect text only browsers to a text
          only alternative page, etc.
        </p>

        <p>
          There must be no text sent before the
          '<code>&lt;!--&nbsp;#redirect&nbsp;=&nbsp;"url"&nbsp;--&gt;</code>'
          is encountered (not even blank lines) since the server cannot send an
          HTTP redirect while in the middle of transmitting a document.  Thus
          the example above would be an error if there are any blank lines
          before the "<code>#if&nbsp;hostname</code>" line or any blank lines
          after it before the "<code>#redirect</code>" line.  When such an
          error occurs it is logged in the <a href="setup.html#logging">error
          file</a> and the "<code>#redirect</code>" line is ignored.
        </p>

        <p>
          Note however that:
        </p>

        <blockquote>
          <code>
            &lt;!--&nbsp;#if&nbsp;hostname&nbsp;=~&nbsp;"\.uk$"&nbsp;--&gt;
            <br>
            &nbsp;&nbsp;[Lots of text here]
            <br>
            &lt;!--&nbsp;#else&nbsp;--&gt;
            <br>
            &lt;!--&nbsp;&nbsp;&nbsp;#redirect&nbsp;=&nbsp;"some_URL"&nbsp;--&gt;
            <br>
            &lt;!--&nbsp;#endif&nbsp;--&gt;
          </code>
        </blockquote>

        <p>
          is correct since when the <code>#redirect</code> line is encountered
          no text has been sent.
        </p>

        <p>
          Normally the URL in the
          "<code>&lt;!--&nbsp;#redirect&nbsp;=&nbsp;"URL"&nbsp;--&gt;</code>"
          line is fully qualified, like "<code>http://host/path/foo</code>".
          However, it can also be simply "<code>foo</code>" referring to a file
          in the same directory as the file being parsed.  In this case an HTTP
          redirection is not sent, and instead the file "<code>foo</code>" is
          returned immediately to the client.
        </p>
      </dd>
    </dl>



    <!-- #end -->
    <hr size="4">

    <address>
      <em>WN</em> version 2.0.3
      <br>
      Copyright &copy; 1998 <a href="mailto:john@math.nwu.edu">John Franks
      &lt;john@math.nwu.edu&gt;</a>
      <br>
      licensed under the <a href="http://www.opencontent.org/opl.html">
      OpenContent Public License</a>
      <br>
      last-modified: Fri, 09 Oct 1998 18:18:09 GMT
    </address>

    <!-- pnuts --> <a href="appendixB.html">[Previous]</a> <a href="appendixD.html">[Next]</a> <a href="manual.html">[Up]</a> <a href="manual.html">[Top]</a> <a href="dosearch.html">[Search]</a> <a href="docindex.html">[Index]</a>
  </body>
</html>