source: trunk/emx/src/libomflib/omflibap.c@ 3232

Last change on this file since 3232 was 18, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 963 bytes
Line 
1/* omflibap.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
2
3/* Declare a symbol public. */
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8#include <errno.h>
9#include "omflib0.h"
10#include <sys/omflib.h>
11
12int omflib_add_pub (struct omflib *p, const char *name, word page, char *error)
13{
14 int i;
15
16 if (strncmp (name, "__POST$", 7) == 0)
17 return 0;
18
19 if (p->pub_count >= p->pub_alloc)
20 {
21 p->pub_alloc += 32;
22 p->pub_tab = realloc (p->pub_tab,
23 p->pub_alloc * sizeof (struct pubsym));
24 if (p->pub_tab == NULL)
25 {
26 errno = ENOMEM;
27 strcpy (error, strerror (errno));
28 p->pub_alloc = 0;
29 p->pub_count = 0;
30 return -1;
31 }
32 }
33 i = p->pub_count;
34 if ((p->pub_tab[i].name = strdup (name)) == NULL)
35 {
36 errno = ENOMEM;
37 return omflib_set_error (error);
38 }
39 p->pub_tab[i].page = page;
40 ++p->pub_count;
41 return 0;
42}
Note: See TracBrowser for help on using the repository browser.