File: rdl-nw-test.c

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (49 lines) | stat: -rw-r--r-- 1,168 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

/* Copyright (C) 1998 Chancelier Jean-Philippe */

#include <stdio.h>
#include <stdlib.h>
extern char *readline_win (char *);

main ()
{
  int i;
  char *line;
  for (i = 0; i < 10; i++)
    {
      line = readline_win ("test");
      if (line != (char *) 0)
	{
	  printf ("line %s\r\n", line);
	}
    }
}


/****************************************************************
 *alloc:
 * allocate memory 
 * This is a protected version of malloc. It causes an int_error 
 * if there is not enough memory. If message is NULL, we 
 * allow NULL return. Otherwise, we handle the error, using the
 * message to create the int_error string. Note cp/sp_extend uses realloc,
 * so it depends on this using malloc().
 *****************************************************************/

char *
alloc (size, message)
     unsigned long size;	/* # of bytes */
     char *message;		/* description of what is being allocated */
{
  char *p;			/* the new allocation */
  char errbuf[100];		/* error message string */
  p = malloc ((size_t) size);	/* try again */
  if (p == (char *) NULL)
    {
      /* really out of memory */
      if (message != NULL)
	{
	}
    }
  return (p);
}