github.com/zach-klippenstein/go@v0.0.0-20150108044943-fcfbeb3adf58/src/lib9/fmt/errfmt.c (about) 1 // +build plan9 2 3 /* 4 * The authors of this software are Rob Pike and Ken Thompson, 5 * with contributions from Mike Burrows and Sean Dorward. 6 * 7 * Copyright (c) 2002-2006 by Lucent Technologies. 8 * Portions Copyright (c) 2004 Google Inc. 9 * 10 * Permission to use, copy, modify, and distribute this software for any 11 * purpose without fee is hereby granted, provided that this entire notice 12 * is included in all copies of any software which is or includes a copy 13 * or modification of this software and in all copies of the supporting 14 * documentation for such software. 15 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED 16 * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES 17 * NOR GOOGLE INC MAKE ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING 18 * THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. 19 */ 20 21 #include <u.h> 22 #include <libc.h> 23 #include "fmtdef.h" 24 25 int 26 __errfmt(Fmt *f) 27 { 28 char buf[ERRMAX]; 29 30 rerrstr(buf, sizeof buf); 31 return __fmtcpy(f, buf, utflen(buf), strlen(buf)); 32 }