#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- OPEN_X(fp, str1, SCAN_ULINT, &temp);
+ OPEN_FP(fp, str1, SCAN_ULINT, &temp);
#pragma GCC diagnostic pop
if (99999 < temp) { /* > 99C */
#pragma GCC diagnostic ignored "-Wunused-result"
CHECK_FSCANF(fp, SCAN_UFINT, &rpm[z]);
#pragma GCC diagnostic pop
- CLOSE_X(fp);
+ CLOSE_FP(fp);
}
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- OPEN_X(fp, DVD_VEND, "%s", vendor);
+ OPEN_FP(fp, DVD_VEND, "%s", vendor);
#pragma GCC diagnostic pop
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- OPEN_X(fp, DVD_MODEL, "%s", model);
+ OPEN_FP(fp, DVD_MODEL, "%s", model);
#pragma GCC diagnostic pop
FILL_STR_ARR(2, str1, vendor, model);
memset(up, 0, sizeof(up));
if (-1 == (getloadavg(up, 3))) {
- FUNC_FAILED("getloadavg()");
+ FUNC_FAILED("getloadavg()");
}
FILL_ARR(str1, "%.2f %.2f %.2f",
(float)up[0], (float)up[1], (float)up[2]);
&cpu_active[0], &cpu_active[1], &cpu_active[2], &cpu_active[3],
&cpu_active[4], &cpu_active[5], &cpu_active[6], &cpu_active[7],
&cpu_active[8], &cpu_active[9]))) {
- CLOSE_X(fp);
+ CLOSE_FP(fp);
exit_with_err(ERR, "Upgrade to a newer kernel");
}
#pragma GCC diagnostic pop
- CLOSE_X(fp);
+ CLOSE_FP(fp);
#endif /* __linux__ */
for (x = 0; x < LOOP_ITERZ; x++) {
CHECK_FP(fp);
if (NULL == (fgets(buf, VLA-1, fp))) {
- CLOSE_X(fp);
+ CLOSE_FP(fp);
exit_with_err(ERR, "reached /proc/stat EOF");
}
for (x = 0; x < MAX_CORES; x++, z++) {
if (NULL == (fgets(buf, VLA-1, fp))) {
- CLOSE_X(fp);
+ CLOSE_FP(fp);
exit_with_err(ERR, "reached /proc/stat EOF");
}
&core_active[x][0], &core_active[x][1], &core_active[x][2], &core_active[x][3],
&core_active[x][4], &core_active[x][5], &core_active[x][6], &core_active[x][7],
&core_active[x][8], &core_active[x][9]))) {
- CLOSE_X(fp);
+ CLOSE_FP(fp);
exit_with_err(ERR, "Upgrade to a newer kernel");
}
}
- CLOSE_X(fp);
+ CLOSE_FP(fp);
for (x = 0; x < z; x++) {
exit_with_err(ERR, CANNOT_OPEN_FP); \
}
-#define CLOSE_X(fp) \
+#define CLOSE_FP(fp) \
if (EOF == (fclose(fp))) { \
exit_with_err(ERR, CANNOT_CLOSE); \
}
-#define OPEN_X(fp, x, y, z) \
+#define OPEN_FP(fp, x, y, z) \
if (NULL == (fp = fopen(x, "r"))) { \
exit_with_err(CANNOT_OPEN, x); \
} \
CHECK_FSCANF(fp, y, z); \
- CLOSE_X(fp);
+ CLOSE_FP(fp);
#define CHECK_POPEN(fp, x, packs) \
if (NULL == (fp = popen(x, "r"))) { \
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- OPEN_X(fp, model, "%[^\n]", model);
+ OPEN_FP(fp, model, "%[^\n]", model);
#pragma GCC diagnostic pop
FILL_STR_ARR(1, str1, model);
#pragma GCC diagnostic ignored "-Wunused-result"
CHECK_FSCANF(fp, "%f", &voltage[x]);
#pragma GCC diagnostic pop
- CLOSE_X(fp);
+ CLOSE_FP(fp);
voltage[x] /= 1000.0f;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- OPEN_X(fp, MOBO_VENDOR, "%s", vendor);
+ OPEN_FP(fp, MOBO_VENDOR, "%s", vendor);
#pragma GCC diagnostic pop
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- OPEN_X(fp, MOBO_NAME, "%s", name);
+ OPEN_FP(fp, MOBO_NAME, "%s", name);
#pragma GCC diagnostic pop
FILL_STR_ARR(2, str1, vendor, name);
if (EOF == (fscanf(fp, FMT_UINT FMT_UINT FMT_UINT FMT_UINT FMT_UINT FMT_UINT FMT_UINT,
&statio[0], &statio[1], &statio[2], &statio[3],
&statio[4], &statio[5], &statio[6]))) {
- CLOSE_X(fp);
+ CLOSE_FP(fp);
exit_with_err(ERR, "reading the stat file failed");
}
#pragma GCC diagnostic pop
- CLOSE_X(fp);
+ CLOSE_FP(fp);
FILL_ARR(str1, "Read " FMT_UINT " MB, Written " FMT_UINT " MB",
BYTES_TO_MB(statio[2]), BYTES_TO_MB(statio[6]));
#pragma GCC diagnostic ignored "-Wunused-result"
CHECK_FSCANF(fp, FMT_UINT, &total);
#pragma GCC diagnostic pop
- CLOSE_X(fp);
+ CLOSE_FP(fp);
BATTERY_USED(temp, num);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- OPEN_X(fp, temp, FMT_UINT, &used);
+ OPEN_FP(fp, temp, FMT_UINT, &used);
#pragma GCC diagnostic pop
FILL_UINT_ARR(str1,
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- OPEN_X(fp, temp, SCAN_UINTX, &vendor); /* hex */
+ OPEN_FP(fp, temp, SCAN_UINTX, &vendor); /* hex */
#pragma GCC diagnostic pop
NIC_MODEL(temp, str2);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- OPEN_X(fp, temp, SCAN_UINTX, &model); /* hex */
+ OPEN_FP(fp, temp, SCAN_UINTX, &model); /* hex */
#pragma GCC diagnostic pop
pacc = pci_alloc();
while (NULL != (fgets(buf, 99, fp))) {
if (EOF == (sscanf(buf, "%s", temp))) {
- CLOSE_X(fp);
+ CLOSE_FP(fp);
exit_with_err(ERR, "empty line(s) detected.");
}
ptr = temp;
ello[1] = ptr;
argp_parse(&arg_parser, 2, ello, ARGP_IN_ORDER, NULL, &arguments);
}
- CLOSE_X(fp);
+ CLOSE_FP(fp);
}
#pragma GCC diagnostic ignored "-Wunused-result"
CHECK_FSCANF(fp, SCAN_UFINT, &temp);
#pragma GCC diagnostic pop
- CLOSE_X(fp);
+ CLOSE_FP(fp);
FILL_ARR(str1, UFINT, temp);
}
const char *tagz[] = { "artist", "title", "album", "date" };
const char *idx_tagz = ((6 != num) ? tagz[num-2] : "ohsnap");
+ FILL_STR_ARR(1, str1, "Null");
+
if (NULL == (fp = popen("cmus-remote -Q 2> /dev/null", "r"))) {
return;
}