PAPI
7.1.0.0
Loading...
Searching...
No Matches
pscanf.h
Go to the documentation of this file.
1
/* This file was taken from the tacc_stats utility, which is distributed
2
* under a GPL license.
3
*/
4
#ifndef _PSCANF_H_
5
#define _PSCANF_H_
6
#include <stdio.h>
7
#include <stdarg.h>
8
9
__attribute__
((format(scanf, 2, 3)))
10
static inline
int
pscanf(const
char
*path, const
char
*
fmt
, ...)
11
{
12
int
rc
= -1;
13
FILE *
file
= NULL;
14
char
file_buf
[4096];
15
va_list
arg_list
;
16
va_start
(
arg_list
,
fmt
);
17
18
file
= fopen(path,
"r"
);
19
if
(
file
== NULL)
20
goto
out;
21
setvbuf
(
file
,
file_buf
, _IOFBF,
sizeof
(
file_buf
));
22
23
rc
= vfscanf(
file
,
fmt
,
arg_list
);
24
25
out:
26
if
(
file
!= NULL)
27
fclose
(
file
);
28
va_end
(
arg_list
);
29
return
rc
;
30
}
31
32
#endif
__attribute__
unsigned long AO_t __attribute__((__aligned__(4)))
Definition:
m68k.h:21
va_list
__gnuc_va_list va_list
Definition:
papi_fwrappers_.c:307
fclose
int fclose(FILE *__stream)
rc
rc
Definition:
pscanf.h:23
arg_list
va_list arg_list
Definition:
pscanf.h:15
fmt
const char * fmt
Definition:
pscanf.h:10
file_buf
char file_buf[4096]
Definition:
pscanf.h:14
file
const char FILE * file
Definition:
pscanf.h:13
va_end
va_end(arg_list)
setvbuf
setvbuf(file, file_buf, _IOFBF, sizeof(file_buf))
va_start
va_start(arg_list, fmt)
src
components
infiniband
pscanf.h
Generated on Wed Dec 20 2023 18:12:51 for PAPI by
1.9.6