Skip to content

Commit 70b5163

Browse files
author
pengel
committed
Add interfaces. Minor updates.
1 parent 16b0bf8 commit 70b5163

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# LDLIBS - Linker libraries.
1919
# TARGET - Output library name. #
2020
#
21-
OS = FreeBSD
21+
OS = linux
2222
PREFIX = /usr/local
2323
FC = gfortran
2424
CC = gcc

src/unix_macro.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extern "C" {
1414
int c_errno(void);
1515
int c_execl(const char *, const char *, const char *, const char *, void *);
1616
int c_fcntl(int, int, int);
17-
int c_fprintf(FILE *, const char *, const char *);
17+
int c_fprintf(void *, const char *, const char *);
1818
int c_ioctl(int, unsigned long, void *);
1919
int c_open(const char *, int, mode_t);
2020
int c_scanf(const char *, const char *);
@@ -48,9 +48,9 @@ int c_fcntl(int fd, int cmd, int arg)
4848
}
4949

5050
/* int fprintf(FILE *stream, const char *format, ...) */
51-
int c_fprintf(FILE *stream, const char *format, const char *arg)
51+
int c_fprintf(void *stream, const char *format, const char *arg)
5252
{
53-
return fprintf(stream, format, arg);
53+
return fprintf((FILE *) stream, format, arg);
5454
}
5555

5656
/* int ioctl(int fd, unsigned long request, ...) */

src/unix_stdio.F90

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module unix_stdio
2424
#endif
2525

2626
public :: c_getchar
27+
public :: c_getline
2728
public :: c_fclose
2829
public :: c_fdopen
2930
public :: c_fflush
@@ -50,6 +51,16 @@ function c_getchar() bind(c, name='getchar')
5051
integer(kind=c_int) :: c_getchar
5152
end function c_getchar
5253

54+
! ssize_t getline(char **lineptr, size_t *n, FILE *stream)
55+
function c_getline(lineptr, n, stream) bind(c, name='getline')
56+
import :: c_char, c_ptr, c_size_t
57+
implicit none
58+
type(c_ptr), intent(inout) :: lineptr
59+
integer(kind=c_size_t), intent(inout) :: n
60+
type(c_ptr), intent(in), value :: stream
61+
integer(kind=c_size_t) :: c_getline
62+
end function c_getline
63+
5364
! int fclose(FILE *stream)
5465
function c_fclose(stream) bind(c, name='fclose')
5566
import :: c_int, c_ptr

src/unix_unistd.F90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module unix_unistd
2626
public :: c_faccessat
2727
public :: c_fork
2828
public :: c_getpid
29+
public :: c_isatty
2930
public :: c_pipe
3031
public :: c_read
3132
public :: c_setsid
@@ -113,6 +114,14 @@ function c_getpid() bind(c, name='getpid')
113114
integer(kind=c_pid_t) :: c_getpid
114115
end function c_getpid
115116

117+
! int isatty(int fd)
118+
function c_isatty(fd) bind(c, name='isatty')
119+
import :: c_int
120+
implicit none
121+
integer(kind=c_int), intent(in), value :: fd
122+
integer(kind=c_int) :: c_isatty
123+
end function c_isatty
124+
116125
! int pipe(int fd[2])
117126
function c_pipe(fd) bind(c, name='pipe')
118127
import :: c_int

0 commit comments

Comments
 (0)