XINU
Functions
lflread.c File Reference
#include <xinu.h>
Include dependency graph for lflread.c:

Go to the source code of this file.

Functions

devcall lflread (struct dentry *devptr, char *buff, int32 count)
 

Function Documentation

◆ lflread()

devcall lflread ( struct dentry devptr,
char *  buff,
int32  count 
)

Definition at line 9 of file lflread.c.

References EOF, lflgetc(), and SYSERR.

14 {
15  uint32 numread; /* Number of bytes read */
16  int32 nxtbyte; /* Character or SYSERR/EOF */
17 
18  if (count < 0) {
19  return SYSERR;
20  }
21 
22  /* Iterate and use lflgetc to read individual bytes */
23 
24  for (numread=0 ; numread < count ; numread++) {
25  nxtbyte = lflgetc(devptr);
26  if (nxtbyte == SYSERR) {
27  return SYSERR;
28  } else if (nxtbyte == EOF) { /* EOF before finished */
29  if (numread == 0) {
30  return EOF;
31  } else {
32  return numread;
33  }
34  } else {
35  *buff++ = (char) (0xff & nxtbyte);
36  }
37  }
38  return numread;
39 }
#define SYSERR
処理が失敗した場合
Definition: kernel.h:79
#define EOF
ファイルの終端(End of File)に達した場合(読み込み処理に用いる)
Definition: kernel.h:81
devcall lflgetc(struct dentry *)
Definition: lflgetc.c:9
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition: kernel.h:15
Here is the call graph for this function: