summaryrefslogtreecommitdiff
blob: 08067d7a0571461640dd21e5ac358930ae829777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
sniped from Fedora

http://bugs.gentoo.org/214171

--- acpitool-0.4.7/src/cpu.cpp.gcc43
+++ acpitool-0.4.7/src/cpu.cpp
@@ -27,6 +27,8 @@
 #include <config.h>
 #endif
 
+#include <cstdlib>
+#include <cstring>
 #include <iostream>
 #include <iomanip>
 #include <fstream>
@@ -57,7 +59,7 @@ int Show_CPU_Info()
 	{
 		for(int t=0; t<4; t++) fgets(str, 299, cpuinfo_fp);          // skip 4 lines //
 		fgets(str, 299, cpuinfo_fp);
-		bzero(temp, 130);				      // use sscanf to extract what we need :  //
+		memset(temp, '\0', 130);				      // use sscanf to extract what we need :  //
 		sscanf(str, "%*[^:] %*s %[^\n]",temp);                // ignore all up till :,  then ignore the :, then use what's left //
 		printf("  CPU type               : %s \n", temp);     // till the newline char //
 		fgets(str, 299, cpuinfo_fp);           
@@ -67,13 +69,13 @@ int Show_CPU_Info()
 		    Show_Freq_Info();          // show freq scaling info if we have it //
 		else
 		{
-		    bzero(temp, 130);           
+		    memset(temp, '\0', 130);           
 		    sscanf(str, "%*[^:] %*s %s",temp);                    // ignore all up till :,  then ignore the :, then use what's left //
 		    printf("  CPU speed              : %s MHz \n", temp);
 		}
 		
 		fgets(str, 299, cpuinfo_fp);
-		bzero(temp, 130);
+		memset(temp, '\0', 130);
 		sscanf(str, "%*[^:] %*s %s",temp);  
 		printf("  Cache size             : %s KB\n", temp);
 		
@@ -82,7 +84,7 @@ int Show_CPU_Info()
 		while(!feof(cpuinfo_fp))                      // Run loop until Bogomips line is found //
 		{                                             // Need this generic aproach: the bogomips location is //
 		    fgets(str, 299, cpuinfo_fp);              // different for Amd64, Opteron, Core Duo, P4 with Ht, ... //
-		    bzero(temp, 130);
+		    memset(temp, '\0', 130);
 		    if(strncmp(str,"bogo",4)==0)
 		    {
 			sscanf(str, "%*[^:] %*s %s",temp);  
@@ -153,23 +155,23 @@ int Show_CPU_Info()
 			if(file_in)                   
 			{
 				file_in.getline(str, 90); // processor id
-				bzero(temp, 130);
+				memset(temp, '\0', 130);
 				strncpy(temp, str+25, 5);
 				cout<<"  Processor ID           : "<<temp<<endl;
 
 				file_in.getline(str, 100); // acpi id
 				file_in.getline(str, 100); // bus mastering control
-				bzero(temp, 130);
+				memset(temp, '\0', 130);
 				strncpy(temp, str+25, 5);
 				cout<<"  Bus mastering control  : "<<temp<<endl;
 
 				file_in.getline(str, 100); // power management
-				bzero(temp, 130);
+				memset(temp, '\0', 130);
 				strncpy(temp, str+25, 5);
 				cout<<"  Power management       : "<<temp<<endl;
 
 				file_in.getline(str, 100); // throttling control
-				bzero(temp, 130);
+				memset(temp, '\0', 130);
 				strncpy(temp, str+25, 5);
 				cout<<"  Throttling control     : "<<temp<<endl;
 				if(strncmp(temp,"yes",3)==0)
@@ -177,7 +179,7 @@ int Show_CPU_Info()
 
 				file_in.getline(str, 100);	// limit interface (beware: on linux2.4
 											// this line yields "perf mgmt")
-				bzero(temp, 130);
+				memset(temp, '\0', 130);
 				strncpy(temp, str+25, 5);
 				cout<<"  Limit interface        : "<<temp<<endl;
 
@@ -196,7 +198,7 @@ int Show_CPU_Info()
 			if(power_fp)                   
 			{
 				fgets(str, 100, power_fp); // active state
-				bzero(temp, 80);
+				memset(temp, '\0', 80);
 				strncpy(temp, str+25, 5);
 				cout<<"  Active C-state         : "<<temp;
 
@@ -268,11 +270,11 @@ int Show_CPU_Info()
 				if(throt_fp)                   
 				{
 				    fgets(str, 100, throt_fp); // active state
-				    bzero(temp, 80);
+				    memset(temp, '\0', 80);
 				    strncpy(temp, str+25, 5);
 				    cout<<"  T-state count          : "<<temp;	// number of throttling states //
 				    fgets(str, 100, throt_fp);
-				    bzero(temp, 80);
+				    memset(temp, '\0', 80);
 				    strncpy(temp, str+25, 5);
 				    cout<<"  Active T-state         : "<<temp<<endl;
 				    fclose(throt_fp);
--- acpitool-0.4.7/src/main.cpp.gcc43
+++ acpitool-0.4.7/src/main.cpp
@@ -27,6 +27,7 @@
 #include <config.h>
 #endif
 
+#include <cstdlib>
 #include <iostream>
 #include <iomanip>
 #include <fstream>
--- acpitool-0.4.7/src/toshiba.cpp.gcc43
+++ acpitool-0.4.7/src/toshiba.cpp
@@ -28,6 +28,7 @@
 #include <config.h>
 #endif
 
+#include <cstring>
 #include <iostream>
 #include <iomanip>
 #include <fstream>
--- acpitool-0.4.7/src/battery.cpp.gcc43
+++ acpitool-0.4.7/src/battery.cpp
@@ -27,6 +27,8 @@
 #include <config.h>
 #endif
 
+#include <cstdlib>
+#include <cstring>
 #include <iostream>
 #include <iomanip>
 #include <fstream>
@@ -69,15 +71,15 @@ int Do_Battery_Stuff(int show_empty, int
 	    Batt_Info[i] = new Battery_Info;
 	    		
 	    Batt_Info[i]->Battery_Present = 0;
-	    bzero(Batt_Info[i]->Remaining_Cap, 10);
-	    bzero(Batt_Info[i]->Design_Cap, 10);
-	    bzero(Batt_Info[i]->LastFull_Cap, 10);
-	    bzero(Batt_Info[i]->Present_Rate, 10);
-	    bzero(Batt_Info[i]->Charging_State, 12);
-	    bzero(Batt_Info[i]->Technology, 13);
-	    bzero(Batt_Info[i]->Model, 13);
-	    bzero(Batt_Info[i]->Serial, 13);
-	    bzero(Batt_Info[i]->Bat_Type, 13); 
+	    memset(Batt_Info[i]->Remaining_Cap, '\0', 10);
+	    memset(Batt_Info[i]->Design_Cap, '\0', 10);
+	    memset(Batt_Info[i]->LastFull_Cap, '\0', 10);
+	    memset(Batt_Info[i]->Present_Rate, '\0', 10);
+	    memset(Batt_Info[i]->Charging_State, '\0', 12);
+	    memset(Batt_Info[i]->Technology, '\0', 13);
+	    memset(Batt_Info[i]->Model, '\0', 13);
+	    memset(Batt_Info[i]->Serial, '\0', 13);
+	    memset(Batt_Info[i]->Bat_Type, '\0', 13); 
 	    // initialize all struct members to blanks --> avoid rubbish in output //
 			
 	    Get_Battery_Info(Bat_Nr, Batt_Info[i], verbose);
--- acpitool-0.4.7/src/thinkpad.cpp.gcc43
+++ acpitool-0.4.7/src/thinkpad.cpp
@@ -1,5 +1,7 @@
 /* support for IBM Thinkpad acpi driver */
 
+#include <cstdlib>
+#include <cstring>
 #include <iomanip>
 #include <iostream>
 #include <fstream>
--- acpitool-0.4.7/src/freq.cpp.gcc43
+++ acpitool-0.4.7/src/freq.cpp
@@ -27,6 +27,8 @@
 #include <config.h>
 #endif
 
+#include <cstdlib>
+#include <cstring>
 #include <iostream>
 #include <iomanip>
 #include <fstream>
@@ -86,7 +88,7 @@ int Get_Min_Freq()
 
 	if(freqinfo_fp)                   
 	{
-		bzero(str, 300);
+		memset(str, '\0', 300);
 		fscanf(freqinfo_fp, "%s", str);
 		min_freq = atoi(str);
 		fclose(freqinfo_fp);
@@ -110,7 +112,7 @@ int Get_Max_Freq()
 
 	if(freqinfo_fp)                   
 	{
-		bzero(str, 300);
+		memset(str, '\0', 300);
 		fscanf(freqinfo_fp, "%s", str);
 		max_freq = atoi(str);
 		fclose(freqinfo_fp);
@@ -133,7 +135,7 @@ int Get_Current_Freq()
 
 	if(freqinfo_fp)                   
 	{
-		bzero(str, 300);
+		memset(str, '\0', 300);
 		fscanf(freqinfo_fp, "%s", str);
 		cur_freq = atoi(str);
 		fclose(freqinfo_fp);
@@ -155,7 +157,7 @@ int Get_Governor(char *c)
 
 	if(freqinfo_fp)                   
 	{
-		bzero(str, 300);
+		memset(str, '\0', 300);
 		fscanf(freqinfo_fp, "%s", str);
 		if (strlen(str)>0)
 		    strcpy(c, str);
@@ -178,7 +180,7 @@ int Get_Driver(char *c)
 
 	if(freqinfo_fp)                   
 	{
-		bzero(str, 300);
+		memset(str, '\0', 300);
 		fscanf(freqinfo_fp, "%s", str);
 		if (strlen(str)>0)
 		    strcpy(c, str);
--- acpitool-0.4.7/src/acpitool.cpp.gcc43
+++ acpitool-0.4.7/src/acpitool.cpp
@@ -28,6 +28,8 @@
 #include <config.h>
 #endif
 
+#include <cstring>
+#include <cstdlib>
 #include <iostream>
 #include <iomanip>
 #include <fstream>
@@ -158,8 +160,8 @@ int Do_SysVersion_Info(int verbose)
 {
     char Acpi_Version[10], Kernel_Version[15];
  
-    bzero(Acpi_Version, 10); 
-    bzero(Kernel_Version, 15);   
+    memset(Acpi_Version, '\0', 10); 
+    memset(Kernel_Version, '\0', 15);   
 
     Get_Kernel_Version(Kernel_Version, verbose);
     Get_ACPI_Version(Acpi_Version, verbose);
@@ -214,8 +216,8 @@ int Do_Thermal_Info(const int show_trip,
     char *name;
     char Temperature[5], State[5];
  
-    bzero(Temperature, 5);     
-    bzero(State, 5);
+    memset(Temperature, '\0', 5);     
+    memset(State, '\0', 5);
     
     dirname = "/proc/acpi/thermal_zone/";   
     thermal_dir = opendir(dirname);
@@ -299,7 +301,7 @@ int Do_Thermal_Info(const int show_trip,
 		    while(!feof(fp))
 		    {
 			/* fscanf(fp, "%s", str); */
-			bzero(str, 120);
+			memset(str, '\0', 120);
 			fgets(str, 120, fp);
 			if (strlen(str)!=0)  
 			  cout<<"  "<<str;       /* avoid printing empty line */
@@ -328,7 +330,7 @@ int Do_AC_Info(int verbose)
     char *name;
     char AC_Status[9];
  
-    bzero(AC_Status, 9);         // avoid rubbish in output //
+    memset(AC_Status, '\0', 9);         // avoid rubbish in output //
       
     dirname = "/proc/acpi/ac_adapter/";    
     ac_dir = opendir(dirname);
@@ -402,7 +404,7 @@ int Do_Fan_Info(int verbose)
 		return 0;
 	}
 
-	bzero(FAN_Status, 9);         // avoid rubbish in output //
+	memset(FAN_Status, '\0', 9);         // avoid rubbish in output //
 
 	dirname = "/proc/acpi/fan/";    
 	fan_dir = opendir(dirname);
@@ -531,7 +533,7 @@ int Toggle_WakeUp_Device(const int Devic
         file_in.getline(str, 50);
         if(strlen(str)!=0)                // avoid empty last line //
         {
-	    bzero(Name[index], 5);
+	    memset(Name[index], '\0', 5);
 	    strncpy(Name[index], str, 4);
 	    index++;
 	}