コード例 #1
0
BOOLEAN setup( char *terminal )
{
  char *term_putenv = 0;
  char *buffer = 0;
  char *cp = LYgetXDisplay( );
  if ( cp )
    HTSACopy( &x_display, cp );
  else
  if ( x_display )
  {
    free( x_display );
    x_display = 0;
  }
  if ( terminal )
  {
    HTSprintf0( &term_putenv, "TERM=%.106s", terminal );
    putenv( term_putenv );
  }
  if ( dumbterm( LYGetEnv( "TERM" ) ) )
  {
    printf( "\n\n  %s\n\n", gettext( "Your Terminal type is unknown!" ) );
    printf( "  %s [vt100] ", gettext( "Enter a terminal type:" ) );
    if ( LYSafeGets( &buffer, stdin ) )
    {
      LYTrimLeading( buffer );
      LYTrimTrailing( buffer );
    }
    if ( buffer == 0 || buffer[0] == 0 )
      HTSACopy( &buffer, "vt100" );
    HTSprintf0( &term_putenv, "TERM=%.106s", buffer );
    if ( buffer )
    {
      free( buffer );
      buffer = 0;
    }
    putenv( term_putenv );
    printf( "\n%s %s\n", gettext( "TERMINAL TYPE IS SET TO" ), LYGetEnv( "TERM" ) );
    LYSleepMsg( );
  }
  start_curses( );
  if ( strncmp( ttytype, "sun", 3 ) == 0 )
    LYnoVideo( 2 );
  LYlines = LYscreenHeight( );
  LYcols = LYscreenWidth( );
  return 1;
}
コード例 #2
0
int PassesTest( struct MailcapEntry *mc )
{
  int result;
  if ( mc->testcommand == 0 )
  {
    return 1;
  }
  if ( strcmp( &mc->testcommand, "test \"$DISPLAY\"" ) == 0 || strcmp( &mc->testcommand, "test \"$DISPLAY\" != \"\"" ) == 0 || strcmp( &mc->testcommand, "test -n \"$DISPLAY\"" ) == 0 )
  {
    if ( mc->testcommand )
    {
      free( &mc->testcommand );
      *(int*)&mc->testcommand = 0;
    }
    if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
    {
      fprintf( TraceFP( ), "PassesTest: Testing for XWINDOWS environment.\n" );
    }
    if ( LYgetXDisplay( ) )
    {
      if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
      {
        fprintf( TraceFP( ), "PassesTest: Test passed!\n" );
      }
      return 1;
    }
    else
    {
      if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
      {
        fprintf( TraceFP( ), "PassesTest: Test failed!\n" );
      }
      return 0;
    }
  }
  else
  {
    if ( strcmp( &mc->testcommand, "test -z \"$DISPLAY\"" ) == 0 )
    {
      if ( mc->testcommand )
      {
        free( &mc->testcommand );
        *(int*)&mc->testcommand = 0;
      }
      if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
      {
        fprintf( TraceFP( ), "PassesTest: Testing for NON_XWINDOWS environment.\n" );
      }
      if ( LYgetXDisplay( ) == 0 )
      {
        if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
        {
          fprintf( TraceFP( ), "PassesTest: Test passed!\n" );
        }
        return 1;
      }
      else
      {
        if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
        {
          fprintf( TraceFP( ), "PassesTest: Test failed!\n" );
        }
        return 0;
      }
    }
    else
    {
      if ( strcmp( &mc->testcommand, "test -n \"$LYNX_VERSION\"" ) == 0 )
      {
        if ( mc->testcommand )
        {
          free( &mc->testcommand );
          *(int*)&mc->testcommand = 0;
        }
        if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
        {
          fprintf( TraceFP( ), "PassesTest: Testing for LYNX environment.\n" );
        }
        if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
        {
          fprintf( TraceFP( ), "PassesTest: Test passed!\n" );
        }
        return 1;
      }
      else
      {
        if ( strcmp( &mc->testcommand, "test -z \"$LYNX_VERSION\"" ) == 0 )
        {
          if ( mc->testcommand )
          {
            free( &mc->testcommand );
            *(int*)&mc->testcommand = 0;
          }
          if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
          {
            fprintf( TraceFP( ), "PassesTest: Testing for non-LYNX environment.\n" );
          }
          if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
          {
            fprintf( TraceFP( ), "PassesTest: Test failed!\n" );
          }
          return 0;
        }
        else
        {
          result = RememberTestResult( 1, &mc->testcommand, 0 );
          if ( result == -1 )
          {
            result = LYTestMailcapCommand( &mc->testcommand, 0 );
            RememberTestResult( 2, &mc->testcommand, result != 0 );
          }
          if ( result != 1 && mc->testcommand )
          {
            free( &mc->testcommand );
            *(int*)&mc->testcommand = 0;
          }
          if ( result < 0 )
          {
            if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
            {
              fprintf( TraceFP( ), "PassesTest: Test failed!\n" );
            }
          }
          else
          if ( result == 0 && WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
          {
            fprintf( TraceFP( ), "PassesTest: Test passed!\n" );
          }
          return ~result >> 31;
        }
      }
    }
  }
}
コード例 #3
0
void HTFormatInit( void )
{
  AcceptMedia media = mediaEXT;
  if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
  {
    fprintf( TraceFP( ), "HTFormatInit\n" );
  }
  if ( LYgetXDisplay( ) )
  {
    HTSetPresentation( "application/postscript", "ghostview %s&", 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
    if ( XLoadImageCommand && XLoadImageCommand[0] )
    {
      HTSetPresentation( "image/gif", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-xbm", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-xbitmap", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-png", XLoadImageCommand, 0, 2.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/png", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-rgb", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-tiff", XLoadImageCommand, 0, 2.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/tiff", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/jpeg", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
    }
    HTSetPresentation( "video/mpeg", "mpeg_play %s &", 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
  }
  HTSetPresentation( "application/x-csh", "csh %s", 0, 999.000000000000, 3.000000000000, 0.000000000000, 0, media );
  HTSetPresentation( "application/x-sh", "sh %s", 0, 999.000000000000, 3.000000000000, 0.000000000000, 0, media );
  HTSetPresentation( "application/x-ksh", "ksh %s", 0, 999.000000000000, 3.000000000000, 0.000000000000, 0, media );
  media = mediaINT;
  HTSetConversion( "message/x-http-redirection", "*", &HTMIMERedirect, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "message/x-http-redirection", "www/present", &HTMIMERedirect, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "message/x-http-redirection", "www/debug", &HTMIMERedirect, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/mime", "www/present", &HTMIMEConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/mime", "www/download", &HTMIMEConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/mime", "www/source", &HTMIMEConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/mime", "www/dump", &HTMIMEConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/compressed", "www/download", &HTCompressed, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/compressed", "www/present", &HTCompressed, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/compressed", "www/source", &HTCompressed, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/compressed", "www/dump", &HTCompressed, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/html", "text/x-c", &HTMLToC, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/html", "text/plain", &HTMLToPlain, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/css", "text/plain", &HTMLToPlain, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/html", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/xhtml+xml", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/xml", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/html", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/x-wais-source", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/x-wais-source", "www/present", &HTWSRCConvert, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/x-wais-source", "www/download", &HTWSRCConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/x-wais-source", "www/dump", &HTWSRCConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/source", "www/present", &HTSaveToFile, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "www/source", "www/source", &HTSaveToFile, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "www/source", "www/download", &HTSaveToFile, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "www/source", "*", &HTSaveToFile, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "www/source", "www/dump", &HTDumpToStdout, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "text/x-sgml", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/x-sgml", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/sgml", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/sgml", "www/present", &HTMLPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/css", "www/present", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/plain", "www/present", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/plain", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/html", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/html", "text/x-c", &HTMLToC, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/html", "text/plain", &HTMLToPlain, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/html", "www/present", &HTMLPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/xml", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  if ( LYisAbsPath( global_type_map ) & 255 )
    HTLoadTypesConfigFile( global_type_map, 16 );
  if ( ( IsOurFile( LYAbsOrHomePath( &personal_type_map ) ) & 255 ) && ( LYCanReadFile( personal_type_map ) & 255 ) )
    HTLoadTypesConfigFile( personal_type_map, 8 );
  HTReorderPresentation( HTAtom_for( "text/plain" ), HTAtom_for( "www/present" ) );
  HTReorderPresentation( HTAtom_for( "text/html" ), HTAtom_for( "www/present" ) );
  HTFilterPresentations( );
  return;
}