twiddle.c (165906) | twiddle.c (276079) |
---|---|
1/*- 2 * Copyright (c) 1986, 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1986, 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/lib/libstand/twiddle.c 165906 2007-01-09 01:02:06Z imp $"); | 38__FBSDID("$FreeBSD: head/lib/libstand/twiddle.c 276079 2014-12-22 20:42:36Z ian $"); |
39 40#include <sys/types.h> 41#include "stand.h" 42 43/* Extra functions from NetBSD standalone printf.c */ 44 | 39 40#include <sys/types.h> 41#include "stand.h" 42 43/* Extra functions from NetBSD standalone printf.c */ 44 |
45static u_int globaldiv; 46 |
|
45void | 47void |
46twiddle() | 48twiddle(u_int callerdiv) |
47{ | 49{ |
48 static int pos; | 50 static u_int callercnt, globalcnt, pos; |
49 | 51 |
52 callercnt++; 53 if (callerdiv > 1 && (callercnt % callerdiv) != 0) 54 return; 55 56 globalcnt++; 57 if (globaldiv > 1 && (globalcnt % globaldiv) != 0) 58 return; 59 |
|
50 putchar("|/-\\"[pos++ & 3]); 51 putchar('\b'); 52} | 60 putchar("|/-\\"[pos++ & 3]); 61 putchar('\b'); 62} |
63 64void 65twiddle_divisor(u_int gdiv) 66{ 67 68 globaldiv = gdiv; 69} |
|