1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-05 06:27:31 +02:00
eda-tools/b2/boom.c

53 lines
847 B
C

/*
* boom.c - BOOM, main function
*
* Copyright 2012 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
extern int yyparse(void);
static void usage(const char *name)
{
fprintf(stderr, "usage: %s [file]\n", name);
exit(1);
}
int main(int argc, char **argv)
{
int fd;
switch (argc) {
case 1:
break;
case 2:
fd = open(argv[1], O_RDONLY);
if (fd < 0) {
perror(argv[1]);
exit(1);
}
if (dup2(fd, 0) < 0) {
perror("dup2");
exit(1);
}
break;
default:
usage(*argv);
}
(void) yyparse();
return 0;
}