#include <string.h>#include <stdio.h>#include "lininfo.h"#include <sys/types.h>#include <dirent.h>#include <glib.h>#include <pthread.h>#include <gtk/gtk.h>Go to the source code of this file.
Functions | |
| void | set_tooltiptext (GtkWidget *object, gchar *str) |
| char * | trim (char *str) |
| char * | rtrim (char *str) |
| int | skip_lines (char *contents, int num_lines) |
| void | find_data_for (char *pattern, char *member, const char *contents) |
| void | lkmonitor_exit () |
| performs collector cancellation | |
Variables | |
| pthread_t | thread_id |
|
||||||||||||||||
|
Main parse function. This function actually parses the contents of procfs files and tokenize elements to offer clean data.
Definition at line 110 of file others.c. References rtrim(). 00111 {
00112
00113 g_assert(pattern!=NULL && member!=NULL && contents!=NULL);
00114
00115 char p[25];
00116 char* line;
00117
00118 sscanf(pattern,"%[^\t:]",p);
00119 //p has the name of the attribute (model, model name...)
00120 strcpy(p,rtrim(p));
00121 if((line=strstr(contents,p))==NULL){
00122 strcpy(member,"Unknown");
00123 return;
00124 }//Position in the correct line
00125
00126 sscanf(line, pattern,member);
00127
00128 }
|
|
|
performs collector cancellation Stops collector thread and runs outside event loop Definition at line 132 of file others.c. References thread_id. Referenced by on_fixed1_destroy(), on_quit1_activate(), and on_window1_destroy(). 00133 {
00134 if(pthread_cancel(thread_id)!=0)
00135 g_warning("Can't cancel collector thread!");
00136
00137 gtk_main_quit();
00138 }
|
|
|
Deletes blanks from the end of string
Definition at line 62 of file others.c. 00063 {
00064 g_assert(str!=NULL);
00065
00066 char* p;
00067 if((p=rindex(str,' '))==NULL)
00068 return(str);
00069 while(p>str){
00070 if(*p==' '){
00071 *p='\0';
00072 p--;
00073 }
00074 else return(str);
00075 }
00076 return(str);//For gcc warning
00077 }
|
|
||||||||||||
|
Definition at line 36 of file others.c. 00037 {
00038 g_assert(object!=NULL && str!=NULL);
00039
00040 GtkTooltips *gtt;
00041
00042 gtt=gtk_tooltips_new();
00043 gtk_tooltips_set_tip(gtt,object,str,NULL);
00044
00045 }
|
|
||||||||||||
|
Delete initial lines form string
Definition at line 86 of file others.c. 00087 {
00088 g_assert(contents!=NULL && num_lines>=0);
00089
00090 int i, c;
00091
00092 for (i = 0; i < num_lines; c++)
00093 if (*contents=='\n'){
00094 i++;
00095 }else{
00096 contents++;
00097 }
00098
00099 return (0);
00100 }
|
|
|
Deletes blanks from the begining of string
Definition at line 52 of file others.c. 00053 {
00054 return (str + strspn (str, " "));
00055 }
|
|
|
Definition at line 53 of file main.c. Referenced by lkmonitor_exit(), and main(). |
1.3.9.1