32 lines
1.0 KiB
C
32 lines
1.0 KiB
C
//
|
|
// Created by xajhu on 2019/11/18 0018.
|
|
//
|
|
|
|
#ifndef ZTP_COMMON_H
|
|
#define ZTP_COMMON_H
|
|
|
|
#ifndef MAX_PATH
|
|
#define MAX_PATH (256)
|
|
#endif
|
|
|
|
#ifndef TRUE
|
|
#define TRUE (1)
|
|
#endif
|
|
|
|
#ifndef FALSE
|
|
#define FALSE (0)
|
|
#endif
|
|
|
|
#define GET_FILE_SIZE(path, size) \
|
|
do { \
|
|
struct stat st; \
|
|
memset(&st, 0, sizeof(struct stat)); \
|
|
if (stat(path, &st) != 0) { \
|
|
size = -1; \
|
|
} else { \
|
|
size = st.st_size; \
|
|
} \
|
|
} while (0)
|
|
|
|
#endif //ZTP_COMMON_H
|