Build-fixes for Mac
This commit is contained in:
parent
7c842403fe
commit
5c5db25930
4 changed files with 14 additions and 50 deletions
|
@ -43,10 +43,6 @@ using std:: string ;
|
|||
|
||||
#define MAXBUF 1024
|
||||
|
||||
#if defined (__APPLE__)
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
static double start_lon, start_lat;
|
||||
static double lat = 0.0;
|
||||
static double lon = 0.0;
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/bucket/newbucket.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -17,12 +18,6 @@ using std::cout;
|
|||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define M_ISDIR _S_IFDIR
|
||||
#else
|
||||
#define M_ISDIR __S_IFDIR
|
||||
#endif
|
||||
|
||||
static void give_help( char * name )
|
||||
{
|
||||
cout << "Usage: " << name << " longitude latitude work_dir" << endl;
|
||||
|
@ -43,18 +38,6 @@ static void check_for_help( int argc, char **argv )
|
|||
}
|
||||
}
|
||||
|
||||
static int is_file_or_directory( char * cur_item )
|
||||
{
|
||||
struct stat buf;
|
||||
if( stat( cur_item, &buf ) == 0 ) {
|
||||
if ( buf.st_mode & M_ISDIR )
|
||||
return 1; // is directory
|
||||
else
|
||||
return 2; // is file
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
double lon, lat;
|
||||
|
||||
|
@ -76,7 +59,7 @@ int main( int argc, char **argv ) {
|
|||
lat = atof( argv[2] );
|
||||
string work_dir = argv[3];
|
||||
|
||||
if ( is_file_or_directory((char *) work_dir.c_str() ) != 1 ) {
|
||||
if ( !SGPath(work_dir).isDir() ) {
|
||||
cout << "ERROR: '" << work_dir << "' is not a valid directory!" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
@ -96,7 +79,7 @@ int main( int argc, char **argv ) {
|
|||
string base = b.gen_base_path();
|
||||
string path = work_dir + "/" + base;
|
||||
|
||||
if ( is_file_or_directory((char *) path.c_str() ) != 1 ) {
|
||||
if ( !SGPath(path).isDir() ) {
|
||||
cout << "ERROR: '" << path << "' is not a valid directory!" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
@ -105,9 +88,9 @@ int main( int argc, char **argv ) {
|
|||
cout << "arraybase = " << arraybase << endl;
|
||||
|
||||
path = arraybase + ".arr";
|
||||
if ( is_file_or_directory((char *) path.c_str() ) != 2 ) {
|
||||
if ( !SGPath(path).exists() ) {
|
||||
path += ".gz";
|
||||
if ( is_file_or_directory((char *) path.c_str() ) != 2 ) {
|
||||
if ( !SGPath(path).exists() ) {
|
||||
cout << "WARNING: can not locate " << arraybase << ".arr, nor .arr.gz!" << endl;
|
||||
cout << "Query will probably fail, with zero result!" << endl;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
bin_PROGRAMS = raw2ascii
|
||||
|
||||
raw2ascii_SOURCES = main.c rawdem.c rawdem.h
|
||||
raw2ascii_SOURCES = main.cxx rawdem.c rawdem.h
|
||||
|
||||
raw2ascii_LDADD = $(base_LIBS) -lsgmisc -lsgdebug
|
||||
|
||||
raw2ascii_LDADD = $(base_LIBS)
|
||||
|
|
|
@ -38,15 +38,11 @@
|
|||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "rawdem.h"
|
||||
extern "C" {
|
||||
#include "rawdem.h"
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define M_ISDIR _S_IFDIR
|
||||
#else
|
||||
#define M_ISDIR __S_IFDIR
|
||||
#endif
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
static void give_help( char * name )
|
||||
{
|
||||
|
@ -58,18 +54,6 @@ static void give_help( char * name )
|
|||
printf(" --max-lon=<degs> - set maximum longitude for output.\n");
|
||||
}
|
||||
|
||||
static int is_file_or_directory( char * cur_item )
|
||||
{
|
||||
struct stat buf;
|
||||
if( stat( cur_item, &buf ) == 0 ) {
|
||||
if ( buf.st_mode & M_ISDIR )
|
||||
return 1; // is directory
|
||||
else
|
||||
return 2; // is file
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
static fgRAWDEM raw;
|
||||
static char basename[256], output_dir[256], hdr_file[256], dem_file[256];
|
||||
|
@ -176,7 +160,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
/* get output dir */
|
||||
strcpy(output_dir, argv[last_arg+1]);
|
||||
if ( is_file_or_directory( output_dir ) != 1 ) {
|
||||
if (!SGPath(output_dir).isDir() ) {
|
||||
printf( "ERROR: Ouput directory [%s], does not exist!\n", output_dir );
|
||||
exit(1);
|
||||
}
|
Loading…
Reference in a new issue