138451Smsmith/*-
238451Smsmith * Copyright (c) 1986, 1988, 1991, 1993
338451Smsmith *	The Regents of the University of California.  All rights reserved.
438451Smsmith * (c) UNIX System Laboratories, Inc.
538451Smsmith * All or some portions of this file are derived from material licensed
638451Smsmith * to the University of California by American Telephone and Telegraph
738451Smsmith * Co. or Unix System Laboratories, Inc. and are reproduced herein with
838451Smsmith * the permission of UNIX System Laboratories, Inc.
938451Smsmith *
1038451Smsmith * Redistribution and use in source and binary forms, with or without
1138451Smsmith * modification, are permitted provided that the following conditions
1238451Smsmith * are met:
1338451Smsmith * 1. Redistributions of source code must retain the above copyright
1438451Smsmith *    notice, this list of conditions and the following disclaimer.
1538451Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1638451Smsmith *    notice, this list of conditions and the following disclaimer in the
1738451Smsmith *    documentation and/or other materials provided with the distribution.
1838451Smsmith * 4. Neither the name of the University nor the names of its contributors
1938451Smsmith *    may be used to endorse or promote products derived from this software
2038451Smsmith *    without specific prior written permission.
2138451Smsmith *
2238451Smsmith * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2338451Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2438451Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2538451Smsmith * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2638451Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2738451Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2838451Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2938451Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3038451Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3138451Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3238451Smsmith * SUCH DAMAGE.
3338451Smsmith *
3438451Smsmith *	@(#)subr_prf.c	8.3 (Berkeley) 1/21/94
3538451Smsmith */
3638451Smsmith
3784221Sdillon#include <sys/cdefs.h>
3884221Sdillon__FBSDID("$FreeBSD: stable/11/stand/libsa/twiddle.c 329132 2018-02-11 19:51:29Z kevans $");
3984221Sdillon
4038451Smsmith#include <sys/types.h>
4138451Smsmith#include "stand.h"
4238451Smsmith
4338451Smsmith/* Extra functions from NetBSD standalone printf.c */
4438451Smsmith
45276079Sianstatic u_int globaldiv;
46276079Sian
4738451Smsmithvoid
48276079Siantwiddle(u_int callerdiv)
4938451Smsmith{
50276079Sian	static u_int callercnt, globalcnt, pos;
5138451Smsmith
52276079Sian	callercnt++;
53276079Sian	if (callerdiv > 1 && (callercnt % callerdiv) != 0)
54276079Sian		return;
55276079Sian
56276079Sian	globalcnt++;
57276079Sian	if (globaldiv > 1 && (globalcnt % globaldiv) != 0)
58276079Sian		return;
59276079Sian
6038451Smsmith	putchar("|/-\\"[pos++ & 3]);
6138451Smsmith	putchar('\b');
6238451Smsmith}
63276079Sian
64276079Sianvoid
65276079Siantwiddle_divisor(u_int gdiv)
66276079Sian{
67276079Sian
68276079Sian	globaldiv = gdiv;
69276079Sian}
70