vapier 15/08/05 04:37:36 Modified: uname-test.c Log: sync in latest 8.24 changes
Revision Changes Path 1.4 src/patchsets/coreutils/uname-test/uname-test.c file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/uname-test/uname-test.c?rev=1.4&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/uname-test/uname-test.c?rev=1.4&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/uname-test/uname-test.c?r1=1.3&r2=1.4 Index: uname-test.c =================================================================== RCS file: /var/cvsroot/gentoo/src/patchsets/coreutils/uname-test/uname-test.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- uname-test.c 4 Aug 2015 11:30:27 -0000 1.3 +++ uname-test.c 5 Aug 2015 04:37:36 -0000 1.4 @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 Gentoo Foundation + * Copyright 2006-2015 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 */ @@ -29,6 +29,8 @@ # endif const char *filename = CPUINFO_FILE; +#undef CPUINFO_FILE +#define CPUINFO_FILE filename # define PROCINFO_PROCESSOR 0 # define PROCINFO_HARDWARE_PLATFORM 1 @@ -44,7 +46,16 @@ while (*tmp && isspace(*tmp)) tmp++; if (tmp != buf) - memmove(buf, tmp, strlen(tmp) + 1); + memmove(buf, tmp, strlen(tmp)+1); + /* finally collapse whitespace */ + tmp = buf; + while (tmp[0] && tmp[1]) { + if (isspace(tmp[0]) && isspace(tmp[1])) { + memmove(tmp, tmp+1, strlen(tmp)); + continue; + } + ++tmp; + } } static int __linux_procinfo (int x, char *fstr, size_t s) @@ -88,7 +99,7 @@ if (verbose) printf("### Looking for '%s':\n", procinfo_keys[x]); - if ((fp = fopen(filename, "r")) != NULL) { + if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) { char key[65], value[257], eol, *ret = NULL; while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) {
