home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / gosrv250.zip / gofilter.70 next >
Text File  |  1994-12-30  |  1KB  |  27 lines

  1. /* Sample minimal GoServe filter program */
  2.  
  3. parse arg source, selector, selector2                   /* Get arguments */
  4. parse var source server port transaction who .           /* Often useful */
  5.  
  6. say who':' selector                             /* [show filter running] */
  7.  
  8. dir=datadir()               /* Data root directory (e.g. "d:/gogopher/") */
  9.  
  10. /* This very simple filter just builds the full path name of a file from */
  11. /* the selector and returns that.  Note we do not put the full path in   */
  12. /* menus, as this could allow clients to access all files on the server  */
  13. /* machine, which is rarely desirable.                                   */
  14.  
  15. if left(selector,1)<>'!' then do        /* this is not a control request */
  16.   if selector='' then selector='mainmenu.'port         /* 'startup' case */
  17.   if translate(right(selector,4))='.ZIP'     /* use Binary for ZIP files */
  18.     then data='Binary'
  19.     else data='Text'
  20.   return 'File' data 'name' dir''selector        /* normal selector case */
  21.   end
  22.  
  23. /* Drop through to here if this is a control request */
  24. owners=server 1.23.45.67                 /* list of authorized addresses */
  25. if wordpos(who, owners)=0 then return    /* ignore unauthorized requests */
  26. return 'control' substr(selector,2)    /* remainder of string is request */
  27.