mirror of
https://github.com/Lennart1978/drinfo.git
synced 2026-11-20 19:42:01 +00:00
update ...
This commit is contained in:
1 parent
0f3891e4d6
commit
494bc3cf81
3 files changed
+3
-46
No files matched your search
@@ -53,3 +53,4 @@ dkms.conf
|
|||||||
|
|
||||||
# debug information files
|
# debug information files
|
||||||
*.dwo
|
*.dwo
|
||||||
|
drinfo
|
||||||
@@ -1,6 +1,7 @@
|
|||||||

|
|
||||||
# drinfo - drive info
|
# drinfo - drive info
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
A lightweight command-line tool to monitor disk usage on Linux systems with beautiful colored progress bars.
|
A lightweight command-line tool to monitor disk usage on Linux systems with beautiful colored progress bars.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@@ -26,5 +27,3 @@ sudo make install
|
|||||||
## Screenshot
|
## Screenshot
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
@@ -117,49 +117,6 @@ int max_visible_line_length(const char *lines[], int n)
|
|||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper: find UUID from /dev/disk/by-uuid
|
|
||||||
void get_uuid(const char *device, char *uuid, size_t uuid_size)
|
|
||||||
{
|
|
||||||
uuid[0] = '\0';
|
|
||||||
FILE *fp = popen("ls -l /dev/disk/by-uuid/", "r");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
char line[512];
|
|
||||||
while (fgets(line, sizeof(line), fp))
|
|
||||||
{
|
|
||||||
char *p = strstr(line, "> ");
|
|
||||||
if (p && strstr(line, device))
|
|
||||||
{
|
|
||||||
char *start = line;
|
|
||||||
while (*start == ' ')
|
|
||||||
start++;
|
|
||||||
char *end = strchr(start, ' ');
|
|
||||||
if (end && (end - start) < (int)uuid_size)
|
|
||||||
{
|
|
||||||
strncpy(uuid, start, end - start);
|
|
||||||
uuid[end - start] = '\0';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper: mount time (ctime of mountpoint)
|
|
||||||
void get_mount_time(const char *mountpoint, char *buf, size_t bufsize)
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
if (stat(mountpoint, &st) == 0)
|
|
||||||
{
|
|
||||||
struct tm *tm = localtime(&st.st_ctime);
|
|
||||||
strftime(buf, bufsize, "%Y-%m-%d %H:%M:%S", tm);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(buf, bufsize, "unknown");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|||||||
Reference in new issue
Block a user