Skip to content

Commit

Permalink
more reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
woodruffw committed Dec 15, 2014
1 parent c5ed5f7 commit fc080a4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
26 changes: 16 additions & 10 deletions src/plat/bsd/detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void detect_arch(char *str)

/* detect_host
detects the computer's hostname and active user and formats them
argument char *str: the char array to be filled with the user and hostname in format 'user@host'
argument char *str: the char array to be filled with the host info
*/
void detect_host(char *str)
{
Expand Down Expand Up @@ -96,7 +96,7 @@ void detect_kernel(char *str)

/* detect_uptime
detects the computer's uptime
argument char *str: the char array to be filled with the uptime in format '$d $h $m $s' where $ is a number
argument char *str: the char array to be filled with the uptime
*/
void detect_uptime(char *str)
{
Expand All @@ -115,7 +115,8 @@ void detect_uptime(char *str)
fscanf(uptime_file, "%ld", &uptime);
pclose(uptime_file);
#elif defined(__FreeBSD__) || defined(__DragonFly__)
uptime_file = popen("sysctl -n kern.boottime | cut -d '=' -f 2 | cut -d ',' -f 1", "r");
uptime_file = popen("sysctl -n kern.boottime | cut -d '=' -f 2 | "
"cut -d ',' -f 1", "r");
fscanf(uptime_file, "%ld", &boottime); /* get boottime in secs */
pclose(uptime_file);

Expand Down Expand Up @@ -183,7 +184,9 @@ void detect_cpu(char *str)
FILE *cpu_file;

#if defined(__NetBSD__)
cpu_file = popen("awk 'BEGIN{FS=\":\"} /model name/ { print $2; exit }' /proc/cpuinfo | sed -e 's/ @/\\n/' -e 's/^ *//g' -e 's/ *$//g' | head -1 | tr -d '\\n'", "r");
cpu_file = popen("awk 'BEGIN{FS=\":\"} /model name/ { print $2; exit }' "
"/proc/cpuinfo | sed -e 's/ @/\\n/' -e 's/^ *//g' -e 's/ *$//g' "
"| head -1 | tr -d '\\n'", "r");
fgets(str, MAX_STRLEN, cpu_file);
pclose(cpu_file);
#else
Expand Down Expand Up @@ -212,7 +215,7 @@ void detect_gpu(char *str)

/* detect_disk
detects the computer's total disk capacity and usage
argument char *str: the char array to be filled with the disk data in format '$G / $G ($G%)', where $ is a number
argument char *str: the char array to be filled with the disk data
*/
void detect_disk(char *str)
{
Expand All @@ -236,7 +239,7 @@ void detect_disk(char *str)

/* detect_mem
detects the computer's total and used RAM
argument char *str: the char array to be filled with the memory data in format '$MB / $MB', where $ is a number
argument char *str: the char array to be filled with the memory data
*/
void detect_mem(char *str)
{
Expand Down Expand Up @@ -322,13 +325,14 @@ void detect_shell(char *str)

/* detect_res
detects the combined resolution of all monitors attached to the computer
argument char *str: the char array to be filled with the resolution in format '$x$', where $ is a number
argument char *str: the char array to be filled with the resolution
*/
void detect_res(char *str)
{
FILE *res_file;

res_file = popen("xdpyinfo 2> /dev/null | sed -n 's/.*dim.* \\([0-9]*x[0-9]*\\) .*/\\1/pg' | tr '\\n' ' '", "r");
res_file = popen("xdpyinfo 2> /dev/null | sed -n 's/.*dim.* "
"\\([0-9]*x[0-9]*\\) .*/\\1/pg' | tr '\\n' ' '", "r");
fgets(str, MAX_STRLEN, res_file);
pclose(res_file);

Expand Down Expand Up @@ -444,9 +448,11 @@ void detect_gtk(char *str)
pclose(gtk_file);

if (STRCMP(gtk3_str, "Unknown"))
snprintf(str, MAX_STRLEN, "%s (GTK2), %s (Icons)", gtk2_str, gtk_icons_str);
snprintf(str, MAX_STRLEN, "%s (GTK2), %s (Icons)", gtk2_str,
gtk_icons_str);
else if (STRCMP(gtk2_str, "Unknown"))
snprintf(str, MAX_STRLEN, "%s (GTK3), %s (Icons)", gtk3_str, gtk_icons_str);
snprintf(str, MAX_STRLEN, "%s (GTK3), %s (Icons)", gtk3_str,
gtk_icons_str);
else
snprintf(str, MAX_STRLEN, "%s (GTK2), %s (GTK3)", gtk2_str, gtk3_str);

Expand Down
8 changes: 4 additions & 4 deletions src/plat/linux/detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void detect_disk(char *str)

/* detect_mem
detects the computer's total and used RAM
argument char *str: the char array to be filled with the memory data in format '$MB / $MB', where $ is a number
argument char *str: the char array to be filled with the memory data
*/
void detect_mem(char *str)
{
Expand All @@ -431,7 +431,7 @@ void detect_mem(char *str)
long long used_mem = 0;
struct sysinfo si_mem;

/* known problem: because linux utilizes free ram extensively in caches/buffers,
/* known problem: because linux utilizes free ram in caches/buffers,
the amount of memory sysinfo reports as free is very small.
*/
sysinfo(&si_mem);
Expand Down Expand Up @@ -514,7 +514,7 @@ void detect_shell(char *str)

/* detect_res
detects the combined resolution of all monitors attached to the computer
argument char *str: the char array to be filled with the resolution in format '$x$', where $ is a number
argument char *str: the char array to be filled with the resolution
*/
void detect_res(char *str)
{
Expand Down Expand Up @@ -620,7 +620,7 @@ void detect_wm(char *str)
}
else if (error)
{
ERROR_OUT("Error: ", "WM cannot be detected without EWMH compliance.");
ERROR_OUT("Error: ", "No WM detected (non-EWMH compliant?)");
}

XCloseDisplay(disp);
Expand Down
5 changes: 3 additions & 2 deletions src/plat/sun/detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void detect_kernel(char *str)

/* detect_uptime
detects the computer's uptime
argument char *str: the char array to be filled with the uptime in format '$d $h $m $s' where $ is a number
argument char *str: the char array to be filled with the uptime
*/
void detect_uptime(char *str)
{
Expand Down Expand Up @@ -273,7 +273,8 @@ void detect_shell(char *str)
snprintf(str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6);
pclose(shell_file);
}
else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") || strstr(shell_name, "ksh"))
else if (strstr(shell_name, "dash") || strstr(shell_name, "ash")
|| strstr(shell_name, "ksh"))
{
/* i don't have a version detection system for these, yet */
safe_strncpy(str, shell_name, MAX_STRLEN);
Expand Down
2 changes: 1 addition & 1 deletion src/plat/win32/detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void detect_gpu(char *str)

/* detect_disk
detects the computer's total disk capacity and usage
argument char *str: the char array to be filled with the disk data in format '$G / $G ($G%)', where $ is a number
argument char *str: the char array to be filled with the disk data
*/
void detect_disk(char *str)
{
Expand Down

0 comments on commit fc080a4

Please sign in to comment.