1255376Sdes/* $NetBSD: abs.c,v 1.7 2003/08/07 16:43:37 agc Exp $ */ 2255376Sdes 3271624Sdes/*- 491094Sdes * Copyright (c) 1990, 1993 591094Sdes * The Regents of the University of California. All rights reserved. 691094Sdes * 791094Sdes * Redistribution and use in source and binary forms, with or without 891094Sdes * modification, are permitted provided that the following conditions 991094Sdes * are met: 1091094Sdes * 1. Redistributions of source code must retain the above copyright 1191094Sdes * notice, this list of conditions and the following disclaimer. 12108794Sdes * 2. Redistributions in binary form must reproduce the above copyright 1391094Sdes * notice, this list of conditions and the following disclaimer in the 14117610Sdes * documentation and/or other materials provided with the distribution. 1591094Sdes * 3. Neither the name of the University nor the names of its contributors 1691094Sdes * may be used to endorse or promote products derived from this software 1794670Sdes * without specific prior written permission. 18236109Sdes * 1994670Sdes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20141098Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21141098Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2294670Sdes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2394670Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2494670Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25141098Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2694670Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2794670Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2894670Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2994670Sdes * SUCH DAMAGE. 3094670Sdes */ 3194670Sdes 3299158Sdes#include <sys/cdefs.h> 3394670Sdes#if defined(LIBC_SCCS) && !defined(lint) 34236109Sdes#if 0 3594670Sdesstatic char sccsid[] = "@(#)abs.c 8.1 (Berkeley) 6/4/93"; 3694670Sdes#else 3791100Sdes__RCSID("$NetBSD: abs.c,v 1.7 2003/08/07 16:43:37 agc Exp $"); 3891094Sdes#endif 39236109Sdes#endif /* LIBC_SCCS and not lint */ 4091094Sdes 4191100Sdes#include <stdlib.h> 4291100Sdes 4391100Sdesint 4491100Sdesabs(int j) 4591100Sdes{ 4691100Sdes return(j < 0 ? -j : j); 4791100Sdes} 4891100Sdes