37 char doc[150][1024], b[1024], tok[80];
42 if ( ( fp = fopen(
"plplot_octave_txt/plplot.doc",
"r" ) ) == NULL )
44 perror(
"plplot.doc not found:" );
48 while ( !feof( fp ) && fgets( b,
sizeof ( b ), fp ) != NULL )
50 if ( strchr( b,
'-' ) )
51 strcpy( doc[item++], b );
55 if ( ( fp = fopen(
"tmp_stub",
"r" ) ) == NULL )
57 perror(
"tmp_stub not found:" );
61 while ( !feof( fp ) && fgets( b,
sizeof ( b ), fp ) != NULL )
63 if ( ( p2 = strchr( b,
'(' ) ) )
66 while ( *p1-- !=
' ' )
69 if ( *( p1 + 1 ) ==
'_' )
71 strncpy( tok, p1, p2 - p1 );
72 *( tok + (int) ( p2 - p1 ) ) =
'\0';
74 if ( fgets( b,
sizeof ( b ), fp ) == NULL )
76 fprintf( stderr,
"Error reading line\n" );
79 printf(
"%s%%\n", b );
81 sprintf( b,
"plplot_octave_txt/%s.txt", tok );
82 if ( stat( b, &buf ) && errno == ENOENT )
84 fprintf( stderr,
"%s not found, trying plplot.doc... ", b );
86 for ( j = 0; j < item; j++ )
88 if ( strncmp( doc[j], tok, strlen( tok ) ) == 0 )
90 printf(
"%% %s", &doc[j][strlen( tok ) + 4] );
96 fprintf( stderr,
"%s not found\n", tok );
97 printf(
"%% No online help available. Help me, write and submit the documentation, or at least write a one line descriptive text.\n" );
100 fprintf( stderr,
"%s OK\n", tok );
104 printf(
"%% Original PLplot call documentation:\n%%\n" );
105 fp1 = fopen( b,
"r" );
106 while ( !feof( fp1 ) && fgets( b,
sizeof ( b ), fp1 ) != NULL )
108 printf(
"%% %s", b );
112 if ( fgets( b,
sizeof ( b ), fp ) == NULL )
114 fprintf( stderr,
"Error reading line\n" );
117 if ( fgets( b,
sizeof ( b ), fp ) == NULL )
119 fprintf( stderr,
"Error reading line\n" );
123 if ( fgets( b,
sizeof ( b ), fp ) == NULL )
125 fprintf( stderr,
"Error reading line\n" );