Exemplo n.º 1
0
std::string debugInformation()
{
    Utils::screenWidth();
    std::string headline(Utils::screenWidth(), '-');

    std::ostringstream os;

    os << headline << std::endl;
    os << "PDAL debug information" << std::endl ;
    os << headline << std::endl << std::endl;

    os << "Version information" << std::endl;
    os << headline << std::endl;
    os << "(" << fullVersionString() << ")" << std::endl;
    os << std::endl;

    os << "Debug build status" << std::endl;
    os << headline << std::endl;
    os << PDAL_BUILD_TYPE << std::endl << std::endl;

    os << "Enabled libraries" << std::endl;
    os << headline << std::endl << std::endl;

    os << "GDAL (" << GDALVersionInfo("RELEASE_NAME") << ") - " <<
        "http://www.gdal.org" << std::endl;

#ifdef PDAL_HAVE_LIBXML2
    os << "libxml (" << LIBXML_DOTTED_VERSION << ") - " <<
              "http://www.xmlsoft.org/" << std::endl;
#endif

    return os.str();
}
Exemplo n.º 2
0
void Kernel::outputVersion()
{
    std::string headline("------------------------------------------------------------------------------------------");
    std::cout << headline << std::endl;
    std::cout << "pdal " << m_appName << " (" << pdal::GetFullVersionString() << ")\n";
    std::cout << headline << std::endl;
    std::cout << std::endl;
}
Exemplo n.º 3
0
static int Wdisp()
        {
        int rr,cc;
                                  /* 29.10.89 */
/*      CURSOR_OFF; headline("");  cursor(r,c);  CURSOR_ON;   */
        CURSOR_OFF; CURSOR_POS(&rr,&cc); headline("");  LOCATE(rr,cc);  CURSOR_ON;
                                                        /* 4.6.90 */
        return(1);
        }
