abs.c revision 1573
1240616Sjimharris/*- 2240616Sjimharris * Copyright (c) 1990, 1993 3240616Sjimharris * The Regents of the University of California. All rights reserved. 4240616Sjimharris * 5240616Sjimharris * Redistribution and use in source and binary forms, with or without 6240616Sjimharris * modification, are permitted provided that the following conditions 7240616Sjimharris * are met: 8240616Sjimharris * 1. Redistributions of source code must retain the above copyright 9240616Sjimharris * notice, this list of conditions and the following disclaimer. 10240616Sjimharris * 2. Redistributions in binary form must reproduce the above copyright 11240616Sjimharris * notice, this list of conditions and the following disclaimer in the 12240616Sjimharris * documentation and/or other materials provided with the distribution. 13240616Sjimharris * 3. All advertising materials mentioning features or use of this software 14240616Sjimharris * must display the following acknowledgement: 15240616Sjimharris * This product includes software developed by the University of 16240616Sjimharris * California, Berkeley and its contributors. 17240616Sjimharris * 4. Neither the name of the University nor the names of its contributors 18240616Sjimharris * may be used to endorse or promote products derived from this software 19240616Sjimharris * without specific prior written permission. 20240616Sjimharris * 21240616Sjimharris * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22240616Sjimharris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23240616Sjimharris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24240616Sjimharris * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25240616Sjimharris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26240616Sjimharris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27240616Sjimharris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28240616Sjimharris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29240616Sjimharris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30240616Sjimharris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31240616Sjimharris * SUCH DAMAGE. 32240616Sjimharris */ 33240616Sjimharris 34240616Sjimharris#if defined(LIBC_SCCS) && !defined(lint) 35240616Sjimharrisstatic char sccsid[] = "@(#)abs.c 8.1 (Berkeley) 6/4/93"; 36240616Sjimharris#endif /* LIBC_SCCS and not lint */ 37240616Sjimharris 38240616Sjimharris#include <stdlib.h> 39240616Sjimharris 40240616Sjimharrisint 41240616Sjimharrisabs(j) 42240616Sjimharris int j; 43240616Sjimharris{ 44240616Sjimharris return(j < 0 ? -j : j); 45240616Sjimharris} 46240616Sjimharris