00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "config.h"
00024 #if HAVE_STDLIB_H
00025 # include <stdlib.h>
00026 #else
00027 # include <stdio.h>
00028 #endif
00029 #if HAVE_UNISTD_H
00030 # include <unistd.h>
00031 #endif
00032 #include <errno.h>
00033 #if HAVE_SYS_PARAM_H
00034 # include <sys/param.h>
00035 #endif
00036 #include <errno.h>
00037 #include "f2c.h"
00038
00039 void g_char (const char *a, ftnlen alen, char *b);
00040
00041 integer
00042 G77_link_0 (const char *path1, const char *path2, const ftnlen Lpath1,
00043 const ftnlen Lpath2)
00044 {
00045 #if defined (HAVE_LINK) || defined(KEY)
00046 char *buff1, *buff2;
00047 int i;
00048
00049 buff1 = malloc (Lpath1 + 1);
00050 if (buff1 == NULL)
00051 return -1;
00052 g_char (path1, Lpath1, buff1);
00053 buff2 = malloc (Lpath2 + 1);
00054 if (buff2 == NULL)
00055 return -1;
00056 g_char (path2, Lpath2, buff2);
00057 i = link (buff1, buff2);
00058 free (buff1);
00059 free (buff2);
00060 return i ? errno : 0;
00061 #else
00062 errno = ENOSYS;
00063 return -1;
00064 #endif
00065 }
00066
00067 #ifdef KEY
00068
00069 void
00070 pathf90_link(const char *path1, const char *path2, int *status,
00071 const ftnlen Lpath1, const ftnlen Lpath2)
00072 {
00073 int junk;
00074 status = (0 == status) ? (&junk) : status;
00075 *status = G77_link_0(path1, path2, Lpath1, Lpath2);
00076 }
00077 #endif
00078