- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
/*
* Now do an in-place copy.
* Map (R) to (r) and (TM) to (tm).
* The era of teletypes is long gone, and there's
* -really- no need to shout.
*/
while (*src != '\0') {
if (src[0] == '(') {
if (strncmp(src + 1, "R)", 2) == 0) {
(void) strncpy(dst, "(r)", 3);
src += 3;
dst += 3;
continue;
}
if (strncmp(src + 1, "TM)", 3) == 0) {
(void) strncpy(dst, "(tm)", 4);
src += 4;
dst += 4;
continue;
}
}
*dst++ = *src++;
}
*dst = '\0';
Не говнокод, но забавно.
Инициализация процессоров (и сбор cpuid) в Solaris
http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/i86pc/os/cpuid.c#2488