OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-newlib/] [newlib-1.17.0/] [libgloss/] [scarts_32/] [open.c] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 jlechner
#include <errno.h>
2
#include "devops_vec.h"
3
 
4
extern const devops_t *devops_vec[];
5
 
6
int
7
open (const char *file, int flags, int mode)
8
{
9
  int fd, i;
10
 
11
  fd = -1;
12
  i = 0;
13
 
14
  do
15
  {
16
    /* Search for 'file' in 'devops_vec'. */
17
    if (strcmp (devops_vec[i]->name, file) == 0)
18
    {
19
      fd = i;
20
      break;
21
    }
22
  }
23
  while (devops_vec[i++]);
24
 
25
  if (fd != -1)
26
    /* Invoke the device's open() function. */
27
    devops_vec[fd]->open (file, flags, mode);
28
  else
29
    errno = ENODEV;
30
 
31
  return fd;
32
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.