head 1.1; access ; symbols ; locks oasisa:1.1; strict; comment @ * @; 1.1 date 2001.06.19.13.01.59; author oasisa; state Exp; branches ; next ; desc @Periodic Update w/ changes to utils plus new utils 6/19/2001 (klh) @ 1.1 log @Initial revision @ text @/****************************************************************************/ /* Copyright 1991 MBARI */ /****************************************************************************/ /* $Header: file.c,v 2.6 96/05/30 15:07:55 bobh Exp $ */ /* Summary : File Handling Routines for `extract` */ /* Filename : file.c */ /* Author : Robert Herlien (rah) */ /* Project : OASIS Mooring */ /* $Revision: 2.6 $ */ /* Created : 02/05/91 */ /* */ /* MBARI provides this documentation and code "as is", with no warranty, */ /* express or implied, of its quality or consistency. It is provided without*/ /* support and without obligation on the part of the Monterey Bay Aquarium */ /* Research Institute to assist in its use, correction, modification, or */ /* enhancement. This information should not be published or distributed to */ /* third parties without specific written permission from MBARI. */ /* */ /****************************************************************************/ /* Modification History: */ /* 14nov96 rah - created */ /* $Log$ */ /****************************************************************************/ #include /* MBARI type definitions */ #include /* MBARI constants */ #include #include #include #include /********************************/ /* Global Data */ /********************************/ Global Int optind = 1; /* Option index for getopt() */ Global char *optarg; /* Option argument for getopt() */ /************************************************************************/ /* Function : getopt */ /* Purpose : Get command line option */ /* Inputs : argc, argv, option format */ /* Outputs : Option letter */ /************************************************************************/ Int getopt( Int argc, char **argv, char *fmt ) { Reg char *p, *fmtptr; if ( optind >= argc ) return( EOF ); p = argv[optind]; deblank(p); if ( *p++ != '-' ) return( EOF ); fmtptr = strchr(fmt, *p); if ( (*p == ':') || (fmtptr == NULL) ) return( EOF ); optind++; optarg = p; optarg++; fmtptr++; if ( *fmtptr == ':' ) { if ( *optarg == '\0' ) optarg = argv[optind++]; deblank(optarg); } return( *p ); } /* getopt() */ @