mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 11:05:18 +00:00
drop struct information parameter from generate_text_internal()
This commit is contained in:
parent
0f8b7d1186
commit
ede0838e17
@ -248,12 +248,9 @@ int check_if_match(struct text_object *obj)
|
|||||||
{
|
{
|
||||||
char expression[max_user_text];
|
char expression[max_user_text];
|
||||||
int val;
|
int val;
|
||||||
struct information *tmp_info;
|
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
||||||
tmp_info = malloc(sizeof(struct information));
|
generate_text_internal(expression, max_user_text, *obj->sub);
|
||||||
memcpy(tmp_info, &info, sizeof(struct information));
|
|
||||||
generate_text_internal(expression, max_user_text, *obj->sub, tmp_info);
|
|
||||||
DBGP("parsed arg into '%s'", expression);
|
DBGP("parsed arg into '%s'", expression);
|
||||||
|
|
||||||
val = compare(expression);
|
val = compare(expression);
|
||||||
@ -262,6 +259,5 @@ int check_if_match(struct text_object *obj)
|
|||||||
} else if (!val) {
|
} else if (!val) {
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
free(tmp_info);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ void print_combine(struct text_object *obj, char *p, int p_max_size)
|
|||||||
ll_rows[i] = malloc(sizeof(struct llrows));
|
ll_rows[i] = malloc(sizeof(struct llrows));
|
||||||
current[i] = ll_rows[i];
|
current[i] = ll_rows[i];
|
||||||
for(j=0; j<i; j++) objsub = objsub->sub;
|
for(j=0; j<i; j++) objsub = objsub->sub;
|
||||||
generate_text_internal(buf[i], max_user_text, *objsub, &info);
|
generate_text_internal(buf[i], max_user_text, *objsub);
|
||||||
for(j=0; buf[i][j] != 0; j++) {
|
for(j=0; buf[i][j] != 0; j++) {
|
||||||
if(buf[i][j] == '\t') buf[i][j] = ' ';
|
if(buf[i][j] == '\t') buf[i][j] = ' ';
|
||||||
if(buf[i][j] == '\n') {
|
if(buf[i][j] == '\n') {
|
||||||
|
13
src/common.c
13
src/common.c
@ -612,18 +612,13 @@ void print_evaluate(struct text_object *obj, char *p, int p_max_size)
|
|||||||
int if_empty_iftest(struct text_object *obj)
|
int if_empty_iftest(struct text_object *obj)
|
||||||
{
|
{
|
||||||
char buf[max_user_text];
|
char buf[max_user_text];
|
||||||
struct information *tmp_info;
|
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
||||||
tmp_info = malloc(sizeof(struct information));
|
generate_text_internal(buf, max_user_text, *obj->sub);
|
||||||
memcpy(tmp_info, &info, sizeof(struct information));
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, tmp_info);
|
|
||||||
|
|
||||||
if (strlen(buf) != 0) {
|
if (strlen(buf) != 0) {
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
free(tmp_info);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,7 +745,7 @@ void print_to_bytes(struct text_object *obj, char *p, int p_max_size)
|
|||||||
long long bytes;
|
long long bytes;
|
||||||
char unit[16]; // 16 because we can also have long names (like mega-bytes)
|
char unit[16]; // 16 because we can also have long names (like mega-bytes)
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, &info);
|
generate_text_internal(buf, max_user_text, *obj->sub);
|
||||||
if(sscanf(buf, "%lli%s", &bytes, unit) == 2 && strlen(unit) < 16){
|
if(sscanf(buf, "%lli%s", &bytes, unit) == 2 && strlen(unit) < 16){
|
||||||
if(strncasecmp("b", unit, 1) == 0) snprintf(buf, max_user_text, "%lli", bytes);
|
if(strncasecmp("b", unit, 1) == 0) snprintf(buf, max_user_text, "%lli", bytes);
|
||||||
else if(strncasecmp("k", unit, 1) == 0) snprintf(buf, max_user_text, "%lli", bytes * 1024);
|
else if(strncasecmp("k", unit, 1) == 0) snprintf(buf, max_user_text, "%lli", bytes * 1024);
|
||||||
@ -771,7 +766,7 @@ void print_blink(struct text_object *obj, char *p, int p_max_size)
|
|||||||
memset(buf, 0, max_user_text);
|
memset(buf, 0, max_user_text);
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, &info);
|
generate_text_internal(buf, max_user_text, *obj->sub);
|
||||||
last_len = strlen(buf);
|
last_len = strlen(buf);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < last_len; i++)
|
for (int i = 0; i < last_len; i++)
|
||||||
@ -789,7 +784,7 @@ void print_include(struct text_object *obj, char *p, int p_max_size)
|
|||||||
if (!obj->sub)
|
if (!obj->sub)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, &info);
|
generate_text_internal(buf, max_user_text, *obj->sub);
|
||||||
snprintf(p, p_max_size, "%s", buf);
|
snprintf(p, p_max_size, "%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
src/conky.c
19
src/conky.c
@ -689,10 +689,10 @@ static void extract_variable_text(const char *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void parse_conky_vars(struct text_object *root, const char *txt,
|
void parse_conky_vars(struct text_object *root, const char *txt,
|
||||||
char *p, int p_max_size, struct information *cur)
|
char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
extract_variable_text_internal(root, txt);
|
extract_variable_text_internal(root, txt);
|
||||||
generate_text_internal(p, p_max_size, *root, cur);
|
generate_text_internal(p, p_max_size, *root);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* substitutes all occurrences of '\n' with SECRIT_MULTILINE_CHAR, which allows
|
/* substitutes all occurrences of '\n' with SECRIT_MULTILINE_CHAR, which allows
|
||||||
@ -730,8 +730,7 @@ void substitute_newlines(char *p, long l)
|
|||||||
* so we need to jump always. If we encounter an ENDIF, it's corresponding IF
|
* so we need to jump always. If we encounter an ENDIF, it's corresponding IF
|
||||||
* or ELSE has not jumped, and there is nothing to do.
|
* or ELSE has not jumped, and there is nothing to do.
|
||||||
*/
|
*/
|
||||||
void generate_text_internal(char *p, int p_max_size,
|
void generate_text_internal(char *p, int p_max_size, struct text_object root)
|
||||||
struct text_object root, struct information *cur)
|
|
||||||
{
|
{
|
||||||
struct text_object *obj;
|
struct text_object *obj;
|
||||||
size_t a;
|
size_t a;
|
||||||
@ -740,9 +739,6 @@ void generate_text_internal(char *p, int p_max_size,
|
|||||||
buff_in[0] = 0;
|
buff_in[0] = 0;
|
||||||
#endif /* HAVE_ICONV */
|
#endif /* HAVE_ICONV */
|
||||||
|
|
||||||
/* \o/ */
|
|
||||||
(void)cur;
|
|
||||||
|
|
||||||
p[0] = 0;
|
p[0] = 0;
|
||||||
obj = root.next;
|
obj = root.next;
|
||||||
while (obj && p_max_size > 0) {
|
while (obj && p_max_size > 0) {
|
||||||
@ -786,23 +782,18 @@ void generate_text_internal(char *p, int p_max_size,
|
|||||||
|
|
||||||
void evaluate(const char *text, char *p, int p_max_size)
|
void evaluate(const char *text, char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
struct information *tmp_info;
|
|
||||||
struct text_object subroot;
|
struct text_object subroot;
|
||||||
|
|
||||||
tmp_info = malloc(sizeof(struct information));
|
parse_conky_vars(&subroot, text, p, p_max_size);
|
||||||
memcpy(tmp_info, &info, sizeof(struct information));
|
|
||||||
parse_conky_vars(&subroot, text, p, p_max_size, tmp_info);
|
|
||||||
DBGP("evaluated '%s' to '%s'", text, p);
|
DBGP("evaluated '%s' to '%s'", text, p);
|
||||||
|
|
||||||
free_text_objects(&subroot, 1);
|
free_text_objects(&subroot, 1);
|
||||||
free(tmp_info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double current_update_time, next_update_time, last_update_time;
|
double current_update_time, next_update_time, last_update_time;
|
||||||
|
|
||||||
static void generate_text(void)
|
static void generate_text(void)
|
||||||
{
|
{
|
||||||
struct information *cur = &info;
|
|
||||||
char *p;
|
char *p;
|
||||||
unsigned int i, j, k;
|
unsigned int i, j, k;
|
||||||
|
|
||||||
@ -820,7 +811,7 @@ static void generate_text(void)
|
|||||||
|
|
||||||
p = text_buffer;
|
p = text_buffer;
|
||||||
|
|
||||||
generate_text_internal(p, max_user_text, global_root_object, cur);
|
generate_text_internal(p, max_user_text, global_root_object);
|
||||||
if(max_text_width > 0) {
|
if(max_text_width > 0) {
|
||||||
for(i = 0, j = 0; p[i] != 0; i++) {
|
for(i = 0, j = 0; p[i] != 0; i++) {
|
||||||
if(p[i] == '\n') j = 0;
|
if(p[i] == '\n') j = 0;
|
||||||
|
@ -355,9 +355,7 @@ void set_update_interval(double interval);
|
|||||||
#define UNUSED(a) (void)a
|
#define UNUSED(a) (void)a
|
||||||
#define UNUSED_ATTR __attribute__ ((unused))
|
#define UNUSED_ATTR __attribute__ ((unused))
|
||||||
|
|
||||||
void parse_conky_vars(struct text_object *, const char *,
|
void parse_conky_vars(struct text_object *, const char *, char *, int);
|
||||||
char *, int, struct information *);
|
|
||||||
|
|
||||||
void generate_text_internal(char *, int, struct text_object,
|
void generate_text_internal(char *, int, struct text_object);
|
||||||
struct information *);
|
|
||||||
#endif /* _conky_h_ */
|
#endif /* _conky_h_ */
|
||||||
|
14
src/exec.c
14
src/exec.c
@ -278,7 +278,6 @@ void print_exec(struct text_object *obj, char *p, int p_max_size)
|
|||||||
|
|
||||||
void print_execp(struct text_object *obj, char *p, int p_max_size)
|
void print_execp(struct text_object *obj, char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
struct information *tmp_info;
|
|
||||||
struct text_object subroot;
|
struct text_object subroot;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
@ -286,13 +285,9 @@ void print_execp(struct text_object *obj, char *p, int p_max_size)
|
|||||||
memset(buf, 0, text_buffer_size);
|
memset(buf, 0, text_buffer_size);
|
||||||
|
|
||||||
read_exec(obj->data.s, buf, text_buffer_size);
|
read_exec(obj->data.s, buf, text_buffer_size);
|
||||||
|
parse_conky_vars(&subroot, buf, p, p_max_size);
|
||||||
tmp_info = malloc(sizeof(struct information));
|
|
||||||
memcpy(tmp_info, &info, sizeof(struct information));
|
|
||||||
parse_conky_vars(&subroot, buf, p, p_max_size, tmp_info);
|
|
||||||
|
|
||||||
free_text_objects(&subroot, 1);
|
free_text_objects(&subroot, 1);
|
||||||
free(tmp_info);
|
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,14 +311,10 @@ void print_execpi(struct text_object *obj, char *p, int p_max_size)
|
|||||||
{
|
{
|
||||||
struct execi_data *ed = obj->data.opaque;
|
struct execi_data *ed = obj->data.opaque;
|
||||||
struct text_object subroot;
|
struct text_object subroot;
|
||||||
struct information *tmp_info;
|
|
||||||
|
|
||||||
if (!ed)
|
if (!ed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tmp_info = malloc(sizeof(struct information));
|
|
||||||
memcpy(tmp_info, &info, sizeof(struct information));
|
|
||||||
|
|
||||||
if (time_to_update(ed)) {
|
if (time_to_update(ed)) {
|
||||||
if (!ed->buffer)
|
if (!ed->buffer)
|
||||||
ed->buffer = malloc(text_buffer_size);
|
ed->buffer = malloc(text_buffer_size);
|
||||||
@ -331,9 +322,8 @@ void print_execpi(struct text_object *obj, char *p, int p_max_size)
|
|||||||
read_exec(ed->cmd, ed->buffer, text_buffer_size);
|
read_exec(ed->cmd, ed->buffer, text_buffer_size);
|
||||||
ed->last_update = current_update_time;
|
ed->last_update = current_update_time;
|
||||||
}
|
}
|
||||||
parse_conky_vars(&subroot, ed->buffer, p, p_max_size, tmp_info);
|
parse_conky_vars(&subroot, ed->buffer, p, p_max_size);
|
||||||
free_text_objects(&subroot, 1);
|
free_text_objects(&subroot, 1);
|
||||||
free(tmp_info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_texeci(struct text_object *obj, char *p, int p_max_size)
|
void print_texeci(struct text_object *obj, char *p, int p_max_size)
|
||||||
|
64
src/proc.c
64
src/proc.c
@ -114,7 +114,7 @@ void print_pid_chroot(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char buf[max_user_text];
|
char buf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, &info);
|
generate_text_internal(buf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/root", buf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/root", buf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size)
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
if(*(objbuf) != 0) {
|
if(*(objbuf) != 0) {
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/cmdline", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/cmdline", objbuf);
|
||||||
@ -152,7 +152,7 @@ void print_pid_cwd(struct text_object *obj, char *p, int p_max_size)
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/cwd", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/cwd", objbuf);
|
||||||
bytes_read = readlink(pathbuf, buf, p_max_size);
|
bytes_read = readlink(pathbuf, buf, p_max_size);
|
||||||
if(bytes_read != -1) {
|
if(bytes_read != -1) {
|
||||||
@ -171,7 +171,7 @@ void print_pid_environ(struct text_object *obj, char *p, int p_max_size)
|
|||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
char *buf, *var=strdup(obj->data.s);;
|
char *buf, *var=strdup(obj->data.s);;
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
if(sscanf(objbuf, "%d %s", &pid, var) == 2) {
|
if(sscanf(objbuf, "%d %s", &pid, var) == 2) {
|
||||||
for(i = 0; var[i] != 0; i++) {
|
for(i = 0; var[i] != 0; i++) {
|
||||||
var[i] = toupper(var[i]);
|
var[i] = toupper(var[i]);
|
||||||
@ -203,7 +203,7 @@ void print_pid_environ_list(struct text_object *obj, char *p, int p_max_size)
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/environ", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/environ", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &total_read, 1);
|
buf = readfile(pathbuf, &total_read, 1);
|
||||||
@ -225,7 +225,7 @@ void print_pid_exe(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/exe", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/exe", objbuf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ void print_pid_nice(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
if(*(obj->data.s) != 0) {
|
if(*(obj->data.s) != 0) {
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
@ -261,7 +261,7 @@ void print_pid_openfiles(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
struct ll_string* files_back = NULL;
|
struct ll_string* files_back = NULL;
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
dir = opendir(objbuf);
|
dir = opendir(objbuf);
|
||||||
if(dir != NULL) {
|
if(dir != NULL) {
|
||||||
@ -296,7 +296,7 @@ void print_pid_parent(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -323,7 +323,7 @@ void print_pid_priority(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
if(*(objbuf) != 0) {
|
if(*(objbuf) != 0) {
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
@ -346,7 +346,7 @@ void print_pid_state(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -372,7 +372,7 @@ void print_pid_state_short(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
@ -392,7 +392,7 @@ void print_pid_stderr(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/fd/2", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/fd/2", objbuf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
@ -402,7 +402,7 @@ void print_pid_stdin(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/fd/0", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/fd/0", objbuf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
@ -412,7 +412,7 @@ void print_pid_stdout(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/fd/1", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/fd/1", objbuf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
@ -423,7 +423,7 @@ void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, void* fre
|
|||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
if(strlen(arg) > 0) {
|
if(strlen(arg) > 0) {
|
||||||
obj->data.s = strdup(arg);
|
obj->data.s = strdup(arg);
|
||||||
@ -480,7 +480,7 @@ void print_pid_threads(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -507,7 +507,7 @@ void print_pid_thread_list(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/task", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/task", objbuf);
|
||||||
|
|
||||||
dir = opendir(pathbuf);
|
dir = opendir(pathbuf);
|
||||||
@ -532,7 +532,7 @@ void print_pid_time_kernelmode(struct text_object *obj, char *p, int p_max_size)
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
if(*(objbuf) != 0) {
|
if(*(objbuf) != 0) {
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
@ -554,7 +554,7 @@ void print_pid_time_usermode(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
if(*(objbuf) != 0) {
|
if(*(objbuf) != 0) {
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
@ -576,7 +576,7 @@ void print_pid_time(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
if(*(objbuf) != 0) {
|
if(*(objbuf) != 0) {
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
@ -599,7 +599,7 @@ void print_pid_uid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -626,7 +626,7 @@ void print_pid_euid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -654,7 +654,7 @@ void print_pid_suid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -683,7 +683,7 @@ void print_pid_fsuid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -714,7 +714,7 @@ void print_pid_gid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -741,7 +741,7 @@ void print_pid_egid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -769,7 +769,7 @@ void print_pid_sgid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -798,7 +798,7 @@ void print_pid_fsgid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -827,7 +827,7 @@ void internal_print_pid_vm(struct text_object *obj, char *p, int p_max_size, con
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -898,7 +898,7 @@ void print_pid_read(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/io", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/io", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
@ -925,7 +925,7 @@ void print_pid_write(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/io", objbuf);
|
snprintf(pathbuf, 64, PROCDIR "/%s/io", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
|
@ -88,7 +88,7 @@ void print_scroll(struct text_object *obj, char *p, int p_max_size)
|
|||||||
if (!sd)
|
if (!sd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, &info);
|
generate_text_internal(buf, max_user_text, *obj->sub);
|
||||||
for(j = 0; buf[j] != 0; j++) {
|
for(j = 0; buf[j] != 0; j++) {
|
||||||
switch(buf[j]) {
|
switch(buf[j]) {
|
||||||
case '\n': //place all the lines behind each other with LINESEPARATOR between them
|
case '\n': //place all the lines behind each other with LINESEPARATOR between them
|
||||||
|
@ -310,7 +310,7 @@ void print_format_time(struct text_object *obj, char *p, int p_max_size)
|
|||||||
{
|
{
|
||||||
char buf[max_user_text];
|
char buf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, &info);
|
generate_text_internal(buf, max_user_text, *obj->sub);
|
||||||
obj->data.s = buf;
|
obj->data.s = buf;
|
||||||
do_format_time(obj, p, p_max_size);
|
do_format_time(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ void print_uid_name(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char* firstinvalid;
|
char* firstinvalid;
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
uid = strtol(objbuf, &firstinvalid, 10);
|
uid = strtol(objbuf, &firstinvalid, 10);
|
||||||
@ -62,7 +62,7 @@ void print_gid_name(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char* firstinvalid;
|
char* firstinvalid;
|
||||||
char objbuf[max_user_text];
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
generate_text_internal(objbuf, max_user_text, *obj->sub);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
gid = strtol(objbuf, &firstinvalid, 10);
|
gid = strtol(objbuf, &firstinvalid, 10);
|
||||||
|
Loading…
Reference in New Issue
Block a user