* config/rs6000/rs6000.c (rs6000_deligitimze_address): Do not
[official-gcc.git] / libgo / go / syscall / errstr_linux.go
blobd10476d3cb184ed6258bab00b7982a6e996219fb
1 // errstr_rtems.go -- RTEMS specific error strings.
3 // Copyright 2010 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 package syscall
9 import "unsafe"
11 //sysnb strerror_r(errnum int, b []byte) (errstr *byte)
12 //strerror_r(errnum _C_int, b *byte, len Size_t) *byte
14 func Errstr(errnum int) string {
15 a := make([]byte, 128)
16 p := strerror_r(errnum, a)
17 b := (*[1000]byte)(unsafe.Pointer(p))
18 i := 0
19 for b[i] != 0 {
20 i++
22 // Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
23 if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
24 c := b[0] + 'a' - 'A'
25 return string(c) + string(b[1:i])
27 return string(b[:i])