Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tetris/tetris.c

    r19f857a rceb07b9  
    1 /*      $OpenBSD: tetris.c,v 1.21 2006/04/20 03:24:12 ray Exp $ */
    2 /*      $NetBSD: tetris.c,v 1.2 1995/04/22 07:42:47 cgd Exp $   */
    3 
    4 /*-
    5  * Copyright (c) 1992, 1993
    6  *      The Regents of the University of California.  All rights reserved.
    7  *
    8  * This code is derived from software contributed to Berkeley by
    9  * Chris Torek and Darren F. Provine.
     1/*
     2 * Copyright (c) 2011 Martin Decky
     3 * All rights reserved.
    104 *
    115 * Redistribution and use in source and binary forms, with or without
    126 * modification, are permitted provided that the following conditions
    137 * are met:
    14  * 1. Redistributions of source code must retain the above copyright
    15  *    notice, this list of conditions and the following disclaimer.
    16  * 2. Redistributions in binary form must reproduce the above copyright
    17  *    notice, this list of conditions and the following disclaimer in the
    18  *    documentation and/or other materials provided with the distribution.
    19  * 3. Neither the name of the University nor the names of its contributors
    20  *    may be used to endorse or promote products derived from this software
    21  *    without specific prior written permission.
    22  *
    23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    33  * SUCH DAMAGE.
    34  *
    35  *      @(#)tetris.c    8.1 (Berkeley) 5/31/93
     8 *
     9 * - Redistributions of source code must retain the above copyright
     10 *   notice, this list of conditions and the following disclaimer.
     11 * - Redistributions in binary form must reproduce the above copyright
     12 *   notice, this list of conditions and the following disclaimer in the
     13 *   documentation and/or other materials provided with the distribution.
     14 * - The name of the author may not be used to endorse or promote products
     15 *   derived from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 */
     28
     29/** Attributations
     30 *
     31 * tetris.c 8.1 (Berkeley) 5/31/93
     32 * NetBSD: tetris.c,v 1.2 1995/04/22 07:42:47 cgd
     33 * OpenBSD: tetris.c,v 1.21 2006/04/20 03:24:12 ray
     34 *
     35 * Based upon BSD Tetris
     36 *
     37 * Copyright (c) 1992, 1993
     38 *      The Regents of the University of California.
     39 *      Distributed under BSD license.
     40 *
     41 * This code is derived from software contributed to Berkeley by
     42 * Chris Torek and Darren F. Provine.
     43 *
    3644 */
    3745
     
    5664#include <unistd.h>
    5765#include <getopt.h>
    58 
    59 #include "input.h"
    6066#include "scores.h"
    6167#include "screen.h"
     
    245251        int ch;
    246252       
     253        console = console_init(stdin, stdout);
     254       
    247255        keys = "jkl pq";
    248256       
    249257        classic = 0;
    250         showpreview = 1; 
     258        showpreview = 1;
    251259       
    252260        while ((ch = getopt(argc, argv, "ck:ps")) != -1)
     
    283291                for (j = i + 1; j <= 5; j++) {
    284292                        if (keys[i] == keys[j])
    285                                 errx(1, "duplicate command keys specified.");
     293                                errx(1, "%s", "duplicate command keys specified.");
    286294                }
    287295               
     
    371379                                        scr_msg(key_msg, 0);
    372380                                        scr_msg(msg, 1);
    373                                         (void) fflush(stdout);
    374                                 } while (rwait((struct timeval *) NULL) == -1);
     381                                        console_flush(console);
     382                                } while (!twait());
    375383                               
    376384                                scr_msg(msg, 0);
Note: See TracChangeset for help on using the changeset viewer.