mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-08-24 07:09:18 +03:00
57 lines
1.1 KiB
C
57 lines
1.1 KiB
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 <string.h>
|
|
|
|
#include "lang.h"
|
|
|
|
|
|
static void usage(const char *name)
|
|
{
|
|
fprintf(stderr,
|
|
"usage: %s file [[-type] file ...] ...\n\n"
|
|
" file types:\n"
|
|
" -c characteristics\n"
|
|
" -i inventory\n"
|
|
" -x currency exchange\n"
|
|
" -p providers\n"
|
|
, name);
|
|
exit(1);
|
|
}
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
void (*parse)(const char *name) = parse_hierarchy;
|
|
int i;
|
|
|
|
for (i = 1; i != argc; i++) {
|
|
if (*argv[i] == '-') {
|
|
if (!strcmp(argv[i], "-c"))
|
|
parse = parse_characteristics;
|
|
else if (!strcmp(argv[i], "-i"))
|
|
parse = parse_inventory;
|
|
else if (!strcmp(argv[i], "-x"))
|
|
parse = parse_currencies;
|
|
else if (!strcmp(argv[i], "-p"))
|
|
parse = parse_providers;
|
|
else
|
|
usage(*argv);
|
|
} else {
|
|
parse(argv[i]);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|