add emacs indentation variables to source files in line with current vim settings
[monky] / src / common.h
1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */
2
3 #ifndef _COMMON_H
4 #define _COMMON_H
5
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <sys/socket.h>
10
11 void strfold(char *start, int count);
12 int check_mount(char *s);
13 void prepare_update(void);
14 void update_uptime(void);
15 void update_meminfo(void);
16 void update_net_stats(void);
17 void update_cpu_usage(void);
18 void update_total_processes(void);
19 void update_uname(void);
20 void update_running_processes(void);
21 void update_i8k(void);
22 void update_stuff(void);
23 char get_freq(char *, size_t, const char *, int, unsigned int);
24 void get_freq_dynamic(char *, size_t, const char *, int);
25 char get_voltage(char *, size_t, const char *, int, unsigned int);      /* ptarjan */
26 void update_load_average(void);
27 void update_top(void);
28 void free_all_processes(void);
29 struct process *get_first_process(void);
30 void get_cpu_count(void);
31 double get_time(void);
32
33 /* Converts '~/...' paths to '/home/blah/...' assumes that 'dest' is at least
34  * DEFAULT_TEXT_BUFFER_SIZE.  It's similar to variable_substitute, except only
35  * cheques for $HOME and ~/ in path */
36 void to_real_path(char *dest, const char *source);
37 FILE *open_file(const char *file, int *reported);
38 int open_fifo(const char *file, int *reported);
39 void variable_substitute(const char *s, char *dest, unsigned int n);
40
41 void format_seconds(char *buf, unsigned int n, long t);
42 void format_seconds_short(char *buf, unsigned int n, long t);
43
44 #ifdef X11
45 void update_x11info(void);
46 #endif
47
48 int round_to_int_temp(float);
49
50 unsigned int round_to_int(float);
51
52 extern unsigned long long need_mask;
53 extern int no_buffers;
54
55 struct dns_data {
56         int nscount;
57         char **ns_list;
58 };
59 void free_dns_data(void);
60
61 struct net_stat {
62         char *dev;
63         int up;
64         long long last_read_recv, last_read_trans;
65         long long recv, trans;
66         double recv_speed, trans_speed;
67         struct sockaddr addr;
68 #if defined(__linux__)
69         char addrs[273];
70 #endif /* __linux__ */
71         double net_rec[15], net_trans[15];
72         // wireless extensions
73         char essid[32];
74         char bitrate[16];
75         char mode[16];
76         int link_qual;
77         int link_qual_max;
78         char ap[18];
79 };
80 void clear_net_stats(void);
81 struct net_stat *get_net_stat(const char *dev, void *free_at_crash1, void *free_at_crash2);
82 int interface_up(const char *dev);
83
84 void get_adt746x_cpu(char *, size_t);
85 void get_adt746x_fan(char *, size_t);
86
87 int open_acpi_temperature(const char *name);
88 double get_acpi_temperature(int fd);
89 void get_acpi_ac_adapter(char *, size_t);
90 void get_acpi_fan(char *, size_t);
91 void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
92 int get_battery_perct(const char *bat);
93 int get_battery_perct_bar(const char *bat);
94 void get_battery_short_status(char *buf, unsigned int n, const char *bat);
95
96 #endif /* _COMMON_H */