Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1447 → Rev 1449

/uspace/trunk/init/init.c
44,7 → 44,7
#include <kbd.h>
#include <ipc/fb.h>
#include <async.h>
#include <time.h>
#include <sys/time.h>
 
int a;
atomic_t ftx;
/uspace/trunk/libc/include/time.h
29,23 → 29,4
#ifndef __libc_TIME_H__
#define __libc_TIME_H__
 
#include <types.h>
 
#define DST_NONE 0
 
typedef sysarg_t time_t;
typedef sysarg_t suseconds_t;
 
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
 
struct timezone {
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
 
int gettimeofday(struct timeval *tv, struct timezone *tz);
 
#endif
/uspace/trunk/libc/include/async.h
3,7 → 3,7
 
#include <ipc/ipc.h>
#include <psthread.h>
#include <time.h>
#include <sys/time.h>
 
typedef ipc_callid_t aid_t;
 
/uspace/trunk/libc/include/sys/time.h
0,0 → 1,51
/*
* Copyright (C) 2006 Ondrej Palkovsky
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __libc_sys_TIME_H__
#define __libc_sys_TIME_H__
 
#include <types.h>
 
#define DST_NONE 0
 
typedef sysarg_t time_t;
typedef sysarg_t suseconds_t;
 
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
 
struct timezone {
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
 
int gettimeofday(struct timeval *tv, struct timezone *tz);
 
#endif
/uspace/trunk/libc/generic/time.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <ipc/ipc.h>
#include <stdio.h>
/uspace/trunk/tetris/tetris.h
167,7 → 167,7
#define PRE_PENALTY 0.75
 
extern int score; /* the obvious thing */
extern gid_t gid, egid;
//extern gid_t gid, egid;
 
extern char key_msg[100];
extern int showpreview;
/uspace/trunk/tetris/tetris.c
50,7 → 50,7
#include <sys/types.h>
 
#include <err.h>
#include <signal.h>
//#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
67,7 → 67,7
const struct shape *nextshape;
long fallrate;
int score;
gid_t gid, egid;
//gid_t gid, egid;
char key_msg[100];
int showpreview, classic;
 
165,48 → 165,49
 
keys = "jkl pq";
 
gid = getgid();
egid = getegid();
setegid(gid);
// gid = getgid();
// egid = getegid();
// setegid(gid);
 
classic = showpreview = 0;
while ((ch = getopt(argc, argv, "ck:l:ps")) != -1)
switch(ch) {
case 'c':
/*
* this means:
* - rotate the other way;
* - no reverse video.
*/
classic = 1;
break;
case 'k':
if (strlen(keys = optarg) != 6)
usage();
break;
case 'l':
level = (int)strtonum(optarg, MINLEVEL, MAXLEVEL,
&errstr);
if (errstr)
errx(1, "level must be from %d to %d",
MINLEVEL, MAXLEVEL);
break;
case 'p':
showpreview = 1;
break;
case 's':
showscores(0);
exit(0);
default:
usage();
}
 
argc -= optind;
argv += optind;
/* while ((ch = getopt(argc, argv, "ck:l:ps")) != -1) */
/* switch(ch) { */
/* case 'c': */
/* /\* */
/* * this means: */
/* * - rotate the other way; */
/* * - no reverse video. */
/* *\/ */
/* classic = 1; */
/* break; */
/* case 'k': */
/* if (strlen(keys = optarg) != 6) */
/* usage(); */
/* break; */
/* case 'l': */
/* level = (int)strtonum(optarg, MINLEVEL, MAXLEVEL, */
/* &errstr); */
/* if (errstr) */
/* errx(1, "level must be from %d to %d", */
/* MINLEVEL, MAXLEVEL); */
/* break; */
/* case 'p': */
/* showpreview = 1; */
/* break; */
/* case 's': */
/* showscores(0); */
/* exit(0); */
/* default: */
/* usage(); */
/* } */
 
if (argc)
usage();
/* argc -= optind; */
/* argv += optind; */
 
/* if (argc) */
/* usage(); */
 
fallrate = 1000000 / level;
 
for (i = 0; i <= 5; i++) {
227,7 → 228,7
key_write[0], key_write[1], key_write[2], key_write[3],
key_write[4], key_write[5]);
 
(void)signal(SIGINT, onintr);
// (void)signal(SIGINT, onintr);
scr_init();
setup_board();
 
357,13 → 358,13
exit(0);
}
 
void
onintr(int signo)
{
scr_clear(); /* XXX signal race */
scr_end(); /* XXX signal race */
_exit(0);
}
/* void */
/* onintr(int signo) */
/* { */
/* scr_clear(); /\* XXX signal race *\/ */
/* scr_end(); /\* XXX signal race *\/ */
/* _exit(0); */
/* } */
 
void
usage(void)
/uspace/trunk/tetris/Makefile
1,18 → 1,35
# $OpenBSD: Makefile,v 1.7 2002/05/31 03:46:35 pjanzen Exp $
LIBC_PREFIX = ../libc
SOFTINT_PREFIX = ../softint
include $(LIBC_PREFIX)/Makefile.toolchain
 
PROG= tetris
SRCS= input.c screen.c shapes.c scores.c tetris.c
MAN= tetris.6
DPADD= ${LIBCURSES}
LDADD= -lcurses
BINMODE=2555
LIBS = $(LIBC_PREFIX)/libc.a
 
beforeinstall:
@if [ ! -f ${DESTDIR}/var/games/tetris.scores ]; then \
${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 664 \
/dev/null ${DESTDIR}/var/games/tetris.scores ; \
else \
true ; \
fi
OUTPUT = tetris
SOURCES = shapes.c tetris.c scores.c input.c screen.c
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
 
.include <bsd.prog.mk>
.PHONY: all clean depend disasm
 
all: $(OUTPUT)
 
-include Makefile.depend
 
depend:
$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
 
$(OUTPUT): $(OBJECTS) $(LIBS)
$(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
 
clean:
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend *.o
disasm:
$(OBJDUMP) -d $(OUTPUT) >$(OUTPUT).disasm
 
%.o: %.S
$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
 
%.o: %.s
$(AS) $(AFLAGS) $< -o $@
 
%.o: %.c
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@