func: cgiEnvironmentResultType cgiWriteEnvironment(char *filename) FILE * out ; cgiFormEntry * e ; out = fopen ( filename , "wb" ); if ( ! out )  if ( ! cgiWriteString ( out , "CGIC2.0" ) )  if ( ! cgiWriteString ( out , cgiServerSoftware ) )  if ( ! cgiWriteString ( out , cgiServerName ) )  if ( ! cgiWriteString ( out , cgiGatewayInterface ) )  if ( ! cgiWriteString ( out , cgiServerProtocol ) )  if ( ! cgiWriteString ( out , cgiServerPort ) )  if ( ! cgiWriteString ( out , cgiRequestMethod ) )  if ( ! cgiWriteString ( out , cgiPathInfo ) )  if ( ! cgiWriteString ( out , cgiPathTranslated ) )  if ( ! cgiWriteString ( out , cgiScriptName ) )  if ( ! cgiWriteString ( out , cgiQueryString ) )  if ( ! cgiWriteString ( out , cgiRemoteHost ) )  if ( ! cgiWriteString ( out , cgiRemoteAddr ) )  if ( ! cgiWriteString ( out , cgiAuthType ) )  if ( ! cgiWriteString ( out , cgiRemoteUser ) )  if ( ! cgiWriteString ( out , cgiRemoteIdent ) )  if ( ! cgiWriteString ( out , cgiContentType ) )  if ( ! cgiWriteString ( out , cgiAccept ) )  if ( ! cgiWriteString ( out , cgiUserAgent ) )  if ( ! cgiWriteString ( out , cgiReferrer ) )  if ( ! cgiWriteString ( out , cgiCookie ) )  if ( ! cgiWriteInt ( out , cgiContentLength ) )  e = cgiFormEntryFirst; while ( e )  cgiFilePtr fp ; if ( ! cgiWriteString ( out , e -> attr ) )  if ( ! cgiWriteString ( out , e -> value ) )  if ( ! cgiWriteString ( out , e -> fileName ) )  if ( ! cgiWriteString ( out , e -> contentType ) )  if ( ! cgiWriteInt ( out , e -> valueLength ) )  if ( cgiFormFileOpen ( e -> attr , & fp ) == cgiFormSuccess )  char buffer [ 1024 ] ; int got ; if ( ! cgiWriteInt ( out , 1 ) )  while ( cgiFormFileRead ( fp , buffer , sizeof ( buffer ) , & got ) == cgiFormSuccess )  if ( ( ( int ) fwrite ( buffer , 1 , got , out ) ) != got )  if ( cgiFormFileClose ( fp ) != cgiFormSuccess )  if ( ! cgiWriteInt ( out , 0 ) )  e = e -> next; static int cgiWriteString(FILE *out, char *s) int len = ( int ) strlen ( s ) ; cgiWriteInt ( out , len ); static int cgiWriteInt(FILE *out, int i) if ( ! fwrite ( & i , sizeof ( int ) , 1 , out ) )  