FreeCalypso > hg > fc-sim-tools
view libcommon/globalopts.c @ 14:b7ee2e85686b
command dispatch and scripting factored out into libcommon
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 14 Mar 2021 07:34:35 +0000 |
parents | c9ef9e91dd8e |
children | 9eb5460f51a6 |
line wrap: on
line source
/* * This module implements parsing of global command line options. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> unsigned calypso_fd, pcsc_reader_num; parse_global_options(argc, argv) char **argv; { extern char *optarg; int c; while ((c = getopt(argc, argv, "+C:p:")) != EOF) { switch (c) { case 'C': calypso_fd = atoi(optarg); continue; case 'p': pcsc_reader_num = atoi(optarg); continue; case '?': default: /* error msg already printed */ exit(1); } } return(0); }