12490Sjkh/* 22490Sjkh * Copyright (c) 1988, 1993 32490Sjkh * The Regents of the University of California. All rights reserved. 42490Sjkh * 52490Sjkh * Redistribution and use in source and binary forms, with or without 62490Sjkh * modification, are permitted provided that the following conditions 72490Sjkh * are met: 82490Sjkh * 1. Redistributions of source code must retain the above copyright 92490Sjkh * notice, this list of conditions and the following disclaimer. 102490Sjkh * 2. Redistributions in binary form must reproduce the above copyright 112490Sjkh * notice, this list of conditions and the following disclaimer in the 122490Sjkh * documentation and/or other materials provided with the distribution. 13203932Simp * 3. Neither the name of the University nor the names of its contributors 142490Sjkh * may be used to endorse or promote products derived from this software 152490Sjkh * without specific prior written permission. 162490Sjkh * 172490Sjkh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 182490Sjkh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 192490Sjkh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 202490Sjkh * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 212490Sjkh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 222490Sjkh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 232490Sjkh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 242490Sjkh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 252490Sjkh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 262490Sjkh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 272490Sjkh * SUCH DAMAGE. 282490Sjkh */ 292490Sjkh 302490Sjkh#ifndef lint 3153920Sbillfstatic const char copyright[] = 322490Sjkh"@(#) Copyright (c) 1988, 1993\n\ 332490Sjkh The Regents of the University of California. All rights reserved.\n"; 342490Sjkh#endif /* not lint */ 352490Sjkh 362490Sjkh#ifndef lint 3753920Sbillf#if 0 382490Sjkhstatic char sccsid[] = "@(#)ppt.c 8.1 (Berkeley) 5/31/93"; 3953920Sbillf#endif 4053920Sbillfstatic const char rcsid[] = 4153920Sbillf "$FreeBSD$"; 422490Sjkh#endif /* not lint */ 432490Sjkh 442490Sjkh#include <stdio.h> 45132966Sstefanf#include <stdlib.h> 462490Sjkh 4754482Sbillfstatic void putppt(int); 482490Sjkh 4954482Sbillfint 50132966Sstefanfmain(int argc, char **argv) 512490Sjkh{ 5253210Sbillf int c; 5353210Sbillf char *p; 542490Sjkh 552490Sjkh (void) puts("___________"); 562490Sjkh if (argc > 1) 5754482Sbillf while ((p = *++argv)) 582490Sjkh for (; *p; ++p) 592490Sjkh putppt((int)*p); 602490Sjkh else while ((c = getchar()) != EOF) 612490Sjkh putppt(c); 622490Sjkh (void) puts("___________"); 632490Sjkh exit(0); 642490Sjkh} 652490Sjkh 662490Sjkhstatic void 67132966Sstefanfputppt(int c) 682490Sjkh{ 6953210Sbillf int i; 702490Sjkh 712490Sjkh (void) putchar('|'); 722490Sjkh for (i = 7; i >= 0; i--) { 732490Sjkh if (i == 2) 742490Sjkh (void) putchar('.'); /* feed hole */ 752490Sjkh if ((c&(1<<i)) != 0) 762490Sjkh (void) putchar('o'); 772490Sjkh else 782490Sjkh (void) putchar(' '); 792490Sjkh } 802490Sjkh (void) putchar('|'); 812490Sjkh (void) putchar('\n'); 822490Sjkh} 83