Пример #1
0
int main(int argc, char **argv)
{
	int ret;
	if (argc < 2)
		return usage(argv[0]);

	if (CHECK_ARG(1, "start"))
	{
		printf(SUCCESS "Starting Synergy server..." NEWLINE);
		ret = runProcess(8, 0, NULL, NULL, "/usr/bin/synergys", "-a", "192.168.10.4", "--display", ":0", "-l", "/var/log/synergys.log", NULL);
		return evaluateRetVal(ret);
	}
	else if (CHECK_ARG(1, "restart"))
	{
		runProcess(2, RUN_PROC_PASS_STDOUT, NULL, NULL, argv[0], "stop");
		usleep(50);
		runProcess(2, RUN_PROC_PASS_STDOUT, NULL, NULL, argv[0], "start");
	}
	else if (CHECK_ARG(1, "stop"))
	{
		printf(FAILURE "Stopping Synergy server..." NEWLINE);
		ret = killProc("/usr/bin/synergys", NULL, -1, 0);
		return evaluateRetVal(ret);
	}
	else if (CHECK_ARG(1, "status"))
		return statusProc("/usr/bin/synergys", NULL);
	else
		return usage(argv[0]);
}
Пример #2
0
Method class_getInstanceMethod(Class aClass, SEL aSelector)
{
	CHECK_ARG(aClass);
	CHECK_ARG(aSelector);
	// If the class has a dtable installed, then we can use the fast path
	if (classHasInstalledDtable(aClass))
	{
		// Do a dtable lookup to find out which class the method comes from.
		struct objc_slot *slot = objc_get_slot(aClass, aSelector);
		if (NULL == slot)
		{
			slot = objc_get_slot(aClass, sel_registerName(sel_getName(aSelector)));
			if (NULL == slot)
			{
				return NULL;
			}
		}

		// Now find the typed variant of the selector, with the correct types.
		aSelector = slot->selector;

		// Then do the slow lookup to find the method.
		return class_getInstanceMethodNonrecursive(slot->owner, aSelector);
	}
	Method m = class_getInstanceMethodNonrecursive(aClass, aSelector);
	if (NULL != m)
	{
		return m;
	}
	return class_getInstanceMethod(class_getSuperclass(aClass), aSelector);
}
Пример #3
0
int main (int argc, char *argv[])
{
	int i;
	int ret;

#ifdef HAVE_GTK
	gtk_init(&argc, &argv);
#if !GLIB_CHECK_VERSION(2,32,0) // backward compatibility with Debian 6 and CentOS 6
	g_thread_init(NULL);
#endif
	gdk_threads_init();
#endif

	liblinphone_tester_init(NULL);
	linphone_core_set_log_level(ORTP_ERROR);

	for(i = 1; i < argc; ++i) {
		if (strcmp(argv[i], "--verbose") == 0) {
			linphone_core_set_log_level(ORTP_MESSAGE);
		} else if (strcmp(argv[i], "--silent") == 0) {
			linphone_core_set_log_level(ORTP_FATAL);
		} else if (strcmp(argv[i],"--log-file")==0){
			CHECK_ARG("--log-file", ++i, argc);
			if (liblinphone_tester_set_log_file(argv[i]) < 0) return -2;
		} else if (strcmp(argv[i],"--domain")==0){
			CHECK_ARG("--domain", ++i, argc);
			test_domain=argv[i];
		} else if (strcmp(argv[i],"--auth-domain")==0){
			CHECK_ARG("--auth-domain", ++i, argc);
			auth_domain=argv[i];
		}else if (strcmp(argv[i],"--dns-hosts")==0){
			CHECK_ARG("--dns-hosts", ++i, argc);
			userhostsfile=argv[i];
		} else if (strcmp(argv[i],"--keep-recorded-files")==0){
			liblinphone_tester_keep_recorded_files(TRUE);
		} else if (strcmp(argv[i],"--disable-leak-detector")==0){
			liblinphone_tester_disable_leak_detector(TRUE);
		} else if (strcmp(argv[i],"--disable-tls-support")==0){
			liblinphone_tester_tls_support_disabled = TRUE;
		} else if (strcmp(argv[i],"--no-ipv6")==0){
			liblinphonetester_ipv6 = FALSE;
		} else if (strcmp(argv[i],"--show-account-manager-logs")==0){
			liblinphonetester_show_account_manager_logs=TRUE;
		} else {
			int bret = bc_tester_parse_args(argc, argv, i);
			if (bret>0) {
				i += bret - 1;
				continue;
			} else if (bret<0) {
				bc_tester_helper(argv[0], liblinphone_helper);
			}
			return bret;
		}
	}

	ret = bc_tester_start(argv[0]);
	liblinphone_tester_uninit();
	return ret;
}
Пример #4
0
int main (int argc, char *argv[]) {
	int i;
	int ret;
	const char *root_ca_path = NULL;
	const char *env_domain=getenv("TEST_DOMAIN");

	belle_sip_tester_init(NULL);

#ifndef WIN32   /*this hack doesn't work for argv[0]="c:\blablab\"*/
	// this allows to launch liblinphone_tester from outside of tester directory
	if (strstr(argv[0], ".libs")) {
		int prefix_length = strstr(argv[0], ".libs") - argv[0] + 1;
		char *prefix = belle_sip_strdup_printf("%s%.*s", argv[0][0] == '/' ? "" : "./", prefix_length, argv[0]);
		// printf("Resource prefix set to %s\n", prefix);
		bc_tester_set_resource_dir_prefix(prefix);
		bc_tester_set_writable_dir_prefix(prefix);
		belle_sip_free(prefix);
	}
#endif

	if (env_domain) {
		test_domain=env_domain;
	}

	for(i=1;i<argc;++i){
		if (strcmp(argv[i],"--verbose")==0){
			belle_sip_set_log_level(BELLE_SIP_LOG_DEBUG);
		} else if (strcmp(argv[i],"--silent")==0){
			belle_sip_set_log_level(BELLE_SIP_LOG_FATAL);
		} else if (strcmp(argv[i],"--log-file")==0){
			CHECK_ARG("--log-file", ++i, argc);
			if (belle_sip_tester_set_log_file(argv[i]) < 0) return -2;
		} else if (strcmp(argv[i],"--domain")==0){
			CHECK_ARG("--domain", ++i, argc);
			test_domain=argv[i];
		}else if (strcmp(argv[i],"--auth-domain")==0){
			CHECK_ARG("--auth-domain", ++i, argc);
			auth_domain=argv[i];
		} else if (strcmp(argv[i], "--root-ca") == 0) {
			CHECK_ARG("--root-ca", ++i, argc);
			root_ca_path = argv[i];
		}else {
			int ret = bc_tester_parse_args(argc, argv, i);
			if (ret>0) {
				i += ret - 1;
				continue;
			} else if (ret<0) {
				bc_tester_helper(argv[0], belle_sip_helper);
			}
			return ret;
		}
	}
	belle_sip_tester_set_root_ca_path(root_ca_path);
	pool=belle_sip_object_pool_push();

	ret = bc_tester_start(argv[0]);
	belle_sip_tester_uninit();
	return ret;
}
Пример #5
0
Class class_setSuperclass(Class cls, Class newSuper)
{
	CHECK_ARG(cls);
	CHECK_ARG(newSuper);
	if (Nil == cls) { return Nil; }
	Class oldSuper = cls->super_class;
	cls->super_class = newSuper;
	return oldSuper;
}
Пример #6
0
static void b_magickCompressImage1(task *tsk, pntr *argstack)
{
    /* pointers to the parameters */
    pntr val1 = argstack[4]; // imageFile
    pntr val2 = argstack[3]; // outputImage
    pntr val3 = argstack[2]; // format
    pntr val4 = argstack[1]; // compressionType
    pntr val5 = argstack[0]; // compressionRate
    int badtype;

    /* the result value to be return */
    int result;

    char *imageFile;
    char *outputImage;
    char *format;
    int compressionType;
    double compressionRate;

    /* Check validity of each parameter */
    CHECK_ARG(4, CELL_CONS);
    CHECK_ARG(3, CELL_CONS);
    CHECK_ARG(2, CELL_CONS);
    CHECK_ARG(1, CELL_NUMBER);
    CHECK_ARG(0, CELL_NUMBER);

    /* Initialize all arguments for this method */
    if( (badtype = array_to_string(val1, &imageFile)) > 0) {
        set_error(tsk, "string: argument is not a string (contains non-char: %s)", cell_types[badtype]);
        return;
    }

    if( (badtype = array_to_string(val2, &outputImage)) > 0) {
        set_error(tsk, "string: argument is not a string (contains non-char: %s)", cell_types[badtype]);
        return;
    }

    if( (badtype = array_to_string(val3, &format)) > 0) {
        set_error(tsk, "string: argument is not a string (contains non-char: %s)", cell_types[badtype]);
        return;
    }

    compressionType = pntrdouble(val4);
    compressionRate = pntrdouble(val5);

    /* Call the method and get the return value */
    result = magickCompressImage(imageFile, outputImage, format, compressionType, compressionRate);

    /* Translate the resultant pntr to be return */
    pntr p_result;
    set_pntrdouble(p_result, result);

    /* set the return value */
    argstack[0] = p_result;
}
Пример #7
0
int main (int argc, char *argv[]) {
	int i;
	int ret;
	const char *root_ca_path = NULL;
	const char *env_domain=getenv("TEST_DOMAIN");

	belle_sip_tester_init();

	if (env_domain) {
		test_domain=env_domain;
	}

	for(i=1;i<argc;++i){
		if (strcmp(argv[i],"--verbose")==0){
			belle_sip_set_log_level(BELLE_SIP_LOG_DEBUG);
		} else if (strcmp(argv[i],"--silent")==0){
			belle_sip_set_log_level(BELLE_SIP_LOG_FATAL);
		} else if (strcmp(argv[i],"--log-file")==0){
			CHECK_ARG("--log-file", ++i, argc);
			log_file=fopen(argv[i],"w");
			if (!log_file) {
				belle_sip_error("Cannot open file [%s] for writing logs because [%s]",argv[i],strerror(errno));
				return -2;
			} else {
				belle_sip_message("Redirecting traces to file [%s]",argv[i]);
				belle_sip_set_log_file(log_file);
			}
		} else if (strcmp(argv[i],"--domain")==0){
			CHECK_ARG("--domain", ++i, argc);
			test_domain=argv[i];
		}else if (strcmp(argv[i],"--auth-domain")==0){
			CHECK_ARG("--auth-domain", ++i, argc);
			auth_domain=argv[i];
		} else if (strcmp(argv[i], "--root-ca") == 0) {
			CHECK_ARG("--root-ca", ++i, argc);
			root_ca_path = argv[i];
		}else {
			int ret = bc_tester_parse_args(argc, argv, i);
			if (ret>0) {
				i += ret - 1;
				continue;
			} else if (ret<0) {
				bc_tester_helper(argv[0], belle_sip_helper);
			}
			return ret;
		}
	}
	belle_sip_tester_set_root_ca_path(root_ca_path);
	pool=belle_sip_object_pool_push();

	ret = bc_tester_start();
	belle_sip_tester_uninit();
	return ret;
}
Пример #8
0
static void b_magickModulateImage1(task *tsk, pntr *argstack)
{
    /* pointers to the parameters */
    pntr val1 = argstack[4]; // imageFile
    pntr val2 = argstack[3]; // outputImage
    pntr val3 = argstack[2]; // brightness
    pntr val4 = argstack[1]; // saturation
    pntr val5 = argstack[0]; // hue
    int badtype;

    /* the result value to be return */
    int result;

    char *imageFile;
    char *outputImage;
    double brightness;
    double saturation;
    double hue;

    /* Check validity of each parameter */
    CHECK_ARG(4, CELL_CONS);
    CHECK_ARG(3, CELL_CONS);
    CHECK_ARG(2, CELL_NUMBER);
    CHECK_ARG(1, CELL_NUMBER);
    CHECK_ARG(0, CELL_NUMBER);

    /* Initialize all arguments for this method */
    if( (badtype = array_to_string(val1, &imageFile)) > 0) {
        set_error(tsk, "string: argument is not a string (contains non-char: %s)", cell_types[badtype]);
        return;
    }

    if( (badtype = array_to_string(val2, &outputImage)) > 0) {
        set_error(tsk, "string: argument is not a string (contains non-char: %s)", cell_types[badtype]);
        return;
    }

    brightness = pntrdouble(val3);
    saturation = pntrdouble(val4);
    hue = pntrdouble(val5);

    /* Call the method and get the return value */
    result = magickModulateImage(imageFile, outputImage, brightness, saturation, hue);

    /* Translate the resultant pntr to be return */
    pntr p_result;
    set_pntrdouble(p_result, result);

    /* set the return value */
    argstack[0] = p_result;
}
Пример #9
0
int main (int argc, char *argv[]) {
    program_name = GET_NEXT_ARG;

    //check to see how many arguments we have... if no args, then print usage and bail
    if (argc == 1) {
        print_usage(false);
        exit(EXIT_FAILURE);
    }

    char *current_arg = NULL;

    //first, read program options... loop over args until we reach one that doesn't start with '-'
    for (current_arg = PEEK_ARG ; (current_arg[0] == '-') ; current_arg = PEEK_ARG) {
        current_arg = GET_NEXT_ARG;
        // print help and quit
        if ( CHECK_ARG( OPT_HELP ) ) {
            print_usage(true);
            exit(EXIT_SUCCESS);
        }

        //print version and quit
        if ( CHECK_ARG( OPT_VERSION ) ) {
            printf("%s-%s\n\n", PACKAGE, VERSION);
            exit(EXIT_SUCCESS);
        }

        //turn on verbosity
        if ( CHECK_ARG( OPT_VERBOSE ) ) {
            increment_verbosity();
            v_printf(VERBOSE_NOTICE, "Verbosity level: %d", get_verbosity());
            continue;
        }

        //set the color palette
        if ( CHECK_ARG( OPT_COLOR ) ) {
            printf("COLOR PALETTE NOT YET IMPLEMENTED!!\n");
            continue; //go to next iteration of for() loop
        }

        //if we get here, we reached an unknown option
        printf("UNKNOWN OPTION: %s\n", *argv);
        exit(EXIT_FAILURE);
    }

    parse_line(argc, argv);

    //end of program
    return 0;
}
Пример #10
0
BOOL class_addIvar(Class cls, const char *name, size_t size, uint8_t alignment,
		const char *types)
{
	CHECK_ARG(cls);
	CHECK_ARG(name);
	CHECK_ARG(types);
	// You can't add ivars to initialized classes.  Note: We can't use the
	// resolved flag here because class_getInstanceVariable() sets it.
	if (objc_test_class_flag(cls, objc_class_flag_initialized))
	{
		return NO;
	}

	if (class_getInstanceVariable(cls, name) != NULL)
	{
		return NO;
	}

	struct objc_ivar_list *ivarlist = cls->ivars;

	if (NULL == ivarlist)
	{
		cls->ivars = malloc(sizeof(struct objc_ivar_list) + sizeof(struct objc_ivar));
		cls->ivars->count = 1;
	}
	else
	{
		ivarlist->count++;
		// objc_ivar_list contains one ivar.  Others follow it.
		cls->ivars = realloc(ivarlist, sizeof(struct objc_ivar_list) +
				(ivarlist->count) * sizeof(struct objc_ivar));
	}
	Ivar ivar = &cls->ivars->ivar_list[cls->ivars->count - 1];
	ivar->name = strdup(name);
	ivar->type = strdup(types);
	// Round up the offset of the ivar so it is correctly aligned.
	long offset = cls->instance_size >> alignment;

	if (offset << alignment != cls->instance_size)
	{
		offset++;
	}
	offset <<= alignment;

	ivar->offset = offset;
	// Increase the instance size to make space for this.
	cls->instance_size = ivar->offset + size;
	return YES;
}
Пример #11
0
BOOL class_addProtocol(Class cls, Protocol *protocol)
{
	CHECK_ARG(cls);
	CHECK_ARG(protocol);
	if (class_conformsToProtocol(cls, protocol)) { return NO; }
	struct objc_protocol_list *protocols =
		malloc(sizeof(struct objc_protocol_list) + sizeof(Protocol2*));
	if (protocols == NULL) { return NO; }
	protocols->next = cls->protocols;
	protocols->count = 1;
	protocols->list[0] = (Protocol2*)protocol;
	cls->protocols = protocols;

	return YES;
}
Пример #12
0
//// Check if the given file is a real directory or a Zip-archive
static void b_zzip_dir_real(task *tsk, pntr *argstack)
{
	char *fileName;
	int badtype;
	pntr p = argstack[0];
	int dirtype;
	
	CHECK_ARG(0, CELL_CONS);
	if((badtype = array_to_string(p, &fileName)) >= 0){
		set_error(tsk, "error1: argument is not a string (contains non-char: %s)", cell_types[badtype]);
		return;
	}
	
	//// the file to be ckecked exists, then we check it
	static const char* ext[] = { "", ".exe", ".EXE", 0 };
	ZZIP_DIR* dir = zzip_opendir_ext_io (fileName, ZZIP_PREFERZIP, ext, 0);

    if(dir){
    	if(zzip_dir_real(dir)){
    		dirtype = 1;
//	   		printf("%s is a directory.\n", fileName);
    	}else{
    		dirtype = 0;
//    		printf("%s is a zip-archive.\n", fileName);
    	}
//    	zzip_dir_close(dir);
    }else{
    	//// file failed to be open
    	dirtype = -1;
    }
	setnumber(&argstack[0], dirtype);
	
	return;
}
Пример #13
0
int main(int argc, char *argv[])
{
	char inDEMfile[255],outDEMfile[255],outAmpFile[255],inMetafile[255];

	system("date");
	printf("Program: reskew_dem\n\n");
	
/* parse commandline arguments */
	logflag=FALSE;
/* FIXME: WTF? */
currArg=1;
	while (currArg < (argc-NUM_ARGS)) {
		char *key = argv[currArg++];
		if (strmatch(key,"-log")) {
			CHECK_ARG(1);
			strcpy(logFile,GET_ARG(1));
			fLog = FOPEN(logFile, "a");
			logflag = TRUE;
		}
		else {printf( "\n**Invalid option:  %s\n",argv[currArg-1]); usage(argv[0]);}
	}
	if ((argc-currArg) < NUM_ARGS) {
		printf("Insufficient arguments.\n");
		usage(argv[0]);
	}
	strcpy(inMetafile, argv[currArg]);
	strcpy(inDEMfile, argv[currArg+1]);
	strcpy(outDEMfile,argv[currArg+2]);
	strcpy(outAmpFile,argv[currArg+3]);

	reskew_dem(inMetafile, inDEMfile, outDEMfile, outAmpFile, NULL, TRUE);

	exit(EXIT_SUCCESS);
}
Пример #14
0
int main (int argc, char *argv[]) {
	int i;
	int ret;
	
	bctoolbox_tester_init(NULL);


	for(i=1;i<argc;++i){
		if (strcmp(argv[i],"--verbose")==0){
			bctoolbox_set_log_level(log_domain, BCTOOLBOX_DEBUG);
		} else if (strcmp(argv[i],"--silent")==0){
			bctoolbox_set_log_level(log_domain, BCTOOLBOX_FATAL);
		} else if (strcmp(argv[i],"--log-file")==0){
			CHECK_ARG("--log-file", ++i, argc);
			if (bctoolbox_tester_set_log_file(argv[i]) < 0) return -2;
		}else {
			int ret = bc_tester_parse_args(argc, argv, i);
			if (ret>0) {
				i += ret - 1;
				continue;
			} else if (ret<0) {
				bc_tester_helper(argv[0], bctoolbox_helper);
			}
			return ret;
		}
	}
	ret = bc_tester_start(argv[0]);
	bctoolbox_tester_uninit();
	return ret;
}
Пример #15
0
// Main program body.
int
main (int argc, char *argv[])
{
    char *inFile, *maskFile, *outFile;
    int currArg = 1;
    int NUM_ARGS = 3;

    handle_license_and_version_args(argc, argv, ASF_NAME_STRING);
    asfSplashScreen(argc, argv);

    if (argc<=1)
        usage(ASF_NAME_STRING);
    else if (strmatches(argv[1],"-help","--help",NULL))
        print_help();

    while (currArg < (argc-NUM_ARGS)) {
        char *key = argv[currArg++];
        if (strmatches(key,"-help","--help",NULL)) {
            print_help(); // doesn't return
        }
        else if (strmatches(key,"-log","--log",NULL)) {
            CHECK_ARG(1);
            strcpy(logFile,GET_ARG(1));
            fLog = FOPEN(logFile, "a");
            logflag = TRUE;
        }
        else if (strmatches(key,"-quiet","--quiet","-q",NULL)) {
            quietflag = TRUE;
        }
        else {
            --currArg;
            break;
        }
    }

    if ((argc-currArg) < NUM_ARGS) {
        printf("Insufficient arguments.\n");
        usage(argv[0]);
    } else if ((argc-currArg) > NUM_ARGS) {
        printf("Unknown argument: %s\n", argv[currArg]);
        usage(argv[0]);
    }

    inFile = argv[currArg];
    maskFile = argv[currArg+1];
    outFile = argv[currArg+2];

    char *in_base = get_basename(inFile);
    char *out_base = get_basename(outFile);

    asfPrintStatus("Clipping image: %s -> %s\n", in_base, out_base);

    clip(inFile, maskFile, outFile);
    asfPrintStatus("Done.\n");

    free(in_base);
    free(out_base);

    return EXIT_SUCCESS;
}
Пример #16
0
Ivar * class_copyIvarList(Class cls, unsigned int *outCount)
{
	CHECK_ARG(cls);
	struct objc_ivar_list *ivarlist = NULL;
	unsigned int count = 0;
	unsigned int index;
	Ivar *list;

	if (Nil != cls)
	{
		ivarlist = cls->ivars;
	}
	if (ivarlist != NULL)
	{
		count = ivarlist->count;
	}
	if (outCount != NULL)
	{
		*outCount = count;
	}
	if (count == 0)
	{
		return NULL;
	}

	list = malloc((count + 1) * sizeof(struct objc_ivar *));
	list[count] = NULL;
	count = 0;
	for (index = 0; index < ivarlist->count; index++)
	{
		list[count++] = &ivarlist->ivar_list[index];
	}

	return list;
}
Пример #17
0
Protocol*__unsafe_unretained* class_copyProtocolList(Class cls, unsigned int *outCount)
{
	CHECK_ARG(cls);
	struct objc_protocol_list *protocolList = NULL;
	struct objc_protocol_list *list;
	unsigned int count = 0;
	Protocol **protocols;

	if (Nil != cls)
	{
		protocolList = cls->protocols;
	}
	for (list = protocolList; list != NULL; list = list->next)
	{
		count += list->count;
	}
	if (outCount != NULL)
	{
		*outCount = count;
	}
	if (count == 0)
	{
		return NULL;
	}

	protocols = malloc((count + 1) * sizeof(Protocol *));
	protocols[count] = NULL;
	count = 0;
	for (list = protocolList; list != NULL; list = list->next)
	{
		memcpy(&protocols[count], list->list, list->count * sizeof(Protocol *));
		count += list->count;
	}
	return protocols;
}
Пример #18
0
id class_createInstance(Class cls, size_t extraBytes)
{
	CHECK_ARG(cls);
	if (sizeof(id) == 4)
	{
		if (cls == SmallObjectClasses[0])
		{
			return (id)1;
		}
	}
	else
	{
		for (int i=0 ; i<4 ; i++)
		{
			if (cls == SmallObjectClasses[i])
			{
				return (id)(uintptr_t)((i<<1)+1);
			}
		}
	}

	if (Nil == cls)	{ return nil; }
	id obj = gc->allocate_class(cls, extraBytes);
	obj->isa = cls;
	call_cxx_construct(obj);
	return obj;
}
Пример #19
0
static void *
arg_host (unsigned int arg)
{
  CHECK_ARG (arg, STRING_P);
  if ((STRING_LENGTH (ARG_REF (arg))) != (OS_host_address_length ()))
    error_bad_range_arg (arg);
  return (STRING_POINTER (ARG_REF (arg)));
}
Пример #20
0
int main(int argc, char **argv)
{
  char *unwrapped_phase, *phase_mask, *baseline, *seeds, *slant_amplitude;
  char *slant_coherence, *ground_elevation, *ground_elevation_error;
  char *ground_amplitude, *ground_coherence, slant_elevation[255];
  char slant_elevation_error[255];
  extern int currArg; /* pre-initialized to 1; like optind */
  
  logflag=quietflag=0;
  
  /* parse command line */
  while (currArg < (argc-10)) {
    char *key = argv[currArg++];
    if (strmatch(key,"-log")) {
      CHECK_ARG(1)
	strcpy(logFile, GET_ARG(1));
      fLog = FOPEN(logFile, "a");
      logflag=1;
    }
    else if (strmatch(key,"-quiet")) {
      quietflag=1;
    }
    else {
      printf( "\n**Invalid option:  %s\n",argv[currArg-1]); 
      usage(argv[0]);
    }
  }
  if ((argc-currArg) < 10) {
    printf("Insufficient arguments.\n"); 
    usage(argv[0]);
  }
  unwrapped_phase = argv[currArg++];
  phase_mask = argv[currArg++];
  baseline = argv[currArg++];
  seeds  = argv[currArg++];
  sprintf(slant_elevation, "slant_ht");
  sprintf(slant_elevation_error, "slant_ht_err");
  slant_amplitude  = argv[currArg++];
  slant_coherence  = argv[currArg++];
  ground_elevation  = argv[currArg++];
  ground_elevation_error  = argv[currArg++];
  ground_amplitude  = argv[currArg++];
  ground_coherence = argv[currArg];
  
  asfSplashScreen (argc, argv);
  
  if (!logflag)
    //sprintf(logFile, "tmp%d.log", (int)getpid());
    strcpy(logFile, get_tmp_log_file("asf_elevation"));

  // Call library function that gets the work done
  asf_elevation(unwrapped_phase, phase_mask, baseline, seeds,
                slant_elevation, slant_elevation_error,
		slant_amplitude, slant_coherence, ground_elevation,
		ground_elevation_error, ground_amplitude, ground_coherence);

  return(0);
}
Пример #21
0
// Main program body.
int
main (int argc, char *argv[])
{
  char *inFile, *outFile;
  int currArg = 1;
  int NUM_ARGS = 2;
  int insar=FALSE, polarimetry=FALSE;

  handle_license_and_version_args(argc, argv, ASF_NAME_STRING);
  asfSplashScreen(argc, argv);

  if (argc<=1)
      usage(ASF_NAME_STRING);
  else if (strmatches(argv[1],"-help","--help",NULL))
      print_help();

  while (currArg < (argc-NUM_ARGS)) {
    char *key = argv[currArg++];
    if (strmatches(key,"-help","--help",NULL)) {
        print_help(); // doesn't return
    }
    else if (strmatches(key,"-log","--log",NULL)) {
      CHECK_ARG(1);
      strcpy(logFile,GET_ARG(1));
      fLog = FOPEN(logFile, "a");
      logflag = TRUE;
    }
    else if (strmatches(key,"-quiet","--quiet","-q",NULL)) {
      quietflag = TRUE;
    }
    else if (strmatches(key,"-insar_stack","--insar_stack","-i",NULL)) {
      insar = TRUE;
    }
    else if (strmatches(key,"-polarimetry_stack","--polarimetry_stack","-p",NULL)) {
      polarimetry = TRUE;
    }
    else {
        --currArg;
        break;
    }
  }

  if ((argc-currArg) < NUM_ARGS) {
    printf("Insufficient arguments.\n");
    usage(argv[0]);
  } else if ((argc-currArg) > NUM_ARGS) {
    printf("Unknown argument: %s\n", argv[currArg]);
    usage(argv[0]);
  }

  inFile = argv[currArg];
  outFile = argv[currArg+1];

  asf_airsar_import(inFile, outFile, insar, polarimetry);
  asfPrintStatus("\nDone.\n");
  
  return EXIT_SUCCESS;
}
Пример #22
0
static datum
arg_datum (int arg)
{
  datum d;
  CHECK_ARG (arg, STRING_P);
  (d . dptr) = (STRING_POINTER (ARG_REF (arg)));
  (d . dsize) = (STRING_LENGTH (ARG_REF (arg)));
  return (d);
}
Пример #23
0
id objc_getRequiredClass(const char *name)
{
	CHECK_ARG(name);
	id cls = objc_getClass(name);
	if (nil == cls)
	{
		abort();
	}
	return cls;
}
Пример #24
0
Class object_getClass(id obj)
{
	CHECK_ARG(obj);
	Class isa = classForObject(obj);
	while ((Nil != isa) && objc_test_class_flag(isa, objc_class_flag_hidden_class))
	{
		isa = isa->super_class;
	}
	return isa;
}
Пример #25
0
Class object_setClass(id obj, Class cls)
{
	CHECK_ARG(obj);
	// If this is a small object, then don't set its class.
	uintptr_t addr = (uintptr_t)obj;
	if (addr & 1) { return classForObject(obj); }
	Class oldClass =  obj->isa;
	obj->isa = cls;
	return oldClass;
}
Пример #26
0
long
arg_ascii_char (int n)
{
  CHECK_ARG (n, CHARACTER_P);
  {
    SCHEME_OBJECT object = (ARG_REF (n));
    if (! (CHAR_TO_ASCII_P (object)))
      error_bad_range_arg (n);
    return (CHAR_TO_ASCII (object));
  }
}
Пример #27
0
static void check_for_required_args(mportPackageMeta *pkg, mportCreateExtras *extra)
{
  CHECK_ARG(pkg->name, "package name")
  CHECK_ARG(pkg->version, "package version");
  CHECK_ARG(extra->pkg_filename, "package filename");
  CHECK_ARG(extra->sourcedir, "source dir");
  CHECK_ARG(pkg->prefix, "prefix");
  CHECK_ARG(pkg->origin, "origin");
  CHECK_ARG(pkg->categories, "categories");
}
Пример #28
0
// Main program body.
int
main (int argc, char *argv[])
{
  int currArg = 1;
  int NUM_ARGS = 2;
  char *inFile, *outFile;

  handle_license_and_version_args(argc, argv, ASF_NAME_STRING);
  asfSplashScreen(argc, argv);

  if (argc >= 2 && strmatches(argv[1],"-help","--help",NULL))
    print_help();
  if (argc<2)
    scale_usage(ASF_NAME_STRING);

  while (currArg < (argc-NUM_ARGS)) {
    char *key = argv[currArg++];
    if (strmatches(key,"-help","--help",NULL)) {
      print_help(); // doesn't return
    }
    else if (strmatches(key,"-log","--log",NULL)) {
      CHECK_ARG(1);
      strcpy(logFile,GET_ARG(1));
      fLog = FOPEN(logFile, "a");
      logflag = TRUE;
    }
    else if (strmatches(key,"-quiet","--quiet","-q",NULL)) {
      quietflag = TRUE;
    }
    else {
      --currArg;
      break;
    }
  }

  if ((argc-currArg) < NUM_ARGS) {
    printf("Insufficient arguments.  Expected %d, got %d.\n",
           NUM_ARGS, argc-currArg);
    scale_usage(argv[0]);
  } else if ((argc-currArg) > NUM_ARGS) {
    printf("Unknown argument: %s\n", argv[currArg]);
    scale_usage(argv[0]);
  }

  inFile = argv[currArg];
  outFile = argv[currArg+1];

  int fail = asf_logscale(inFile, outFile);
  int ok = !fail;

  asfPrintStatus(ok ? "Done.\n" : "Failed.\n");
  return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}
