1 /*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18 /* clang-format off */
19
20 /* gerror3f.c - Implements LIB3F gerror subprogram. */
21
22 /* must include ent3f.h AFTER io3f.h */
23 #include "io3f.h"
24 #include "ent3f.h"
25 #include "utils3f.h"
26 #include "error.h"
27
28 #define Ftn_errmsg __fortio_errmsg
29
30 #if !defined(WIN64) && !defined(WIN32)
31 extern char *strerror(); /* SVR4 only ? */
32 #endif
33
ENT3F(GERROR,gerror)34 void ENT3F(GERROR, gerror)(DCHAR(str) DCLEN(str))
35 {
36 char *p;
37
38 p = strerror(__io_errno());
39 __fcp_cstr(CADR(str), CLEN(str), p);
40 return;
41 }
42
ENT3F(GET_IOSTAT_MSG,get_iostat_msg)43 void ENT3F(GET_IOSTAT_MSG, get_iostat_msg)(int *ios, DCHAR(str) DCLEN(str))
44 {
45 char *p;
46 p = Ftn_errmsg(*ios);
47 __fcp_cstr(CADR(str), CLEN(str), p);
48 }
49
50 /* for -Msecond_underscore */
ENT3F(GET_IOSTAT_MSG_,get_iostat_msg_)51 void ENT3F(GET_IOSTAT_MSG_, get_iostat_msg_)(int *ios, DCHAR(str) DCLEN(str))
52 {
53 char *p;
54 p = Ftn_errmsg(*ios);
55 __fcp_cstr(CADR(str), CLEN(str), p);
56 }
57