SHA256
1
0
forked from pool/powertop
OBS User unknown 2007-05-16 02:41:40 +00:00 committed by Git OBS Bridge
commit f2508e7bbf
8 changed files with 212 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
powertop-1.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1fa5cf41a8333ff9b060f28c1291657d1527b5efc45f951e2600c3175f035922
size 11386

View File

@ -0,0 +1,85 @@
--- powertop/powertop.c 2007-05-11 21:28:43.000000000 +0200
+++ powertop/powertop.c 2007-05-13 17:19:00.000000000 +0200
@@ -128,7 +128,8 @@
int nr = -1;
uint64_t count = 0;
memset(line,0,sizeof(line));
- fgets(line, 1024, file);
+ if (fgets(line, 1024, file) == NULL)
+ break;
c = strchr(line, ':');
if (!c)
continue;
@@ -189,7 +190,8 @@
while (!feof(file)) {
memset(line, 0, 4096);
- fgets(line, 4096, file);
+ if (fgets(line, 4096, file) == NULL)
+ break;
c = strstr(line, "age[");
if (!c)
continue;
@@ -294,7 +296,8 @@
char line[1024];
char *c;
int dontcount = 0;
- fgets(line, 1024, file);
+ if (fgets(line, 1024, file) == NULL)
+ break;
if (strstr(line, "present:") && strstr(line,"no"))
break;
@@ -320,7 +323,7 @@
}
-int main(int argc, char **argv)
+int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
{
char line[1024];
FILE *file = NULL;
@@ -392,7 +395,8 @@
while (file && !feof(file) && i<190) {
char *count, *pid, *process, *func;
int cnt;
- fgets(line, 1024, file);
+ if (fgets(line, 1024, file) == NULL)
+ break;
if (strstr(line, "total events"))
break;
c = count = & line[0];
--- powertop/config.c 2007-05-11 21:28:39.000000000 +0200
+++ powertop/config.c 2007-05-13 17:22:57.000000000 +0200
@@ -47,7 +47,8 @@
file = popen("zcat /proc/config.gz","r");
while (file && !feof(file)) {
char line[100];
- fgets(line, 100, file);
+ if (fgets(line, 100, file) == NULL)
+ break;
strcpy(configlines[configcount++], line);
}
pclose(file);
@@ -56,7 +57,10 @@
file = fopen("/proc/sys/kernel/osrelease","r");
if (!file)
return;
- fgets(version, 100, file);
+ if (fgets(version, 100, file) == NULL) {
+ fclose(file);
+ return;
+ }
fclose(file);
c = strchr(version, '\n');
if (c) *c=0;
@@ -66,7 +70,8 @@
return;
while (!feof(file)) {
char line[100];
- fgets(line, 100, file);
+ if (fgets(line, 100, file) == NULL)
+ break;
strcpy(configlines[configcount++], line);
}
fclose(file);

View File

@ -0,0 +1,17 @@
--- powertop/Makefile 2007-05-11 21:27:34.000000000 +0200
+++ powertop/Makefile 2007-05-13 14:47:55.000000000 +0200
@@ -1,11 +1,11 @@
BINDIR=/usr/bin
powertop: powertop.c config.c Makefile
- gcc -Wall -W -O1 -g powertop.c config.c -o powertop
+ gcc ${CFLAGS} -Wall -W -O1 -g powertop.c config.c -o powertop
install: powertop
cp powertop ${BINDIR}
clean:
rm -f *~ powertop
-
\ No newline at end of file
+

15
powertop.changes Normal file
View File

@ -0,0 +1,15 @@
-------------------------------------------------------------------
Sun May 13 17:09:11 CEST 2007 - thoenig@suse.de
- Add patch powertop-fix-compiler-warnings-thoenig-01.patch: Make
compiler warnings about unsued parameters and return values not
being repected go away.
- Fix whitespaces for %description
-------------------------------------------------------------------
Sun May 13 14:59:40 CEST 2007 - thoenig@suse.de
- Initial package submission (PowerTOP 1.0)
- Add patch powertop-respect-rpm-opt-flags-thoenig-01.patch: Fix
Makefile to respect RPM_OPT_FLAGS

68
powertop.spec Normal file
View File

@ -0,0 +1,68 @@
#
# spec file for package powertop (Version 1.0)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: powertop
URL: http://www.linuxpowertop.org
Summary: PowerTOP is a Linux tool to find out what is using power on a laptop
Version: 1.0
Release: 2
License: GNU General Public License (GPL)
Group: System/Monitoring
Source0: %{name}-%{version}.tar.gz
Patch0: %{name}-respect-rpm-opt-flags-thoenig-01.patch
Patch1: %{name}-fix-compiler-warnings-thoenig-01.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Autoreqprov: on
%description
PowerTOP is a program that collects the various pieces of information
from your system and presents an overview of how well your laptop is
doing in terms of power savings.
Authors:
--------
Arjan van de Ven <arjan@linux.intel.com>
%prep
cp %{S:0} .
tar xfvz %{name}-%{version}.tar.gz
%patch0 -p0
%patch1 -p0
%build
cd %{name}
CFLAGS="$RPM_OPT_FLAGS" make
%install
mkdir -p %{buildroot}/%{_sbindir}
install -Dm 755 %{name}/%{name} %{buildroot}/%{_sbindir}/%{name}
%clean
rm -rf %{_buildroot}
%files
%defattr(-,root,root)
%doc %{name}/COPYING
%{_sbindir}/%{name}
%changelog
* Sun May 13 2007 - thoenig@suse.de
- Add patch powertop-fix-compiler-warnings-thoenig-01.patch: Make
compiler warnings about unsued parameters and return values not
being repected go away.
- Fix whitespaces for %%description
* Sun May 13 2007 - thoenig@suse.de
- Initial package submission (PowerTOP 1.0)
- Add patch powertop-respect-rpm-opt-flags-thoenig-01.patch: Fix
Makefile to respect RPM_OPT_FLAGS

0
ready Normal file
View File