Subversion Repositories Kolibri OS

Rev

Rev 8793 | Rev 9165 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8793 Rev 9156
Line 10... Line 10...
10
	if(!stream){
10
	if(!stream){
11
		errno = EBADF;
11
		errno = EBADF;
12
		return 0;
12
		return 0;
13
	}
13
	}
Line -... Line 14...
-
 
14
	
-
 
15
	if(size<=0 || nmemb<=0){
-
 
16
		errno = EINVAL;
-
 
17
		stream->error=errno;
-
 
18
		return 0;
-
 
19
	}
14
	
20
	
15
	if(stream==stdin){
21
	if(stream==stdin){
16
		con_init();
22
		con_init();
17
		con_gets((char*)ptr, bytes_count+1);
23
		con_gets((char*)ptr, bytes_count+1);
18
		return nmemb;
24
		return nmemb;
Line 23... Line 29...
23
			if(!stream->__ungetc_emu_buff){
29
			if(!stream->__ungetc_emu_buff){
24
				((char*) ptr)[0]=(char)stream->__ungetc_emu_buff;
30
				((char*) ptr)[0]=(char)stream->__ungetc_emu_buff;
25
				//debug_printf("Ungetc: %x\n", ((char*) ptr)[0]);
31
				//debug_printf("Ungetc: %x\n", ((char*) ptr)[0]);
26
			}
32
			}
27
			unsigned status = _ksys_file_read_file(stream->name, stream->position, bytes_count, ptr , &bytes_read);
33
			unsigned status = _ksys_file_read_file(stream->name, stream->position, bytes_count, ptr , &bytes_read);
-
 
34
			if (status != KSYS_FS_ERR_SUCCESS) {
-
 
35
				if(status == KSYS_FS_ERR_EOF){
-
 
36
					stream->eof=1;
28
			if (status) {
37
				}else{
29
            	errno = EIO;
38
					errno = EIO;
30
            	stream->error = errno;
39
					stream->error = errno;
31
				return 0;
40
					return 0;
32
        	}else {
-
 
33
    			stream->position+=bytes_read;
-
 
34
			}
41
				}
35
		}
42
			}
-
 
43
			stream->position+=bytes_read;
-
 
44
		}
36
	}
45
	}
37
	return bytes_read;
46
	return bytes_read/size;
38
}
47
}