mirror of
https://github.com/Lennart1978/drinfo.git
synced 2026-10-01 05:02:31 +07:00
update ...
This commit is contained in:
@@ -53,3 +53,4 @@ dkms.conf
|
||||
|
||||
# debug information files
|
||||
*.dwo
|
||||
drinfo
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||

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

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

|
||||
|
||||
|
||||
|
||||
@@ -117,49 +117,6 @@ int max_visible_line_length(const char *lines[], int n)
|
||||
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()
|
||||
{
|
||||
printf("\n");
|
||||
|
||||
Reference in New Issue
Block a user