home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / include / cgi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.3 KB  |  77 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef __cgi_h_
  20. #define __cgi_h_
  21.  
  22. /*
  23. ** CGI assist library. Portability layer for writing correctly behaving
  24. ** CGI programs.
  25. */
  26. #include "ds.h"
  27.  
  28. XP_BEGIN_PROTOS
  29.  
  30. /*
  31. ** Read in the input, generating a single long string out of it.  CGI
  32. ** programs normally get the value of various forms elements as input.
  33. */
  34. extern char *CGI_GatherInput(FILE *in);
  35.  
  36. /*
  37. ** Given a null terminated string, compress it in place, converting
  38. ** "funny characters" into their ascii equivalent. Maps "+" to space and
  39. ** %xx to the binary version of xx, where xx is a pair of hex digits.
  40. */
  41. extern void CGI_CompressString(char *s);
  42.  
  43. /*
  44. ** Convert a string into an argument vector. This seperates the incoming
  45. ** string into pieces, and calls CGI_CompressString to compress the
  46. ** pieces. This allocates memory for the return value only.
  47. */
  48. extern char **CGI_ConvertStringToArgVec(char *string, int *argcp);
  49.  
  50. /*
  51. ** Look for the variable called "name" in the argv. Return a pointer to
  52. ** the value portion of the variable if found, zero otherwise.  this does
  53. ** not malloc memory.
  54. */
  55. extern char *CGI_GetVariable(char *name, int argc, char **argv);
  56.  
  57. /* Return non-zero if the variable string is not empty */
  58. #define CGI_IsEmpty(var) (!(var) || ((var)[0] == 0))
  59.  
  60. /*
  61. ** Return true if the server that started the cgi running is using
  62. ** security (https).
  63. */
  64. extern DSBool CGI_IsSecureServer(void);
  65.  
  66. /*
  67. ** Concatenate strings to produce a single string.
  68. */
  69. extern char *CGI_Cat(char *, ...);
  70.  
  71. /* Escape a string, cgi style */
  72. char *CGI_Escape(char *in);
  73.  
  74. XP_END_PROTOS
  75.  
  76. #endif /* __cgi_h_ */
  77.