Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 214171
Collapse All | Expand All

(-)acpitool-0.4.7/src/cpu.cpp.gcc43 (-12 / +14 lines)
Lines 27-32 Link Here
27
#include <config.h>
27
#include <config.h>
28
#endif
28
#endif
29
29
30
#include <cstdlib>
31
#include <cstring>
30
#include <iostream>
32
#include <iostream>
31
#include <iomanip>
33
#include <iomanip>
32
#include <fstream>
34
#include <fstream>
Lines 57-63 int Show_CPU_Info() Link Here
57
	{
59
	{
58
		for(int t=0; t<4; t++) fgets(str, 299, cpuinfo_fp);          // skip 4 lines //
60
		for(int t=0; t<4; t++) fgets(str, 299, cpuinfo_fp);          // skip 4 lines //
59
		fgets(str, 299, cpuinfo_fp);
61
		fgets(str, 299, cpuinfo_fp);
60
		bzero(temp, 130);				      // use sscanf to extract what we need :  //
62
		memset(temp, '\0', 130);				      // use sscanf to extract what we need :  //
61
		sscanf(str, "%*[^:] %*s %[^\n]",temp);                // ignore all up till :,  then ignore the :, then use what's left //
63
		sscanf(str, "%*[^:] %*s %[^\n]",temp);                // ignore all up till :,  then ignore the :, then use what's left //
62
		printf("  CPU type               : %s \n", temp);     // till the newline char //
64
		printf("  CPU type               : %s \n", temp);     // till the newline char //
63
		fgets(str, 299, cpuinfo_fp);           
65
		fgets(str, 299, cpuinfo_fp);           
Lines 67-79 int Show_CPU_Info() Link Here
67
		    Show_Freq_Info();          // show freq scaling info if we have it //
69
		    Show_Freq_Info();          // show freq scaling info if we have it //
68
		else
70
		else
69
		{
71
		{
70
		    bzero(temp, 130);           
72
		    memset(temp, '\0', 130);           
71
		    sscanf(str, "%*[^:] %*s %s",temp);                    // ignore all up till :,  then ignore the :, then use what's left //
73
		    sscanf(str, "%*[^:] %*s %s",temp);                    // ignore all up till :,  then ignore the :, then use what's left //
72
		    printf("  CPU speed              : %s MHz \n", temp);
74
		    printf("  CPU speed              : %s MHz \n", temp);
73
		}
75
		}
74
		
76
		
75
		fgets(str, 299, cpuinfo_fp);
77
		fgets(str, 299, cpuinfo_fp);
76
		bzero(temp, 130);
78
		memset(temp, '\0', 130);
77
		sscanf(str, "%*[^:] %*s %s",temp);  
79
		sscanf(str, "%*[^:] %*s %s",temp);  
78
		printf("  Cache size             : %s KB\n", temp);
80
		printf("  Cache size             : %s KB\n", temp);
79
		
81
		
Lines 82-88 int Show_CPU_Info() Link Here
82
		while(!feof(cpuinfo_fp))                      // Run loop until Bogomips line is found //
84
		while(!feof(cpuinfo_fp))                      // Run loop until Bogomips line is found //
83
		{                                             // Need this generic aproach: the bogomips location is //
85
		{                                             // Need this generic aproach: the bogomips location is //
84
		    fgets(str, 299, cpuinfo_fp);              // different for Amd64, Opteron, Core Duo, P4 with Ht, ... //
86
		    fgets(str, 299, cpuinfo_fp);              // different for Amd64, Opteron, Core Duo, P4 with Ht, ... //
85
		    bzero(temp, 130);
87
		    memset(temp, '\0', 130);
86
		    if(strncmp(str,"bogo",4)==0)
88
		    if(strncmp(str,"bogo",4)==0)
87
		    {
89
		    {
88
			sscanf(str, "%*[^:] %*s %s",temp);  
90
			sscanf(str, "%*[^:] %*s %s",temp);  
Lines 153-175 int Show_CPU_Info() Link Here
153
			if(file_in)                   
155
			if(file_in)                   
154
			{
156
			{
155
				file_in.getline(str, 90); // processor id
157
				file_in.getline(str, 90); // processor id
156
				bzero(temp, 130);
158
				memset(temp, '\0', 130);
157
				strncpy(temp, str+25, 5);
159
				strncpy(temp, str+25, 5);
158
				cout<<"  Processor ID           : "<<temp<<endl;
160
				cout<<"  Processor ID           : "<<temp<<endl;
159
161
160
				file_in.getline(str, 100); // acpi id
162
				file_in.getline(str, 100); // acpi id
161
				file_in.getline(str, 100); // bus mastering control
163
				file_in.getline(str, 100); // bus mastering control
162
				bzero(temp, 130);
164
				memset(temp, '\0', 130);
163
				strncpy(temp, str+25, 5);
165
				strncpy(temp, str+25, 5);
164
				cout<<"  Bus mastering control  : "<<temp<<endl;
166
				cout<<"  Bus mastering control  : "<<temp<<endl;
165
167
166
				file_in.getline(str, 100); // power management
168
				file_in.getline(str, 100); // power management
167
				bzero(temp, 130);
169
				memset(temp, '\0', 130);
168
				strncpy(temp, str+25, 5);
170
				strncpy(temp, str+25, 5);
169
				cout<<"  Power management       : "<<temp<<endl;
171
				cout<<"  Power management       : "<<temp<<endl;
170
172
171
				file_in.getline(str, 100); // throttling control
173
				file_in.getline(str, 100); // throttling control
172
				bzero(temp, 130);
174
				memset(temp, '\0', 130);
173
				strncpy(temp, str+25, 5);
175
				strncpy(temp, str+25, 5);
174
				cout<<"  Throttling control     : "<<temp<<endl;
176
				cout<<"  Throttling control     : "<<temp<<endl;
175
				if(strncmp(temp,"yes",3)==0)
177
				if(strncmp(temp,"yes",3)==0)
Lines 177-183 int Show_CPU_Info() Link Here
177
179
178
				file_in.getline(str, 100);	// limit interface (beware: on linux2.4
180
				file_in.getline(str, 100);	// limit interface (beware: on linux2.4
179
											// this line yields "perf mgmt")
181
											// this line yields "perf mgmt")
180
				bzero(temp, 130);
182
				memset(temp, '\0', 130);
181
				strncpy(temp, str+25, 5);
183
				strncpy(temp, str+25, 5);
182
				cout<<"  Limit interface        : "<<temp<<endl;
184
				cout<<"  Limit interface        : "<<temp<<endl;
183
185
Lines 196-202 int Show_CPU_Info() Link Here
196
			if(power_fp)                   
198
			if(power_fp)                   
197
			{
199
			{
198
				fgets(str, 100, power_fp); // active state
200
				fgets(str, 100, power_fp); // active state
199
				bzero(temp, 80);
201
				memset(temp, '\0', 80);
200
				strncpy(temp, str+25, 5);
202
				strncpy(temp, str+25, 5);
201
				cout<<"  Active C-state         : "<<temp;
203
				cout<<"  Active C-state         : "<<temp;
202
204
Lines 268-278 int Show_CPU_Info() Link Here
268
				if(throt_fp)                   
270
				if(throt_fp)                   
269
				{
271
				{
270
				    fgets(str, 100, throt_fp); // active state
272
				    fgets(str, 100, throt_fp); // active state
271
				    bzero(temp, 80);
273
				    memset(temp, '\0', 80);
272
				    strncpy(temp, str+25, 5);
274
				    strncpy(temp, str+25, 5);
273
				    cout<<"  T-state count          : "<<temp;	// number of throttling states //
275
				    cout<<"  T-state count          : "<<temp;	// number of throttling states //
274
				    fgets(str, 100, throt_fp);
276
				    fgets(str, 100, throt_fp);
275
				    bzero(temp, 80);
277
				    memset(temp, '\0', 80);
276
				    strncpy(temp, str+25, 5);
278
				    strncpy(temp, str+25, 5);
277
				    cout<<"  Active T-state         : "<<temp<<endl;
279
				    cout<<"  Active T-state         : "<<temp<<endl;
278
				    fclose(throt_fp);
280
				    fclose(throt_fp);
(-)acpitool-0.4.7/src/main.cpp.gcc43 (+1 lines)
Lines 27-32 Link Here
27
#include <config.h>
27
#include <config.h>
28
#endif
28
#endif
29
29
30
#include <cstdlib>
30
#include <iostream>
31
#include <iostream>
31
#include <iomanip>
32
#include <iomanip>
32
#include <fstream>
33
#include <fstream>
(-)acpitool-0.4.7/src/toshiba.cpp.gcc43 (+1 lines)
Lines 28-33 Link Here
28
#include <config.h>
28
#include <config.h>
29
#endif
29
#endif
30
30
31
#include <cstring>
31
#include <iostream>
32
#include <iostream>
32
#include <iomanip>
33
#include <iomanip>
33
#include <fstream>
34
#include <fstream>
(-)acpitool-0.4.7/src/battery.cpp.gcc43 (-9 / +11 lines)
Lines 27-32 Link Here
27
#include <config.h>
27
#include <config.h>
28
#endif
28
#endif
29
29
30
#include <cstdlib>
31
#include <cstring>
30
#include <iostream>
32
#include <iostream>
31
#include <iomanip>
33
#include <iomanip>
32
#include <fstream>
34
#include <fstream>
Lines 69-83 int Do_Battery_Stuff(int show_empty, int Link Here
69
	    Batt_Info[i] = new Battery_Info;
71
	    Batt_Info[i] = new Battery_Info;
70
	    		
72
	    		
71
	    Batt_Info[i]->Battery_Present = 0;
73
	    Batt_Info[i]->Battery_Present = 0;
72
	    bzero(Batt_Info[i]->Remaining_Cap, 10);
74
	    memset(Batt_Info[i]->Remaining_Cap, '\0', 10);
73
	    bzero(Batt_Info[i]->Design_Cap, 10);
75
	    memset(Batt_Info[i]->Design_Cap, '\0', 10);
74
	    bzero(Batt_Info[i]->LastFull_Cap, 10);
76
	    memset(Batt_Info[i]->LastFull_Cap, '\0', 10);
75
	    bzero(Batt_Info[i]->Present_Rate, 10);
77
	    memset(Batt_Info[i]->Present_Rate, '\0', 10);
76
	    bzero(Batt_Info[i]->Charging_State, 12);
78
	    memset(Batt_Info[i]->Charging_State, '\0', 12);
77
	    bzero(Batt_Info[i]->Technology, 13);
79
	    memset(Batt_Info[i]->Technology, '\0', 13);
78
	    bzero(Batt_Info[i]->Model, 13);
80
	    memset(Batt_Info[i]->Model, '\0', 13);
79
	    bzero(Batt_Info[i]->Serial, 13);
81
	    memset(Batt_Info[i]->Serial, '\0', 13);
80
	    bzero(Batt_Info[i]->Bat_Type, 13); 
82
	    memset(Batt_Info[i]->Bat_Type, '\0', 13); 
81
	    // initialize all struct members to blanks --> avoid rubbish in output //
83
	    // initialize all struct members to blanks --> avoid rubbish in output //
82
			
84
			
83
	    Get_Battery_Info(Bat_Nr, Batt_Info[i], verbose);
85
	    Get_Battery_Info(Bat_Nr, Batt_Info[i], verbose);
(-)acpitool-0.4.7/src/thinkpad.cpp.gcc43 (+2 lines)
Lines 1-5 Link Here
1
/* support for IBM Thinkpad acpi driver */
1
/* support for IBM Thinkpad acpi driver */
2
2
3
#include <cstdlib>
4
#include <cstring>
3
#include <iomanip>
5
#include <iomanip>
4
#include <iostream>
6
#include <iostream>
5
#include <fstream>
7
#include <fstream>
(-)acpitool-0.4.7/src/freq.cpp.gcc43 (-5 / +7 lines)
Lines 27-32 Link Here
27
#include <config.h>
27
#include <config.h>
28
#endif
28
#endif
29
29
30
#include <cstdlib>
31
#include <cstring>
30
#include <iostream>
32
#include <iostream>
31
#include <iomanip>
33
#include <iomanip>
32
#include <fstream>
34
#include <fstream>
Lines 86-92 int Get_Min_Freq() Link Here
86
88
87
	if(freqinfo_fp)                   
89
	if(freqinfo_fp)                   
88
	{
90
	{
89
		bzero(str, 300);
91
		memset(str, '\0', 300);
90
		fscanf(freqinfo_fp, "%s", str);
92
		fscanf(freqinfo_fp, "%s", str);
91
		min_freq = atoi(str);
93
		min_freq = atoi(str);
92
		fclose(freqinfo_fp);
94
		fclose(freqinfo_fp);
Lines 110-116 int Get_Max_Freq() Link Here
110
112
111
	if(freqinfo_fp)                   
113
	if(freqinfo_fp)                   
112
	{
114
	{
113
		bzero(str, 300);
115
		memset(str, '\0', 300);
114
		fscanf(freqinfo_fp, "%s", str);
116
		fscanf(freqinfo_fp, "%s", str);
115
		max_freq = atoi(str);
117
		max_freq = atoi(str);
116
		fclose(freqinfo_fp);
118
		fclose(freqinfo_fp);
Lines 133-139 int Get_Current_Freq() Link Here
133
135
134
	if(freqinfo_fp)                   
136
	if(freqinfo_fp)                   
135
	{
137
	{
136
		bzero(str, 300);
138
		memset(str, '\0', 300);
137
		fscanf(freqinfo_fp, "%s", str);
139
		fscanf(freqinfo_fp, "%s", str);
138
		cur_freq = atoi(str);
140
		cur_freq = atoi(str);
139
		fclose(freqinfo_fp);
141
		fclose(freqinfo_fp);
Lines 155-161 int Get_Governor(char *c) Link Here
155
157
156
	if(freqinfo_fp)                   
158
	if(freqinfo_fp)                   
157
	{
159
	{
158
		bzero(str, 300);
160
		memset(str, '\0', 300);
159
		fscanf(freqinfo_fp, "%s", str);
161
		fscanf(freqinfo_fp, "%s", str);
160
		if (strlen(str)>0)
162
		if (strlen(str)>0)
161
		    strcpy(c, str);
163
		    strcpy(c, str);
Lines 178-184 int Get_Driver(char *c) Link Here
178
180
179
	if(freqinfo_fp)                   
181
	if(freqinfo_fp)                   
180
	{
182
	{
181
		bzero(str, 300);
183
		memset(str, '\0', 300);
182
		fscanf(freqinfo_fp, "%s", str);
184
		fscanf(freqinfo_fp, "%s", str);
183
		if (strlen(str)>0)
185
		if (strlen(str)>0)
184
		    strcpy(c, str);
186
		    strcpy(c, str);
(-)acpitool-0.4.7/src/acpitool.cpp.gcc43 (-8 / +10 lines)
Lines 28-33 Link Here
28
#include <config.h>
28
#include <config.h>
29
#endif
29
#endif
30
30
31
#include <cstring>
32
#include <cstdlib>
31
#include <iostream>
33
#include <iostream>
32
#include <iomanip>
34
#include <iomanip>
33
#include <fstream>
35
#include <fstream>
Lines 158-165 int Do_SysVersion_Info(int verbose) Link Here
158
{
160
{
159
    char Acpi_Version[10], Kernel_Version[15];
161
    char Acpi_Version[10], Kernel_Version[15];
160
 
162
 
161
    bzero(Acpi_Version, 10); 
163
    memset(Acpi_Version, '\0', 10); 
162
    bzero(Kernel_Version, 15);   
164
    memset(Kernel_Version, '\0', 15);   
163
165
164
    Get_Kernel_Version(Kernel_Version, verbose);
166
    Get_Kernel_Version(Kernel_Version, verbose);
165
    Get_ACPI_Version(Acpi_Version, verbose);
167
    Get_ACPI_Version(Acpi_Version, verbose);
Lines 214-221 int Do_Thermal_Info(const int show_trip, Link Here
214
    char *name;
216
    char *name;
215
    char Temperature[5], State[5];
217
    char Temperature[5], State[5];
216
 
218
 
217
    bzero(Temperature, 5);     
219
    memset(Temperature, '\0', 5);     
218
    bzero(State, 5);
220
    memset(State, '\0', 5);
219
    
221
    
220
    dirname = "/proc/acpi/thermal_zone/";   
222
    dirname = "/proc/acpi/thermal_zone/";   
221
    thermal_dir = opendir(dirname);
223
    thermal_dir = opendir(dirname);
Lines 299-305 int Do_Thermal_Info(const int show_trip, Link Here
299
		    while(!feof(fp))
301
		    while(!feof(fp))
300
		    {
302
		    {
301
			/* fscanf(fp, "%s", str); */
303
			/* fscanf(fp, "%s", str); */
302
			bzero(str, 120);
304
			memset(str, '\0', 120);
303
			fgets(str, 120, fp);
305
			fgets(str, 120, fp);
304
			if (strlen(str)!=0)  
306
			if (strlen(str)!=0)  
305
			  cout<<"  "<<str;       /* avoid printing empty line */
307
			  cout<<"  "<<str;       /* avoid printing empty line */
Lines 328-334 int Do_AC_Info(int verbose) Link Here
328
    char *name;
330
    char *name;
329
    char AC_Status[9];
331
    char AC_Status[9];
330
 
332
 
331
    bzero(AC_Status, 9);         // avoid rubbish in output //
333
    memset(AC_Status, '\0', 9);         // avoid rubbish in output //
332
      
334
      
333
    dirname = "/proc/acpi/ac_adapter/";    
335
    dirname = "/proc/acpi/ac_adapter/";    
334
    ac_dir = opendir(dirname);
336
    ac_dir = opendir(dirname);
Lines 402-408 int Do_Fan_Info(int verbose) Link Here
402
		return 0;
404
		return 0;
403
	}
405
	}
404
406
405
	bzero(FAN_Status, 9);         // avoid rubbish in output //
407
	memset(FAN_Status, '\0', 9);         // avoid rubbish in output //
406
408
407
	dirname = "/proc/acpi/fan/";    
409
	dirname = "/proc/acpi/fan/";    
408
	fan_dir = opendir(dirname);
410
	fan_dir = opendir(dirname);
Lines 531-537 int Toggle_WakeUp_Device(const int Devic Link Here
531
        file_in.getline(str, 50);
533
        file_in.getline(str, 50);
532
        if(strlen(str)!=0)                // avoid empty last line //
534
        if(strlen(str)!=0)                // avoid empty last line //
533
        {
535
        {
534
	    bzero(Name[index], 5);
536
	    memset(Name[index], '\0', 5);
535
	    strncpy(Name[index], str, 4);
537
	    strncpy(Name[index], str, 4);
536
	    index++;
538
	    index++;
537
	}
539
	}

Return to bug 214171