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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20031204-1.c] - Blame information for rev 297

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* PR optimization/13260 */
2
 
3
#include <string.h>
4
 
5
typedef unsigned long u32;
6
 
7
u32 in_aton(const char* x)
8
{
9
  return 0x0a0b0c0d;
10
}
11
 
12
u32 root_nfs_parse_addr(char *name)
13
{
14
 u32 addr;
15
 int octets = 0;
16
 char *cp, *cq;
17
 
18
 cp = cq = name;
19
 while (octets < 4) {
20
  while (*cp >= '0' && *cp <= '9')
21
   cp++;
22
  if (cp == cq || cp - cq > 3)
23
   break;
24
  if (*cp == '.' || octets == 3)
25
   octets++;
26
  if (octets < 4)
27
   cp++;
28
  cq = cp;
29
 }
30
 
31
 if (octets == 4 && (*cp == ':' || *cp == '\0')) {
32
  if (*cp == ':')
33
   *cp++ = '\0';
34
  addr = in_aton(name);
35
  strcpy(name, cp);
36
 } else
37
  addr = (-1);
38
 
39
 return addr;
40
}
41
 
42
int
43
main()
44
{
45
  static char addr[] = "10.11.12.13:/hello";
46
  u32 result = root_nfs_parse_addr(addr);
47
  if (result != 0x0a0b0c0d) { abort(); }
48
  return 0;
49
}

powered by: WebSVN 2.1.0

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