private void check_args(final String argv[]) {

	if (argv[0].charAt(0) == '-') {
	    if (argv[0].equals("-?")) {
		print_usage();
		printInstanceNames();
		System.exit(0);
	    } else {
		print_usage();
		System.exit(-1);
	    }
	}
	ds_instance_name = argv[0];

	if (argv.length > 1) {
	    int ind = 1;
	    String dlist;
	    while (ind < argv.length) {
		if (argv[ind].charAt(0) == '-') {
		    switch (argv[ind].charAt(1)) {

		    //
		    // The verbose option
		    //

		    case 'v':
			if (argv[ind].length() == 2) {
			    if (argv.length - 1 > ind) {
				if (argv[ind + 1].charAt(0) == '-') {
				    set_trace_level(4);
				} else {
				    print_usage();
				    System.exit(-1);
				}
			    } else {
				set_trace_level(4);
			    }
			    ind++;
			} else {
			    final String level_str = argv[ind].substring(2);
			    int level = 0;
			    try {
				level = Integer.parseInt(level_str);
			    } catch (final NumberFormatException ex) {
				print_usage();
				System.exit(-1);
			    }

			    set_trace_level(level);
			    ind++;
			}
			break;

		    //
		    // Device server without database
		    //

		    case 'n':
			if (argv[ind].equals("-nodb") == false) {
			    print_usage();
			    System.exit(-1);
			} else {
			    _UseDb = false;
			    ind++;
			}
			break;

		    //
		    // Device list (for device server without database)
		    //

		    case 'd':
			if (argv[ind].equals("-dlist") == false) {
			    print_usage();
			    System.exit(-1);
			} else {
			    if (_UseDb == true) {
				print_usage();
				System.exit(-1);
			    }

			    ind++;
			    if (ind == argv.length) {
				print_usage();
				System.exit(-1);
			    } else {
				dlist = argv[ind].toLowerCase();

				//
				// Extract each device name
                    //
				String str;
				int start = 0;
				int pos;

				while ((pos = dlist.indexOf(',', start)) != -1) {
				    str = dlist.substring(start, pos);
				    start = pos + 1;
				    cmd_line_name_list.addElement(str);
				}
				if (start != dlist.length()) {
				    str = dlist.substring(start);
				    cmd_line_name_list.addElement(str);
				}

				//
				// Check that the same device name is not used
				// twice
				//

				int i, j;
				for (i = 0; i < cmd_line_name_list.size(); i++) {
				    for (j = 0; j < cmd_line_name_list.size(); j++) {
					if (i != j) {
					    if (cmd_line_name_list.elementAt(i).equals(
						    cmd_line_name_list.elementAt(j))) {
						System.err
							.println("Each device name must have different name");
						System.exit(-1);
					    }
					}
				    }
				}

			    }
			}
			break;

		    default:
			ind++;
			break;
		    }
		} else {
		    if (argv[ind - 1].substring(0, 2).equals("-v")) {
			print_usage();
			System.exit(-1);
		    }
		    ind++;
		}
	    }
	}

	//
	// Build server name in lower-case letters
	//

	real_server_name = ds_exec_name + "/" + ds_instance_name;
	ds_exec_name = ds_exec_name.toLowerCase();
	ds_instance_name = ds_instance_name.toLowerCase();

	ds_name = new StringBuffer(ds_exec_name);
	ds_name.append("/");
	ds_name.append(ds_instance_name);

	//
	// Check that the server name is not too long
	//

	if (ds_name.length() > Tango_MaxServerNameLength) {
	    System.err.println("The device server name is too long! Max length is "
		    + Tango_MaxServerNameLength + " characters.");
	    System.exit(-1);
	}
    }
private void check_args ( final String argv [ ] ) { if ( argv [ 0 ] . charAt ( 0 ) == '-' ) { if ( argv [ 0 ] . equals ( "-?" ) ) { print_usage ( ) ; printInstanceNames ( ) ; System . exit ( 0 ) ; } else { print_usage ( ) ; System . exit ( - 1 ) ; } } ds_instance_name = argv [ 0 ] ; if ( argv . length > 1 ) { int ind = 1 ; String dlist ; while ( ind < argv . length ) { if ( argv [ ind ] . charAt ( 0 ) == '-' ) { switch ( argv [ ind ] . charAt ( 1 ) ) { case 'v' : if ( argv [ ind ] . length ( ) == 2 ) { if ( argv . length - 1 > ind ) { if ( argv [ ind + 1 ] . charAt ( 0 ) == '-' ) { set_trace_level ( 4 ) ; } else { print_usage ( ) ; System . exit ( - 1 ) ; } } else { set_trace_level ( 4 ) ; } ind ++ ; } else { final String level_str = argv [ ind ] . substring ( 2 ) ; int level = 0 ; try { level = Integer . parseInt ( level_str ) ; } catch ( final NumberFormatException ex ) { print_usage ( ) ; System . exit ( - 1 ) ; } set_trace_level ( level ) ; ind ++ ; } break ; case 'n' : if ( argv [ ind ] . equals ( "-nodb" ) == false ) { print_usage ( ) ; System . exit ( - 1 ) ; } else { _UseDb = false ; ind ++ ; } break ; case 'd' : if ( argv [ ind ] . equals ( "-dlist" ) == false ) { print_usage ( ) ; System . exit ( - 1 ) ; } else { if ( _UseDb == true ) { print_usage ( ) ; System . exit ( - 1 ) ; } ind ++ ; if ( ind == argv . length ) { print_usage ( ) ; System . exit ( - 1 ) ; } else { dlist = argv [ ind ] . toLowerCase ( ) ; String str ; int start = 0 ; int pos ; while ( ( pos = dlist . indexOf ( ',' , start ) ) != - 1 ) { str = dlist . substring ( start , pos ) ; start = pos + 1 ; cmd_line_name_list . addElement ( str ) ; } if ( start != dlist . length ( ) ) { str = dlist . substring ( start ) ; cmd_line_name_list . addElement ( str ) ; } int i , j ; for ( i = 0 ; i < cmd_line_name_list . size ( ) ; i ++ ) { for ( j = 0 ; j < cmd_line_name_list . size ( ) ; j ++ ) { if ( i != j ) { if ( cmd_line_name_list . elementAt ( i ) . equals ( cmd_line_name_list . elementAt ( j ) ) ) { System . err . println ( "Each device name must have different name" ) ; System . exit ( - 1 ) ; } } } } } } break ; default : ind ++ ; break ; } } else { if ( argv [ ind - 1 ] . substring ( 0 , 2 ) . equals ( "-v" ) ) { print_usage ( ) ; System . exit ( - 1 ) ; } ind ++ ; } } } real_server_name = ds_exec_name + "/" + ds_instance_name ; ds_exec_name = ds_exec_name . toLowerCase ( ) ; ds_instance_name = ds_instance_name . toLowerCase ( ) ; ds_name = new StringBuffer ( ds_exec_name ) ; ds_name . append ( "/" ) ; ds_name . append ( ds_instance_name ) ; if ( ds_name . length ( ) > Tango_MaxServerNameLength ) { System . err . println ( "The device server name is too long! Max length is " + Tango_MaxServerNameLength + " characters." ) ; System . exit ( - 1 ) ; } }
-----------------------------------------------------------------------------