patch-utils_info_c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. --- cpufrequtils-007.orig/utils/info.c 2010-01-16 14:47:44.000000000 +0100
  2. +++ cpufrequtils-007/utils/info.c 2010-01-23 18:51:50.165866845 +0100
  3. @@ -10,9 +10,6 @@
  4. #include <errno.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. -#include <libintl.h>
  8. -#include <locale.h>
  9. -
  10. #include <getopt.h>
  11. #include "cpufreq.h"
  12. @@ -33,7 +30,7 @@ static unsigned int count_cpus(void)
  13. fp = fopen("/proc/stat", "r");
  14. if(!fp) {
  15. - printf(gettext("Couldn't count the number of CPUs (%s: %s), assuming 1\n"), "/proc/stat", strerror(errno));
  16. + printf("Couldn't count the number of CPUs (%s: %s), assuming 1\n", "/proc/stat", strerror(errno));
  17. return 1;
  18. }
  19. @@ -65,7 +62,7 @@ static void proc_cpufreq_output(void)
  20. unsigned int max_pctg = 0;
  21. unsigned long min, max;
  22. - printf(gettext(" minimum CPU frequency - maximum CPU frequency - governor\n"));
  23. + printf(" minimum CPU frequency - maximum CPU frequency - governor\n");
  24. nr_cpus = count_cpus();
  25. for (cpu=0; cpu < nr_cpus; cpu++) {
  26. @@ -153,26 +150,26 @@ static void debug_output_one(unsigned in
  27. struct cpufreq_stats *stats;
  28. if (cpufreq_cpu_exists(cpu)) {
  29. - printf(gettext ("couldn't analyze CPU %d as it doesn't seem to be present\n"), cpu);
  30. + printf("couldn't analyze CPU %d as it doesn't seem to be present\n", cpu);
  31. return;
  32. }
  33. - printf(gettext ("analyzing CPU %d:\n"), cpu);
  34. + printf("analyzing CPU %d:\n", cpu);
  35. freq_kernel = cpufreq_get_freq_kernel(cpu);
  36. freq_hardware = cpufreq_get_freq_hardware(cpu);
  37. driver = cpufreq_get_driver(cpu);
  38. if (!driver) {
  39. - printf(gettext (" no or unknown cpufreq driver is active on this CPU\n"));
  40. + printf(" no or unknown cpufreq driver is active on this CPU\n");
  41. } else {
  42. - printf(gettext (" driver: %s\n"), driver);
  43. + printf(" driver: %s\n", driver);
  44. cpufreq_put_driver(driver);
  45. }
  46. cpus = cpufreq_get_related_cpus(cpu);
  47. if (cpus) {
  48. - printf(gettext (" CPUs which run at the same hardware frequency: "));
  49. + printf(" CPUs which run at the same hardware frequency: ");
  50. while (cpus->next) {
  51. printf("%d ", cpus->cpu);
  52. cpus = cpus->next;
  53. @@ -183,7 +180,7 @@ static void debug_output_one(unsigned in
  54. cpus = cpufreq_get_affected_cpus(cpu);
  55. if (cpus) {
  56. - printf(gettext (" CPUs which need to have their frequency coordinated by software: "));
  57. + printf(" CPUs which need to have their frequency coordinated by software: ");
  58. while (cpus->next) {
  59. printf("%d ", cpus->cpu);
  60. cpus = cpus->next;
  61. @@ -194,13 +191,13 @@ static void debug_output_one(unsigned in
  62. latency = cpufreq_get_transition_latency(cpu);
  63. if (latency) {
  64. - printf(gettext (" maximum transition latency: "));
  65. + printf(" maximum transition latency: ");
  66. print_duration(latency);
  67. printf(".\n");
  68. }
  69. if (!(cpufreq_get_hardware_limits(cpu, &min, &max))) {
  70. - printf(gettext (" hardware limits: "));
  71. + printf(" hardware limits: ");
  72. print_speed(min);
  73. printf(" - ");
  74. print_speed(max);
  75. @@ -209,7 +206,7 @@ static void debug_output_one(unsigned in
  76. freqs = cpufreq_get_available_frequencies(cpu);
  77. if (freqs) {
  78. - printf(gettext (" available frequency steps: "));
  79. + printf(" available frequency steps: ");
  80. while (freqs->next) {
  81. print_speed(freqs->frequency);
  82. printf(", ");
  83. @@ -222,7 +219,7 @@ static void debug_output_one(unsigned in
  84. governors = cpufreq_get_available_governors(cpu);
  85. if (governors) {
  86. - printf(gettext (" available cpufreq governors: "));
  87. + printf(" available cpufreq governors: ");
  88. while (governors->next) {
  89. printf("%s, ", governors->governor);
  90. governors = governors->next;
  91. @@ -233,23 +230,23 @@ static void debug_output_one(unsigned in
  92. policy = cpufreq_get_policy(cpu);
  93. if (policy) {
  94. - printf(gettext (" current policy: frequency should be within "));
  95. + printf(" current policy: frequency should be within ");
  96. print_speed(policy->min);
  97. - printf(gettext (" and "));
  98. + printf(" and ");
  99. print_speed(policy->max);
  100. printf(".\n ");
  101. - printf(gettext ("The governor \"%s\" may"
  102. - " decide which speed to use\n within this range.\n"),
  103. + printf("The governor \"%s\" may"
  104. + " decide which speed to use\n within this range.\n",
  105. policy->governor);
  106. cpufreq_put_policy(policy);
  107. }
  108. if (freq_kernel || freq_hardware) {
  109. - printf(gettext (" current CPU frequency is "));
  110. + printf(" current CPU frequency is ");
  111. if (freq_hardware) {
  112. print_speed(freq_hardware);
  113. - printf(gettext (" (asserted by call to hardware)"));
  114. + printf(" (asserted by call to hardware)");
  115. }
  116. else
  117. print_speed(freq_kernel);
  118. @@ -257,7 +254,7 @@ static void debug_output_one(unsigned in
  119. }
  120. stats = cpufreq_get_stats(cpu, &total_time);
  121. if (stats) {
  122. - printf(gettext (" cpufreq stats: "));
  123. + printf(" cpufreq stats: ");
  124. while (stats) {
  125. print_speed(stats->frequency);
  126. printf(":%.2f%%", (100.0 * stats->time_in_state) / total_time);
  127. @@ -437,37 +434,37 @@ static int get_latency(unsigned int cpu,
  128. static void print_header(void) {
  129. printf(PACKAGE " " VERSION ": cpufreq-info (C) Dominik Brodowski 2004-2009\n");
  130. - printf(gettext ("Report errors and bugs to %s, please.\n"), PACKAGE_BUGREPORT);
  131. + printf("Report errors and bugs to %s, please.\n", PACKAGE_BUGREPORT);
  132. }
  133. static void print_help(void) {
  134. - printf(gettext ("Usage: cpufreq-info [options]\n"));
  135. - printf(gettext ("Options:\n"));
  136. - printf(gettext (" -c CPU, --cpu CPU CPU number which information shall be determined about\n"));
  137. - printf(gettext (" -e, --debug Prints out debug information\n"));
  138. - printf(gettext (" -f, --freq Get frequency the CPU currently runs at, according\n"
  139. - " to the cpufreq core *\n"));
  140. - printf(gettext (" -w, --hwfreq Get frequency the CPU currently runs at, by reading\n"
  141. - " it from hardware (only available to root) *\n"));
  142. - printf(gettext (" -l, --hwlimits Determine the minimum and maximum CPU frequency allowed *\n"));
  143. - printf(gettext (" -d, --driver Determines the used cpufreq kernel driver *\n"));
  144. - printf(gettext (" -p, --policy Gets the currently used cpufreq policy *\n"));
  145. - printf(gettext (" -g, --governors Determines available cpufreq governors *\n"));
  146. - printf(gettext (" -r, --related-cpus Determines which CPUs run at the same hardware frequency *\n"));
  147. - printf(gettext (" -a, --affected-cpus Determines which CPUs need to have their frequency\n"
  148. - " coordinated by software *\n"));
  149. - printf(gettext (" -s, --stats Shows cpufreq statistics if available\n"));
  150. - printf(gettext (" -y, --latency Determines the maximum latency on CPU frequency changes *\n"));
  151. - printf(gettext (" -o, --proc Prints out information like provided by the /proc/cpufreq\n"
  152. - " interface in 2.4. and early 2.6. kernels\n"));
  153. - printf(gettext (" -m, --human human-readable output for the -f, -w, -s and -y parameters\n"));
  154. - printf(gettext (" -h, --help Prints out this screen\n"));
  155. + printf("Usage: cpufreq-info [options]\n");
  156. + printf("Options:\n");
  157. + printf(" -c CPU, --cpu CPU CPU number which information shall be determined about\n");
  158. + printf(" -e, --debug Prints out debug information\n");
  159. + printf(" -f, --freq Get frequency the CPU currently runs at, according\n"
  160. + " to the cpufreq core *\n");
  161. + printf(" -w, --hwfreq Get frequency the CPU currently runs at, by reading\n"
  162. + " it from hardware (only available to root) *\n");
  163. + printf(" -l, --hwlimits Determine the minimum and maximum CPU frequency allowed *\n");
  164. + printf(" -d, --driver Determines the used cpufreq kernel driver *\n");
  165. + printf(" -p, --policy Gets the currently used cpufreq policy *\n");
  166. + printf(" -g, --governors Determines available cpufreq governors *\n");
  167. + printf(" -r, --related-cpus Determines which CPUs run at the same hardware frequency *\n");
  168. + printf(" -a, --affected-cpus Determines which CPUs need to have their frequency\n"
  169. + " coordinated by software *\n");
  170. + printf(" -s, --stats Shows cpufreq statistics if available\n");
  171. + printf(" -y, --latency Determines the maximum latency on CPU frequency changes *\n");
  172. + printf(" -o, --proc Prints out information like provided by the /proc/cpufreq\n"
  173. + " interface in 2.4. and early 2.6. kernels\n");
  174. + printf(" -m, --human human-readable output for the -f, -w, -s and -y parameters\n");
  175. + printf(" -h, --help Prints out this screen\n");
  176. printf("\n");
  177. - printf(gettext ("If no argument or only the -c, --cpu parameter is given, debug output about\n"
  178. - "cpufreq is printed which is useful e.g. for reporting bugs.\n"));
  179. - printf(gettext ("For the arguments marked with *, omitting the -c or --cpu argument is\n"
  180. - "equivalent to setting it to zero\n"));
  181. + printf("If no argument or only the -c, --cpu parameter is given, debug output about\n"
  182. + "cpufreq is printed which is useful e.g. for reporting bugs.\n");
  183. + printf("For the arguments marked with *, omitting the -c or --cpu argument is\n"
  184. + "equivalent to setting it to zero\n");
  185. }
  186. static struct option info_opts[] = {
  187. @@ -497,9 +494,6 @@ int main(int argc, char **argv) {
  188. unsigned int human = 0;
  189. int output_param = 0;
  190. - setlocale(LC_ALL, "");
  191. - textdomain (PACKAGE);
  192. -
  193. do {
  194. ret = getopt_long(argc, argv, "c:hoefwldpgrasmy", info_opts, NULL);
  195. switch (ret) {
  196. @@ -560,7 +554,7 @@ int main(int argc, char **argv) {
  197. case 'o':
  198. if (cpu_defined) {
  199. print_header();
  200. - printf(gettext ("The argument passed to this tool can't be combined with passing a --cpu argument\n"));
  201. + printf("The argument passed to this tool can't be combined with passing a --cpu argument\n");
  202. return -EINVAL;
  203. }
  204. break;
  205. @@ -573,13 +567,13 @@ int main(int argc, char **argv) {
  206. switch (output_param) {
  207. case -1:
  208. print_header();
  209. - printf(gettext ("You can't specify more than one --cpu parameter and/or\n"
  210. - "more than one output-specific argument\n"));
  211. + printf("You can't specify more than one --cpu parameter and/or\n"
  212. + "more than one output-specific argument\n");
  213. return -EINVAL;
  214. break;
  215. case '?':
  216. print_header();
  217. - printf(gettext ("invalid or unknown argument\n"));
  218. + printf("invalid or unknown argument\n");
  219. print_help();
  220. ret = -EINVAL;
  221. break;