diff options
Diffstat (limited to 'articles.c')
-rw-r--r-- | articles.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -20,10 +20,13 @@ int bbs_article( term_screen *ts, const char *fname ) max_y = 24; } else { + printf("Unknown mode\n"); max_x = 80; max_y = 24; } + bbs_log_article( NULL ); + if ( fname != NULL ) { f = fopen( fname, "r" ); @@ -48,7 +51,7 @@ int bbs_article( term_screen *ts, const char *fname ) // ((fret > 0) && (i > max_x-1)) ) if ( i >= max_y-1 ) { - printf("(N)ext,(Q)uit:"); + printf("(N)ext,(D)ump,(Q)uit:"); ret_len = getline( &in_buf, &in_size, stdin ); if ( ret_len > 0 ) { @@ -63,6 +66,21 @@ int bbs_article( term_screen *ts, const char *fname ) case 'N': i = 0; break; + //dump whole file to the screen + case 'd': + case 'D': + { + char tmp_buf[81]; + size_t tmp_size; + fseek( f, 0, SEEK_SET ); + while ( (tmp_size = fread( &tmp_buf, 1, 80, f )) > 0 ) + { + tmp_buf[ tmp_size ] = 0; + printf( "%s", tmp_buf ); + } + } + i = 0; + break; default: printf("Try more\n"); } |