www.pudn.com > opengpssim.zip > ogsoptions.c
/* ****************************************************************** * * * Open GPS Sim * * * * -------------------------------------------------------------- * * * * Modul: ogsoptions.c * * * * Autor: gnu * * * * Datum: 19.09.91 * * * * -------------------------------------------------------------- * * * * Zweck: Verarbeitung von Optionen * * * ****************************************************************** */ /* ************************* Aenderungen **************************** 01.01.92 - ****************************************************************** */ /* --------------------------- includes ----------------------------- */ /* Parse command line arguments for bison, Copyright (C) 1984, 1986, 1989 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. Bison 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 1, or (at your option) any later version. Bison is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ---------------------- includes ---------------------------- */ #include#include #include #include #if defined(__TURBOC__) && !defined(__TOS__) # include #endif #include "ogsdefine.h" #include "ogsstructs.h" #include "ogsextern.h" #include "ogsprototypes.h" #include "ogslibrary.h" /* ---------------------- prototypen -------------------------------- */ int getopt( int argc, char **argv, char *optstring); void usage( void); /* ---------------------- globals ----------------------------------- */ char *InputFileName; int OverWrite; /* ---------------------- procedures -------------------------------- */ void getargs( int argc, char *argv[]) { register int c; // char *Ptr = NULL; // *TmpStr = NULL; // unsigned int Last = 0; extern int optind; extern char *optarg; /* getopt( argc, argv, "?hvel:m:n:o:s:txyz:") */ while ((c = getopt( argc, argv, "?hvfirx:")) != EOF) { switch (c) { case '?': case 'h': usage(); break; case 'v': Verbose = 1; break; case 'f': OverWrite = 1; break; case 'i': OutputIQ = 1; break; case 'r': OutputCarFrq = 1; break; case 'x': assert( optarg); InputFileName = conmalloc( strlen( optarg)+1); strcpy( InputFileName, optarg); break; #if 0 case 'e': ReadUntilEOF = TRUE; break; case 'l': assert( optarg); if (( Ptr = strchr( optarg, '-')) != NULL) { BisLine = atoi( Ptr+1); if ( optarg[0] != '-') VonLine = atoi( optarg); } else NofSkipLines = atoi( optarg); break; case 'm': assert( optarg); MissingValueSet = TRUE; MissingValue = atof( optarg); break; case 'n': assert( MatrixName && optarg); if ( strlen( optarg) >= MATNAMELEN) optarg[ MATNAMELEN-1] = '\0'; strcpy( MatrixName, optarg); break; case 'o': assert( optarg); assert( OutputFile); strcpy( OutputFile, optarg); break; #endif default: fprintf( stderr, "unknown qualifier -%c\n", c); break; } } if ( optind < argc - 1) fprintf( stderr, "warning: extra arguments ignored\n"); return; } /* ============================== Eof =============================== */