Last change
on this file since 3003 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:
965 bytes
|
Line | |
---|
1 | /* omflibex.c (emx+gcc) -- Copyright (c) 1993-1995 by Eberhard Mattes */
|
---|
2 |
|
---|
3 | /* Extract a module of an OMFLIB into an OBJ file. */
|
---|
4 |
|
---|
5 | #include <stdio.h>
|
---|
6 | #include <stdlib.h>
|
---|
7 | #include <string.h>
|
---|
8 | #include "omflib0.h"
|
---|
9 | #include <sys/omflib.h>
|
---|
10 |
|
---|
11 |
|
---|
12 | int omflib_extract (struct omflib *p, const char *name, char *error)
|
---|
13 | {
|
---|
14 | char buf[256+4];
|
---|
15 | int page;
|
---|
16 | FILE *f;
|
---|
17 |
|
---|
18 | if (p->dict == NULL && omflib_read_dictionary (p, error) != 0)
|
---|
19 | return -1;
|
---|
20 | page = omflib_find_module (p, name, error);
|
---|
21 | if (page == 0)
|
---|
22 | {
|
---|
23 | strcpy (error, "Module not found");
|
---|
24 | return -1;
|
---|
25 | }
|
---|
26 | _strncpy (buf, name, 255);
|
---|
27 | _defext (buf, "obj");
|
---|
28 | f = fopen (buf, "wb");
|
---|
29 | if (f == NULL)
|
---|
30 | return omflib_set_error (error);
|
---|
31 | fseek (p->f, page * p->page_size, SEEK_SET);
|
---|
32 | if (omflib_copy_module (NULL, f, p, p->f, NULL, error) != 0)
|
---|
33 | {
|
---|
34 | fclose (f);
|
---|
35 | remove (buf);
|
---|
36 | return -1;
|
---|
37 | }
|
---|
38 | if (fflush (f) != 0 || fclose (f) != 0)
|
---|
39 | return omflib_set_error (error);
|
---|
40 | return 0;
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.