Exemplo n.º 4
0
void
WarningDialog::addWarning(Message message)
{
    QWidget *tab = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setAlignment(Qt::AlignTop);
    tab->setLayout(layout);

    QLabel *text = new QLabel(message.first.first);
    text->setWordWrap(true);
    layout->addWidget(text);

    QLabel *informativeText = new QLabel(message.first.second);
    informativeText->setWordWrap(true);
    layout->addWidget(informativeText);

    informativeText->setOpenExternalLinks(true);

    QIcon icon = IconLoader().load("warning");
    QString headline(tr("Warning"));

    switch (message.second) {
    case Midi:
        icon = IconLoader().load("midi-nok");
        headline = tr("MIDI");
        break;
    case Audio:
        icon = IconLoader().load("audio-nok");
        headline = tr("Audio");
        break;
    case Timer:
        icon = IconLoader().load("timer-nok");
        headline = tr("System timer");
        break;
    case Info:
        icon = IconLoader().load("messagebox-information");
        headline = tr("Information");
        break;
    case Other:
    default:
        // icon and text were initialized suitable for this case, so there's
        // nothing to do here
        break;
    }

    m_tabWidget->addTab(tab, icon, headline);
}
Exemplo n.º 5
0
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void IOData::InitMeshVtk(std::ifstream &ifs)
  throw(tool::IOError)
{
  // define
  std::string buffer;
  int num_nodes=0;
  int num_faces=0;
  int num_cells=0;
  MeshInfo::CellType max_celltype = MeshInfo::TRIA3;
  
  // ### Count Mesh Elements ###
  // define
  bool read_nodes=false;
  bool read_cells=false;
  bool read_types=false;

  // eof flag clear and rewind
  ifs.clear();
  ifs.seekg(0, std::ios::beg);
  
  while( getline(ifs, buffer) ){
    std::istringstream headline(buffer);
    std::string head;
    headline >> head;

    // Check Dataset
    if( strstr( head.c_str() , "DATASET") ){
      if( !strstr( buffer.c_str() , "UNSTRUCTURED_GRID") ){
	BOOST_THROW_EXCEPTION
	  ( tool::IOError("File Format is not UNSTRUCTURED_GRID !") );
      }

      
      // Count Nodes
    }else if( strstr( head.c_str() , "POINTS")){
      headline >> num_nodes;
      // read flag
      read_nodes=true;

      
      // Count Cells
    }else if( strstr( head.c_str() , "CELLS")){
Exemplo n.º 6
0
static int tab_disp()
        {
        double p1;
        double se;
        double lower,upper;

        LOCATE(r+6,9); PR_EUDL;
        p1=(double)pcount/(double)count;
        se=sqrt(p1*(1.0-p1)/(double)count);
        lower=p1-conf_coeff*se; if (lower<0.0) lower=0.0;
        upper=p1+conf_coeff*se; if (upper>1.0) upper=1.0;
        sprintf(sbuf,"%10d %.8f %.8f lower limit",
                       count,p1,lower);
        (*g_print)(sbuf);
        LOCATE(r+7,9);
        sprintf(sbuf,"      s.e. %.8f %.8f upper limit",se,upper);
        (*g_print)(sbuf);
        dcount=0L;
        headline("");              
        return(1);
        }
Exemplo n.º 7
0
int nextch(char *valinta)
        {
        extern int muste_mousewheel;
        int m;

muste_mousewheel=FALSE;

        if (etu==2)
            {
            headline(valinta);
            m=tutch();
            while (m==255) m=tutch();
            if (m!=0) return(m);
            }
        if (etu==1) { m=nextkey(valinta); tutsave(m); return(m); }

		m=nextkey(valinta);
		
muste_mousewheel=TRUE;		
        return (m);
        }
Exemplo n.º 8
0
void Kernel::outputHelp()
{
    outputVersion();


    for (auto iter = m_options.begin(); iter != m_options.end(); ++iter)
    {
        const po::options_description* options = *iter;
        std::cout << *options;
        std::cout << std::endl;
    }

    std::string headline("------------------------------------------------------------------------------------------");

    std::cout <<"\nFor more information, see the full documentation for PDAL at:\n";

    std::cout << "  http://pdal.io/\n";
    std::cout << headline << std::endl;
    std::cout << std::endl;

    return;
}
Exemplo n.º 9
0
std::string getPDALDebugInformation()
{
    std::string headline("------------------------------------------------------------------------------------------");

    std::ostringstream os;
        
    os << headline << std::endl;
    os << "PDAL debug information" << std::endl ;
    os << headline << std::endl << std::endl;
    
    os << "Version information" << std::endl;
    os << headline << std::endl;
    os << "(" << pdal::GetFullVersionString() << ")" << std::endl;
    os << std::endl;
    
    os << "Debug build status" << std::endl;
    os << headline << std::endl << std::endl;
    os << PDAL_BUILD_TYPE << std::endl<< std::endl;
    
    os << "Enabled libraries" << std::endl;
    os << headline << std::endl << std::endl;

    boost::uint32_t special_column(32);    
    boost::uint32_t name_column(20);
    boost::uint32_t url_column(40);

    std::ostringstream thdr;
    for (unsigned i = 0; i < name_column-1; ++i)
        thdr << "=";
    thdr << " ";
    for (unsigned i = 0; i < url_column-1; ++i)
        thdr << "=";        
    thdr << " ";
    for (unsigned i = 0; i < special_column-1; ++i)
        thdr << "=";    
    thdr << " ";

    name_column--; 

    unsigned step_back(3);

    os << thdr.str() << std::endl;
    os << std::setw(name_column-step_back) << "Name" << std::setw(url_column-step_back) << "URL"  << std::setw(special_column-step_back) << "Version" << std::endl;
    os << thdr.str() << std::endl ;        
    
#ifdef PDAL_HAVE_CARIS
    os << std::left 
              << std::setw(name_column) << "CARIS" << std::right 
              << std::setw(url_column) << "http://www.caris.com/" 
              << std::setw(special_column) << ""  << std::endl;
#endif
#ifdef PDAL_HAVE_GEOS
    os << std::left 
              << std::setw(name_column) << "GEOS" << std::right 
              << std::setw(url_column) << "http://trac.osgeo.org/geos" 
              << std::setw(special_column) << GEOS_VERSION  << std::endl;
#endif
#ifdef PDAL_HAVE_GDAL
    os << std::left 
              << std::setw(name_column) << "GDAL" << std::right 
              << std::setw(url_column) << "http://www.gdal.org" 
              << std::setw(special_column) << GDALVersionInfo("RELEASE_NAME")  << std::endl;
#endif
#ifdef PDAL_HAVE_HEXER
    std::ostringstream hexerver;
    hexerver << HEXER_VERSION_MAJOR << "."
        << HEXER_VERSION_MINOR << "."
        << HEXER_VERSION_PATCH;
    os << std::left 
              << std::setw(name_column) << "Hexer" << std::right 
              << std::setw(url_column) << "http://github.com/hobu/hexer/" 
              << std::setw(special_column) << hexerver.str()  << std::endl;
#endif
#ifdef PDAL_HAVE_LASZIP
    
    std::ostringstream laszipver;
    laszipver << LASZIP_VERSION_MAJOR << "."
        << LASZIP_VERSION_MINOR << "."
        << LASZIP_VERSION_REVISION;
    os << std::left 
              << std::setw(name_column) << "LASzip" << std::right 
              << std::setw(url_column) << "http://laszip.org" 
              << std::setw(special_column) << laszipver.str() << std::endl;
    
#endif
#ifdef PDAL_HAVE_LIBXML2
    os << std::left 
              << std::setw(name_column) << "libxml" << std::right 
              << std::setw(url_column) << "http://www.xmlsoft.org/" 
              << std::setw(special_column) << LIBXML_DOTTED_VERSION  << std::endl;
#endif
#ifdef PDAL_HAVE_LIBGEOTIFF
    os << std::left 
              << std::setw(name_column) << "libgeotiff" << std::right 
              << std::setw(url_column) << "http://trac.osgeo.org/geotiff/" 
              << std::setw(special_column) << LIBGEOTIFF_VERSION  << std::endl;
#endif
#ifdef PDAL_HAVE_MRSID
    os << std::left 
              << std::setw(name_column) << "MrSID" << std::right 
              << std::setw(url_column) << "http://www.lizardtech.com" 
              << std::setw(special_column) << ""  << std::endl;
#endif
#ifdef PDAL_HAVE_MSGPACK
    os << std::left 
              << std::setw(name_column) << "MessagePack" << std::right 
              << std::setw(url_column) << "http://msgpack.org/" 
              << std::setw(special_column) << ""  << std::endl;
#endif
#ifdef PDAL_HAVE_NITRO
    os << std::left 
              << std::setw(name_column) << "Nitro" << std::right 
              << std::setw(url_column) << "http://github.com/hobu/nitro/" 
              << std::setw(special_column) << ""  << std::endl;
#endif
#ifdef PDAL_HAVE_ORACLE
    os << std::left 
              << std::setw(name_column) << "Oracle" << std::right 
              << std::setw(url_column) << "http://www.oracle.com/" 
              << std::setw(special_column) << ""  << std::endl;
#endif
#ifdef PDAL_HAVE_P2G
    os << std::left 
              << std::setw(name_column) << "Points2grid" << std::right 
              << std::setw(url_column) << "http://github.com/CRREL/points2grid/" 
              << std::setw(special_column) << ""  << std::endl;
#endif        
#ifdef PDAL_HAVE_PYTHON
    os << std::left 
              << std::setw(name_column) << "Python" << std::right 
              << std::setw(url_column) << "http://www.python.org" 
              << std::setw(special_column) << ""  << std::endl;
#endif        
#ifdef PDAL_HAVE_SOCI
    os << std::left 
              << std::setw(name_column) << "SOCI" << std::right 
              << std::setw(url_column) << "http://soci.sourceforge.net/" 
              << std::setw(special_column) << ""  << std::endl;
#endif        
#ifdef PDAL_HAVE_SQLITE
    os << std::left 
              << std::setw(name_column) << "SQLite" << std::right 
              << std::setw(url_column) << "http://www.sqlite.org/" 
              << std::setw(special_column) << ""  << std::endl;
#endif        
#ifdef PDAL_HAVE_POSTGRESQL
    os << std::left 
              << std::setw(name_column) << "PostgreSQL" << std::right 
              << std::setw(url_column) << "http://github.com/pramsey/pointcloud/" 
              << std::setw(special_column) << ""  << std::endl;
#endif
    os << thdr.str() << std::endl;
    
    return os.str();
}
Exemplo n.º 10
0
int Delta::execute()
{

    Options sourceOptions;
    {
        sourceOptions.add<std::string>("filename", m_sourceFile);
        sourceOptions.add<bool>("debug", isDebug());
        sourceOptions.add<boost::uint32_t>("verbose", getVerboseLevel());
    }
    Stage* source = AppSupport::makeReader(sourceOptions);
    source->initialize();
    
    boost::uint32_t totalPointCount(source->getNumPoints());
    
    PointBuffer source_data(source->getSchema(), totalPointCount);
    StageSequentialIterator* source_iter = source->createSequentialIterator(source_data);

    boost::uint32_t  numRead = source_iter->read(source_data);
    assert(numRead == source_data.getNumPoints());

    delete source_iter;
    delete source;



    Options candidateOptions;
    {
        candidateOptions.add<std::string>("filename", m_candidateFile);
        candidateOptions.add<bool>("debug", isDebug());
        candidateOptions.add<boost::uint32_t>("verbose", getVerboseLevel());
    }

    Stage* candidate = AppSupport::makeReader(candidateOptions);

    candidate->initialize();    


    IndexedPointBuffer candidate_data(candidate->getSchema(), totalPointCount);
    StageSequentialIterator* candidate_iter = candidate->createSequentialIterator(candidate_data);

    numRead = candidate_iter->read(candidate_data);
    assert(numRead == candidate_data.getNumPoints());
        
    delete candidate_iter;    


    if (source_data.getNumPoints() != candidate_data.getNumPoints())
    {
        std::cerr << "Source and candidate files do not have the same point count, testing each source point only!" << std::endl;
    }
    

    // m_summary_x(xd);
    // m_summary_y(yd);
    // m_summary_z(zd);

    if (m_outputFileName.size())
    {
        m_outputStream = FileUtils::createFile(m_outputFileName);
    }

    candidate_data.build(m_3d);
    boost::uint32_t count(std::min(source_data.getNumPoints(), candidate_data.getNumPoints()));
    


    boost::scoped_ptr<std::map<Point, Point> > points(cumulatePoints(source_data, candidate_data));
    if (m_OutputDetail)
    {
        outputDetail(source_data, candidate_data, points.get());
        return 0;
    }
    
    std::map<Point, Point>::const_iterator i;
    for(i = points->begin(); i != points->end(); ++i)
    {
        Point const& s = i->first;
        Point const& c = i->second;

        double xd = s.x - c.x;
        double yd = s.y - c.y;
        double zd = s.z - c.z;        
        m_summary_x(xd);
        m_summary_y(yd);
        m_summary_z(zd);        
    }
    
    std::string headline("------------------------------------------------------------------------------------------");
    std::cout << headline << std::endl;
    std::cout << " Delta summary for source '" << m_sourceFile << "' and candidate '" << m_candidateFile <<"'" << std::endl;
    std::cout << headline << std::endl;
    std::cout << std::endl;
    
    std::string thead("----------- --------------- --------------- --------------");
    std::cout << thead << std::endl;
    std::cout << " Dimension       X             Y                  Z    " << std::endl;
    std::cout << thead << std::endl;
    
    boost::format fmt("%.4f");
    double sminx  = (boost::accumulators::min)(m_summary_x);
    double sminy  = (boost::accumulators::min)(m_summary_y);
    double sminz  = (boost::accumulators::min)(m_summary_z);
    double smaxx  = (boost::accumulators::max)(m_summary_x);
    double smaxy  = (boost::accumulators::max)(m_summary_y);
    double smaxz  = (boost::accumulators::max)(m_summary_z);
    
    double smeanx  = (boost::accumulators::mean)(m_summary_x);
    double smeany  = (boost::accumulators::mean)(m_summary_y);
    double smeanz  = (boost::accumulators::mean)(m_summary_z);
    
    std::cout << " Min        " << fmt % sminx << "            " << fmt % sminy << "            " << fmt % sminz<<std::endl;
    std::cout << " Min        " << fmt % smaxx << "            " << fmt % smaxy << "            " << fmt % smaxz<<std::endl;
    std::cout << " Mean       " << fmt % smeanx << "            " << fmt % smeany << "            " << fmt % smeanz<<std::endl;
    std::cout << thead << std::endl;
    
    return 0;
}
Exemplo n.º 11
0
std::string getPDALDebugInformation()
{
    Utils::screenWidth();
    std::string headline(Utils::screenWidth(), '-');

    std::ostringstream os;

    os << headline << std::endl;
    os << "PDAL debug information" << std::endl ;
    os << headline << std::endl << std::endl;

    os << "Version information" << std::endl;
    os << headline << std::endl;
    os << "(" << pdal::GetFullVersionString() << ")" << std::endl;
    os << std::endl;

    os << "Debug build status" << std::endl;
    os << headline << std::endl;
    os << PDAL_BUILD_TYPE << std::endl << std::endl;

    os << "Enabled libraries" << std::endl;
    os << headline << std::endl << std::endl;

#ifdef PDAL_HAVE_GEOS
    os << "GEOS (" << GEOS_VERSION << ") - " <<
        "http://trac.osgeo.org/geos" << std::endl;
#endif

    os << "GDAL (" << GDALVersionInfo("RELEASE_NAME") << ") - " <<
        "http://www.gdal.org" << std::endl;

#ifdef PDAL_HAVE_HEXER
    os << "Hexer (" << HEXER_VERSION_MAJOR << '.' << HEXER_VERSION_MINOR <<
        '.' << HEXER_VERSION_PATCH << ") - " <<
        "http://github.com/hobu/hexer" << std::endl;
#endif

#ifdef PDAL_HAVE_LASZIP
    os << "LASzip (" << LASZIP_VERSION_MAJOR << "." << LASZIP_VERSION_MINOR <<
        "." << LASZIP_VERSION_REVISION << ") - " <<
        "http://laszip.org" << std::endl;
#endif

#ifdef PDAL_HAVE_LIBXML2
    os << "libxml (" << LIBXML_DOTTED_VERSION << ") - " <<
              "http://www.xmlsoft.org/" << std::endl;
#endif

#ifdef PDAL_HAVE_LIBGEOTIFF
    os << "libgeotiff (" << LIBGEOTIFF_VERSION << ") - " <<
        "http://trac.osgeo.org/geotiff" << std::endl;
#endif

#ifdef PDAL_HAVE_MRSID
    os << "MrSID - " << "http://www.lizardtech.com" << std::endl;
#endif

#ifdef PDAL_HAVE_NITRO
    os << "Nitro - " << "http://github.com/hobu/nitro" << std::endl;
#endif

#ifdef PDAL_HAVE_ORACLE
    os << "Oracle - " << "http://www.oracle.com" << std::endl;
#endif

#ifdef PDAL_HAVE_P2G
    os << "Points2grid = " <<
        "http://github.com/CRREL/points2grid" << std::endl;
#endif

#ifdef PDAL_HAVE_PYTHON
    os << "Python - " << "http://www.python.org" << std::endl;
#endif

#ifdef PDAL_HAVE_SQLITE
    os << "SQLite - " << "http://www.sqlite.org" << std::endl;
#endif

#ifdef PDAL_HAVE_POSTGRESQL
    os << "PostgreSQL - " <<
        "http://github.com/pramsey/pointcloud" << std::endl;
#endif

    return os.str();
}
Exemplo n.º 12
0
static int nextkey(char *valinta)
        {
        int m;
        long time1,time2;
// RS REM        char x[LLENGTH];
        extern int muste_help_running; // RS ADD

        time((time_t *)&time1);
        while (1)
            {
            if (*info_2)
                {
                if (sur_get_message(info_2,1))
                    {
                    return(-9);
                    }
                }
    
            if (sur_kbhit()) break;
            time((time_t *)&time2);
            if (difftime(time2,time1)>0.5)
                {
                headline(valinta);
                time1=time2;
if (muste_get_R_int(".muste$exitpressed")) // RS 27.2.2013
    {
    muste_set_R_int(".muste$exitpressed",0);
    return(CODE_EXIT);
    }                           
                }
            sur_sleep(10);
            }

        special=0;
        m=s_getch(); 
        switch (m)
            {
          case EXTEND_CH: m=sur_getch_ext();                 
                          special=1;                          
                  switch (m)
                      {
                        case CODE_EXIT:
                        case CODE_RETURN: 
                        case CODE_RIGHT:
                        case CODE_LEFT:
                        case CODE_UP:
                        case CODE_DOWN:
                        case CODE_HOME:
                        case CODE_INSERT:
                        case CODE_INSERTL:
                        case CODE_DELETE:
                        case CODE_DELETEL:
                        case CODE_ERASE:
                        case CODE_NEXT:
                        case CODE_PREV:
                        case CODE_EXEC:
                        case CODE_DISP:
                        case CODE_PRE:
                        case CODE_TOUCH:
                        case CODE_DISK:
                        case CODE_CODE: break;
                        case CODE_BACKSP: if (!muste_help_running) m=CODE_LEFT; break; // RS ADD
                        case CODE_REF:
                        case CODE_MERGE:
                        case CODE_COPY:
                        case CODE_TAB:
                        case CODE_TABS:
                        case CODE_HELP:
                        case CODE_SRCH:
                        case CODE_ACTIV:
                        case CODE_MOVE:
                        case CODE_END:
                        case CODE_WORDS:
                        case CODE_SOFT_ON:
                        case CODE_RIGHT2:
                        case CODE_LEFT2:
                        case CODE_UP2:
                        case CODE_DOWN2:
                        case CODE_SUCRO1:
                        case CODE_SUCRO2:
                        case CODE_SUCRO3:
                        case CODE_SUCRO4:
                        case CODE_SUCRO5:
                        case CODE_SUCRO6:
                        case CODE_SUCRO7:
                        case CODE_SUCRO8:
                        case CODE_REF_SET:
                        case CODE_REXEC:    
                        case CODE_RIGHT3:   
                        case CODE_PASTE:    
                        case CODE_CLIPCOPY: break;
                        default: m=32; break;
					  }
					  
          case CODE_RETURN: special=1; break;
          case CODE_BACKSP: special=1; m=CODE_LEFT; break;
          case CODE_EXEC: special=1; break;
          case CODE_TAB: special=1; break;
          default: break;
            }                    
        return(m);
        }					  
Exemplo n.º 13
0
char *h2(const char *buf, regmatch_t matches[], size_t nmatch, size_t off)
{
	return headline('-', buf, matches, nmatch, off);
}
Exemplo n.º 14
0
int main (int argc, char *argv[])
{
    int ipstart=1, ipend=2;
    int t,u;
    int portnumber=1;
    int maxarg=3;
    int poscounter = 0;
    int position[argc];

    int optionport=5,optionpcounter=0, pposition=0;
    int optionw=5,optionwcounter=0, wposition=0;
    int optionname=5, optionnamecounter=0, nameposition;
    int optioncso=5, optioncsocounter=0, csoposition;
    int optionf=5, optionfcounter=0, fposition;
    int optionnocolor=5, optionnocolorcounter=0, nocolorposition;
    int optionjson=5, optionjsoncounter=0, jsonposition;
    int optionleft=5, optionleftcounter=0, leftposition;

    char *filename = {"stdout\0"};

    for (t=1; t<argc; t++) {

        if (strcmp(argv[t], "--port") == 0) {
            optionport = 1;
            optionpcounter += 1;
            pposition = t;
            maxarg += 2;
            portnumber = atoi(argv[t+1]);
        }

        if (strcmp(argv[t], "--file") == 0) {
            optionf = 1;
            optionfcounter += 1;
            fposition = t;
            maxarg +=2;
            filename = argv[t+1];
        }

        if (strcmp(argv[t], "--without-blank") == 0) {
            optionw = 1;
            optionwcounter += 1;
            wposition = t;
            maxarg += 1;
        }

        if (strcmp(argv[t], "--namelookup") == 0) {
            optionname = 1;
            optionnamecounter += 1;
            maxarg += 1;
            nameposition = t;
        }

        if (strcmp(argv[t], "--commaseparated") == 0) {
          optioncso = 1;
          optioncsocounter += 1;
          csoposition = t;
          maxarg +=1;
        }

        if (strcmp(argv[t], "--nocolor") == 0) {
          optionnocolor = 1;
          optionnocolorcounter += 1;
          nocolorposition = t;
          maxarg +=1;
        }

        if (strcmp(argv[t], "--json") == 0) {
          optionjson = 1;
          optionjsoncounter += 1;
          jsonposition = t;
          maxarg +=1;
        }

        if (strcmp(argv[t], "--left") == 0) {
          optionleft = 1;
          optionleftcounter += 1;
          leftposition = t;
          maxarg +=1;
        }

        if ((argv[t][0] == '-') && (argv[t][1] != '-'))
          for (u=0; u<strlen(argv[t]);u++) {
            if (argv[t][u] == 'w') {
              optionw = 1;
              optionwcounter += 1;
              wposition = t;
              if (u==1)
                maxarg += 1;
            }
            if (argv[t][u] == 'p') {
              optionport = 1;
              optionpcounter += 1;
              pposition = t;
              if (u==1)
                maxarg += 1;
              maxarg += 1;
              portnumber = atoi(argv[t+1]);
            }
            if (argv[t][u] == 'f') {
              optionf = 1;
              optionfcounter += 1;
              fposition = t;
              if (u==1)
                maxarg +=1;
              maxarg +=1;
              filename = argv[t+1];
            }
            if (argv[t][u] == 'n') {
              optionname = 1;
              optionnamecounter += 1;
              if (u==1)
                maxarg += 1;
              nameposition = t;
            }
            if (argv[t][u] == 'c') {
              optioncso = 1;
              optioncsocounter += 1;
              csoposition = t;
              if (u==1)
                maxarg +=1;
            }
            if (argv[t][u] == 'b') {
              optionnocolor = 1;
              optionnocolorcounter += 1;
              nocolorposition = t;
              if (u==1)
                maxarg +=1;
            }
            if (argv[t][u] == 'j') {
              optionjson = 1;
              optionjsoncounter += 1;
              jsonposition = t;
              if (u==1)
                maxarg +=1;
            }
            if (argv[t][u] == 'l') {
              optionleft = 1;
              optionleftcounter += 1;
              leftposition = t;
              if (u==1)
                maxarg +=1;
            }
          }
   }

    if (
        (optionwcounter > 1) ||
        (optionpcounter > 1) ||
        (optionnamecounter > 1) ||
        (optioncsocounter > 1) ||
        (optionfcounter > 1) ||
        (optionnocolorcounter > 1) ||
        (optionjsoncounter > 1) ||
        (optionleftcounter > 1)
       )
    {
        errdupopt();
        return 1;
    }

    if (portnumber < 1 || portnumber > 65535){
        errinvalport();
        return 1;
    }

    for (t=1; t<argc; t++) {
        if (pposition == t) {
            position[t] = 0;
            t++;
            position[t] = 0;
        }
        else if (fposition == t) {
          position[t] = 0;
          t++;
          position[t] = 0;
        }
        else if (wposition == t)
            position[t] = 0;
        else if (nameposition == t)
            position[t] = 0;
        else if (csoposition == t)
            position[t] = 0;
        else if (nocolorposition == t)
            position[t] = 0;
        else if (jsonposition == t)
            position[t] = 0;
        else if (leftposition == t)
            position[t] = 0;
        else
            position[t] = 1;
    }

    for (t=1; t<argc; t++) {
        if (position[t] == 1) {
            if (poscounter == 0) {
                ipstart = t;
                poscounter += 1;
            }
            if (poscounter == 1)
                ipend = t;
        }
    }

  if ((argc < 2) || (argc > maxarg)) {
    errexptiprange();
    usage(argv[0]);
    exit(1);
  }

  if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
    description();
    usage(argv[0]);
    help();
    exit(0);
  }

  if ((strcmp(argv[1], "-v") == 0) || (strcmp(argv[1], "--version") == 0)) {
    version();
    exit(0);
  }

  int endsec, startsec;
  startsec = time(NULL);
  int i,istart,iend;
  int re;
  char cmd[100];
  char runningip[50];
  char ping[50];
  char network[100];

  strcpy(network, argv[ipstart]);
  int addr[4];
  int counter=1;
  char delimiter[] = ".";
  char *ptr;
  FILE *stream[255];
  char pingend[20];

  ptr = strtok(network, delimiter);

  while (ptr != NULL) {
        addr[counter] = atoi(ptr);
        counter++;
        ptr = strtok(NULL, delimiter);
        if (counter > 5) {
            errip();
            return 1;
        }
  }

  for(counter=1; counter<5; counter++) {
    if ((addr[counter] > 255) || (addr[counter] < 0)) {
      errip();
      return 1;
    }
  }
  strcpy(ping, "ping -c 2 -W 1 ");
  strcpy(pingend, " >/dev/null");

  istart = addr[4];
  iend = atoi(argv[ipend]);

  if ((iend - istart) < 0) {
      errnegip();
      return 1;
  }
  if ((iend > 255) || (iend < 0)) {
      errvalran();
      return 1;
  }

  int cpid, childreturn;
  int ch_return[(iend - istart + 1)];
  int ch_pid[(iend - istart + 1)];

  for (i=istart; i<=iend; i++) {
    strcpy(runningip, "");
    sprintf(runningip, "%d.%d.%d.%d", addr[1], addr[2], addr[3], i);
    strcpy(cmd, ping);
    strcat(cmd, runningip);
    strcat(cmd, pingend);
    stream[i] = popen(cmd, "r");

    if (optionport == 1) {
      cpid = fork();
      switch (cpid) {
        case 0:
            childreturn = portconnection(portnumber, runningip);
            exit(childreturn);
          break;
        case -1:
            perror("Error: fork()");
          break;
      default:
            ch_pid[i] = cpid;
          break;
      }
    }
  }

  FILE *outputfile;
  if (strcmp(filename, "stdout") != 0) {
    outputfile = fopen(filename, "w");
    fclose(outputfile);
  }

  if ((optioncso != 1) && (optionjson != 1))
    headline(optionport, portnumber, optionw, optionname, filename, optionleft);

  if (optionjson == 1) {
    if (strcmp(filename, "stdout") != 0)
      outputfile = fopen(filename, "a");
    else
      outputfile = stdout;
    fprintf(outputfile, "{\"netchk\":");
    if (strcmp(filename, "stdout") != 0)
      fclose(outputfile);
  }

  for (i=istart; i<=iend; i++) {

    re = pclose(stream[i]);
    strcpy(runningip, "");
    sprintf(runningip, "%d.%d.%d.%d", addr[1], addr[2], addr[3], i);

    evaluation_ping(re, runningip, optioncso, filename, optionnocolor, optionjson, optionleft);
    lookup(runningip, optionname, optioncso, filename, optionnocolor, optionjson, optionleft);
    if (optionport == 1) {
      waitpid(ch_pid[i], &ch_return[i], WUNTRACED);
      evaluation_port(ch_return[i]/256, optioncso, filename, optionnocolor, optionjson, optionleft);
    }

   if (strcmp(filename, "stdout") != 0)
     outputfile = fopen(filename, "a");
   else
     outputfile = stdout;

   if (optionjson != 1)
     fprintf(outputfile, "\n");
   else {
     fprintf(outputfile, "}");
     if (i != iend)
       fprintf(outputfile, ",");
   }

   if (optionw != 1)
     fprintf(outputfile, "\n");

   if (strcmp(filename, "stdout") != 0)
    fclose(outputfile);
  }

  if (optionjson == 1) {
    if (strcmp(filename, "stdout") != 0)
      outputfile = fopen(filename, "a");
    else
      outputfile = stdout;
    fprintf(outputfile, "}");
    if (strcmp(filename, "stdout") != 0)
      fclose(outputfile);
  }

  endsec = time(NULL);

  if ((optioncso != 1) && (optionjson != 1))
    end((endsec - startsec), (iend - istart + 1), optionw, filename);

  return 0;
}