home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
srev13h.zip
/
BYBROWSR.RX0
< prev
next >
Wrap
Text File
|
1998-01-04
|
8KB
|
212 lines
/* ByBrowsr: Using Browser Specific Documents.
Usage: include the following in a requested document (say, FOOBAR.HTM):
<!-- interpret file ByBrowsr.rxx -->
and create a set of files ending with the appropriate extensions
(say, FOOBAR.NETSCAPE2, FOOBAR.WEBEX11, FOOBAR.MSIE3, etc.).
Customization Note: The "user-changable" parameters are:
BROWSER.! -- Primary Rules:
BROWSER_2.! -- Backup rules:
DEFAULT -- Defaul
Documentation: See ByBrowsr.Doc for details.
******************************************/
/************* BEGIN USER CHANGABLE PARAMETERS **************/
/* DEFAULT -- the extension to use if there is no successful match */
DEFAULT='DEF'
/* BROWSERS.! -- Primary Rules: A list of User Agents and associated extensions.
Syntax: BROWSER.!an_ext='u_agent'
alternate syntax: BROWSER.!an_ext.n='u_agent'
where:
an_ext is the extension to use
an_ext.n is an alternate version of an_ext (n is an integer)
u_agent is compared against user-agent request headers
Examples: BROWSER.!NETSCAPE3='Mozilla/3.*'
BROWSER.!NETSCAPE2.1='Mozilla/2.02E*'
Notes:
+ Be sure to include the .! before the an_extension
+ Be sure to surround the u_agent with ' quotes
+ Spaces in the user_agent are ignored, case is ignored, * are wildcards
+ If you are using a FAT system, your an_ext "tails" should have no more
then 3 characters.
+ To have multiple u_agents map to the same an_ext, add a .n after the
the an_ext; with n an integer.
*/
BROWSER.!WEBTV='Mozilla/1.*WebTV/1.*compatible*MSIE2.*'
BROWSER.!ACCENT='MultilingualMosaic/1.*Win32Accent*'
BROWSER.!ALIS='Tango/c1.2c1.0Win32Alis/6*'
BROWSER.!AOL1='Mozilla/2.0*Compatible*AOL-IWENG3.1*'
BROWSER.!AOL25A='IWENG/*'
BROWSER.!AOL25B='aolbrowser/1.*'
BROWSER.!ATT='NCD/1.0f(Windows' I' 16bit)*'
BROWSER.!BOOKLINK='InternetWorks/*'
BROWSER.!EINETMACWEB='MacWeb/1.00*libwww/2*'
BROWSER.!EINETWINWEB='EINetWin*'
BROWSER.!GNN='GNNworks/v1.2.0*'
BROWSER.!WEBEX12='IBMWebExplorerDLL/v1.2*'
BROWSER.!WEBEX11='IBMWebExplorerDLL/v1.1*'
BROWSER.!WEBEX10='IBMWebExplorerDLL/v1.0*'
BROWSER.!LOTUS45='*Lotus-Notes/4.5*'
BROWSER.!LOTUS4='*Lotus-Notes/4.[01]*'
BROWSER.!LYNX='Lynx/*'
BROWSER.!LYNX24='Lynx/2-4-[12]libwww/2.14*'
BROWSER.!MCI='internetMCI/1.0(Windows)*'
BROWSER.!MSIE3='Mozilla/2.0*(compatible*MSIE3.*'
BROWSER.!MSIE2='Mozilla/*compatible*MSIE2.*'
BROWSER.!MSIE1='Mozilla/1.22*compatible*MSIE1.*'
BROWSER.!MSIE4='MicrosoftInternetExplorer/4.*'
BROWSER.!MOSAIC27='NCSA_Mosaic/2.7*'
BROWSER.!MOSAIC26='NCSA_Mosaic/2.6(X11*'
BROWSER.!MOSAIC2='NCSAMosaic/2.*'
BROWSER.!NETCOM3='NetCruiser/V3.*'
BROWSER.!NETCOM2='NetCruiser/V2.*'
BROWSER.!NETCOM1='NetCruiser/V1.*'
BROWSER.!NETMANAGE='NetManageChameleonWebSurfer/*'
BROWSER.!NETSCAPE4='Mozilla/4.*'
BROWSER.!NETSCAPE3='Mozilla/3.*'
BROWSER.!NETSCAPE2='Mozilla/2.*'
BROWSER.!NETSCAPE1='Mozilla/1.*'
BROWSER.!OMNIWEB='OmniWeb/2.0*OWF/1.0*'
BROWSER.!PRODIGY2='PRODIGY-WB/2.*'
BROWSER.!PRODIGY1='PRODIGY-WB/1.*'
BROWSER.!QUARTERDECK='QuarterdeckMosaicVersion*'
BROWSER.!MOSAICSEC='SecureNCSAMosaicfortheXWindowSystem/0.[34]*'
BROWSER.!SPRY='SPRY_Mosaic/v8.*SPRY_package/v4.00*'
BROWSER.!AIR='AIR_Mosaic(16bit)/v1.00.198.07*'
BROWSER.!SPRY4='AIR_Mosaic(16bit)/v4.*'
BROWSER.!SPRY3='AIR_Mosaic(16bit)/v3.*'
BROWSER.!SPYGLASS1='SpyglassMosaic/1.02_Win32*'
BROWSER.!SPYGLASSWIN2='Enhanced_Mosaic/2.1*Win32Spyglass/*'
BROWSER.!SPYGLASSSOL2='Enhanced_Mosaic/2.1*SolarisSpyglass/*'
BROWSER.!SPYGLASSDEC2='Enhanced_Mosaic/2.1*DEC_AlphaSpyglass/*'
BROWSER.!SPYGLASS2='Enhanced_Mosaic/2.*'
BROWSER.!WOLLONGONG='Emissary1.0b*'
BROWSER.!FOO.1='Foo*'
BROWSER.!FOO.2='Bar*'
/* BROWSER_2.! -- Secondary rules. BROWSER_2.! variables are used when there is
no successful BROWSER.! "pimary rule".
Syntax: same as BROWSER.!
Notes:
+ We advice using generic (short, with early use of *) u_agents.
+ You can use u_agents specified in BROWSER.! rules.
*/
BROWSER_2.!NETSCAPE2.0='Mozilla/2.*'
BROWSER_2.!NETSCAPE2.1='Mozilla/3.*'
BROWSER_2.!NETSCAPE2.2='Mozilla/4.*'
BROWSER_2.!NET='Mozilla*'
BROWSER_2.!MSIE3.1='Mozilla/2.*MSIE*3*'
BROWSER_2.!MSIE3.2='Mozilla/2.*MSIE*4*'
BROWSER_2.!MOSAIC='*MOSAIC'
/************* END USER CHANGABLE PARAMETERS **************/
/************* END USER CHANGABLE PARAMETERS **************/
/* 1) Extract user-agent*/
myagent=upper(space(reqfield('user-agent'),0))
/* 1a)Determine a base file name*/
parse arg targfile
if targfile<>'' then USEDFILE=sref_do_virtual(ddir,TARGFILE,enmadd,0,,homedir,host_nickname)
a1=lastpos('.',usedfile)
if a1>0 then
basefile=delstr(usedfile,a1+1)
else
basefile=usedfile||'.'
/* Get list of BROWSER. variables */
foo=cvtails('BROWSER.',btails)
/* compare each browser. entry */
gotit='' ; oldresu=''
do t1=1 to btails.0
avv=upper(btails.t1)
aresu=sref_wild_match(myagent,space(browser.avv,0),oldresu)
if aresu=0 then iterate /* 0 means no, or inferior, match */
parse var avv '!' gotit '.' .
if aresu=-1 then leave /* -1 means exact match */
oldresu=aresu /* gotta beat oldresu */
end
if gotit<>'' then do /* got a match-- see if a file exists */
a2=basefile||gotit /* this is the file to find */
if stream(a2,'c','query exists')<>'' then do /* it does exist */
if verbose>3 then call pmprintf("ByBrowsr using " a2)
end
else do
gotit=''
if verbose>2 then call pmprintf('ByBrowser caution. no such file: 'a2)
end /* do */
end
/* compare each browser_2. entry (perhaps look at more then one)? */
if gotit='' then do
foo=cvtails('BROWSER_2.',btails)
do forever
oldresu=''
do t1=1 to btails.0
avv=upper(btails.t1)
if avv='' then iterate /*was removed */
aresu=sref_wild_match(myagent,space(browser_2.avv,0),oldresu)
if aresu=0 then do
if oldresu='' then btails.t1='' /* save time later? */
iterate
end
parse var avv '!' gotit '.' .
uset1=t1
if aresu=-1 then leave
oldresu=aresu
end /* check all tails */
if gotit='' then leave /*no match, give up */
if gotit<>'' then do /* got a match-- see if a file exists */
a2=basefile||gotit
if stream(a2,'c','query exists')<>'' then do
if verbose>3 then call pmprintf("ByBrowsr using 2ndary file:" a2)
leave
end
else do
gotit=''
btails.uset1='' /* skip this entry on next round */
if verbose>1 then call pmprintf('ByBrowser caution. no such 2ndary file: 'a2)
end /* do */
end /* got a match */
end /* forever */
end /* gotit<>'' */
/* no match, use default (don't bother checking */
if gotit='' then gotit=default
/* now return */
if targfile<>' ' then do /* use "virtual" Mode */
a1=lastpos(targfile,'.')
if a1=0 then
goo=targfile||'.'||gotit
else
goo=delstr(targfile,a1+1)||gotit
return '<!-- #include virtual='||goo||'" -->'
end /* do */
goo=filespec('n',basefile||gotit) /* file mode (invoking file, hence same dir) */
return '<!-- #include file='||goo||'" -->'