diff options
author | FreeArtMan <dos21h@gmail.com> | 2014-10-31 10:15:31 +0900 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2014-10-31 10:15:31 +0900 |
commit | c84cc88f0b34d8802390e2a7b6dab7f07ba277d1 (patch) | |
tree | f8af1ec8dafd72636eaf320f658c191c47bc1f75 /articles.c | |
parent | f9a751917d0dd885ba7ae6047ccf7369512ee5df (diff) | |
download | microbbs-c84cc88f0b34d8802390e2a7b6dab7f07ba277d1.tar.gz microbbs-c84cc88f0b34d8802390e2a7b6dab7f07ba277d1.zip |
added article dump, if you whant read it in whole set. hided first log message becouse to many spam from fake visitours
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"); } |