Home | History | Annotate | Line # | Download | only in common
      1 /* $NetBSD: putulong.c,v 1.3 2005/12/11 12:16:20 christos Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. The name of the author may not be used to endorse or promote products
     12  *    derived from this software without specific prior written permission
     13  *
     14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24  */
     25 
     26 #include <lib/libsa/stand.h>
     27 #include "common.h"
     28 
     29 void
     30 putulong(unsigned long ul)
     31 {
     32 	char buf[sizeof (ul) * 2], *bp;
     33 
     34 	for (bp = buf; ul != 0; ul >>= 4)
     35 		*bp++ = hexdigits[ul & 0xf];
     36 	while (bp-- > buf)
     37 		putchar(*bp);
     38 	putchar('\n');
     39 }
     40