diff options
Diffstat (limited to 'libc/misc/assert')
-rw-r--r-- | libc/misc/assert/.indent.pro | 33 | ||||
-rw-r--r-- | libc/misc/assert/Makefile | 41 | ||||
-rw-r--r-- | libc/misc/assert/__assert.c | 31 |
3 files changed, 105 insertions, 0 deletions
diff --git a/libc/misc/assert/.indent.pro b/libc/misc/assert/.indent.pro new file mode 100644 index 000000000..492ecf1c7 --- /dev/null +++ b/libc/misc/assert/.indent.pro @@ -0,0 +1,33 @@ +--blank-lines-after-declarations +--blank-lines-after-procedures +--break-before-boolean-operator +--no-blank-lines-after-commas +--braces-on-if-line +--braces-on-struct-decl-line +--comment-indentation25 +--declaration-comment-column25 +--no-comment-delimiters-on-blank-lines +--cuddle-else +--continuation-indentation4 +--case-indentation0 +--else-endif-column33 +--space-after-cast +--line-comments-indentation0 +--declaration-indentation1 +--dont-format-first-column-comments +--dont-format-comments +--honour-newlines +--indent-level4 +/* changed from 0 to 4 */ +--parameter-indentation4 +--line-length78 /* changed from 75 */ +--continue-at-parentheses +--no-space-after-function-call-names +--dont-break-procedure-type +--dont-star-comments +--leave-optional-blank-lines +--dont-space-special-semicolon +--tab-size4 +/* additions by Mark */ +--case-brace-indentation0 +--leave-preprocessor-space diff --git a/libc/misc/assert/Makefile b/libc/misc/assert/Makefile new file mode 100644 index 000000000..7dddd7d3e --- /dev/null +++ b/libc/misc/assert/Makefile @@ -0,0 +1,41 @@ +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. + +TOPDIR=../../ +include $(TOPDIR)Rules.make +LIBC=$(TOPDIR)libc.a + +CSRC=__assert.c +COBJS=$(patsubst %.c,%.o, $(CSRC)) +OBJS=$(COBJS) + +all: $(LIBC) + +$(LIBC): ar-target + +ar-target: $(OBJS) + $(AR) $(ARFLAGS) $(LIBC) $(OBJS) + +$(OBJS): Makefile + +clean: + rm -f *.[oa] *~ core diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c new file mode 100644 index 000000000..2ce86c3f1 --- /dev/null +++ b/libc/misc/assert/__assert.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1996 Robert de Bath <rdebath@cix.compulink.co.uk> + * This file is part of the Linux-8086 C library and is distributed + * under the GNU Library General Public License. + */ + +#include <unistd.h> +#include <string.h> +#include <stdlib.h> + +extern char *itoa(int); + +static void errput(str) +const char *str; +{ + write(2, str, strlen(str)); +} + +void __assert(assertion, filename, linenumber) +const char *assertion; +const char *filename; +int linenumber; +{ + errput("Failed assertion '"); + errput(assertion); + errput("' in file "); + errput(filename); + errput(" at line "); + errput(itoa(linenumber)); + errput(".\n"); + abort(); +} |