File: rewind.cc

package info (click to toggle)
gri 2.4.2-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,540 kB
  • ctags: 1,966
  • sloc: cpp: 32,542; lisp: 3,243; perl: 806; makefile: 548; sh: 253
file content (21 lines) | stat: -rw-r--r-- 483 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include "extern.hh"
#include "DataFile.hh"

bool
rewindCmd()
{
    if (_nword != 1) {
	err("`rewind' has no parameters");
	return false;
    }
    if (_dataFILE.back().get_type() != DataFile::ascii) {
	err("`rewind' ignored: no data file open (and can't rewind keyboard)");
	return false;
    }
    rewind(_dataFILE.back().get_fp());
    clearerr(_dataFILE.back().get_fp());
    _dataFILE.back().set_line(1);
    clear_eof_flag_on_data_file();
    return true;
}