ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
getopt.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <admodel.h>
00012 
00017 int get_option_number(const char * option_name,const char * error_message,
00018   int& option_value)
00019 {
00020   int on1;
00021   int nopt;
00022   if ( (on1=option_match(ad_comm::argc,ad_comm::argv,option_name,nopt))>-1)
00023   {
00024     if (!nopt)
00025     {
00026       if (ad_printf)
00027         (*ad_printf)("%s\n",error_message);
00028       else
00029         cerr << error_message << endl;
00030       on1=-1;
00031     }
00032     else
00033     {
00034       option_value=atoi(ad_comm::argv[on1+1]);
00035     }
00036   }
00037   return on1;
00038 }