Пример #29
0
int bc_tester_parse_args(int argc, char **argv, int argid)
{
	int i = argid;
	if (strcmp(argv[i],"--help")==0){
		return -1;
	} else if (strcmp(argv[i],"--test")==0){
		CHECK_ARG("--test", ++i, argc);
		test_name=argv[i];
	}else if (strcmp(argv[i],"--suite")==0){
		CHECK_ARG("--suite", ++i, argc);
		suite_name=argv[i];
	} else if (strcmp(argv[i],"--list-suites")==0){
		bc_tester_list_suites();
		return 0;
	} else if (strcmp(argv[i],"--list-tests")==0){
		CHECK_ARG("--list-tests", ++i, argc);
		suite_name = argv[i];
		bc_tester_list_tests(suite_name);
		return 0;
	} else if (strcmp(argv[i], "--xml-file") == 0){
		CHECK_ARG("--xml-file", ++i, argc);
		xml_file = argv[i];
		xml_enabled = 1;
	} else if (strcmp(argv[i], "--xml") == 0){
		xml_enabled = 1;
	}else {
		bc_tester_printf(bc_printf_verbosity_error, "Unknown option \"%s\"\n", argv[i]);
		return -1;
	}

	if( xml_enabled && (suite_name || test_name) ){
		bc_tester_printf(bc_printf_verbosity_error, "Cannot use both XML and specific test suite\n");
		return -1;
	}

	/* returns number of arguments read + 1 */
	return i - argid + 1;
}
Пример #30
0
// Main program body.
int
main (int argc, char *argv[])
{
  int currArg = 1;
  int NUM_ARGS = 4;

  handle_license_and_version_args(argc, argv, ASF_NAME_STRING);
  asfSplashScreen(argc, argv);

  if (argc >= 2 && strmatches(argv[1],"-help","--help",NULL))
    print_help();
  if (argc<3)
    rtc_usage(ASF_NAME_STRING);

  while (currArg < (argc-NUM_ARGS)) {
    char *key = argv[currArg++];
    if (strmatches(key,"-help","--help",NULL)) {
        print_help(); // doesn't return
    }
    else if (strmatches(key,"-log","--log",NULL)) {
      CHECK_ARG(1);
      strncpy_safe(logFile,GET_ARG(1),256);
      fLog = FOPEN(logFile, "a");
      logflag = TRUE;
    }
    else if (strmatches(key,"-quiet","--quiet","-q",NULL)) {
      quietflag = TRUE;
    }
    else {
      --currArg;
      break;
    }
  }

  if ((argc-currArg) < NUM_ARGS) {
    printf("Insufficient arguments.  Expected %d, got %d.\n",
           NUM_ARGS, argc-currArg);
    rtc_usage(argv[0]);
  } else if ((argc-currArg) > NUM_ARGS) {
    printf("Unknown argument: %s\n", argv[currArg]);
    rtc_usage(argv[0]);
  }

  int fail = uavsar_rtc(argv[currArg], argv[currArg+1], argv[currArg+2],
                        argv[currArg+3]);

  asfPrintStatus(fail ? "Failed.\n" : "Done.\n");
  return fail ? EXIT_FAILURE : EXIT_SUCCESS;
}