basicViewerPython.py
def parse_command_line():
    """Parse the command line to obtain connectivity details to be used when
    listening for incoming connections. A simplistic approach is adopted:

    3 arguments - Cloud connectivity to be used
                  [LOCAL_CLOUD_ADDRESS LOCAL_CLOUD_PASSWORD PEER_CLOUD_ADDRESS]

    2 arguments - Direct TCP connectivity to be used
                  [TCP_ADDRESS TCP_PORT]

    0 arguments - the built-in macros must be set appropriately
    """
    global LOCAL_CLOUD_ADDRESS, LOCAL_CLOUD_PASSWORD, PEER_CLOUD_ADDRESS
    global TCP_ADDRESS, TCP_PORT
    global using_cloud
    bad_args = False
    argc = len(sys.argv)

    # Parse any supplied command line arguments
    if argc == 4 or argc == 3 or argc == 1:
        if argc == 4:  # Cloud arguments
            LOCAL_CLOUD_ADDRESS = sys.argv[1]
            LOCAL_CLOUD_PASSWORD = sys.argv[2]
            PEER_CLOUD_ADDRESS = sys.argv[3]
        elif argc == 3:  # Direct TCP arguments
            TCP_ADDRESS = sys.argv[1]
            TCP_PORT = extract_port_num(sys.argv[2])
            using_cloud = False
        else:  # Examine hard-coded values from global variables above
            if LOCAL_CLOUD_ADDRESS or LOCAL_CLOUD_PASSWORD or \
               PEER_CLOUD_ADDRESS:
                using_cloud = True
            elif TCP_PORT or TCP_ADDRESS:
                using_cloud = False

        # Check if all required connectivity details are provided either via
        # editing the global variables above, or on the command-line
        if using_cloud and (not LOCAL_CLOUD_ADDRESS or
                            not LOCAL_CLOUD_PASSWORD or
                            not PEER_CLOUD_ADDRESS):
            bad_args = True
        elif not using_cloud and (not TCP_PORT or not TCP_ADDRESS):
            bad_args = True
    else:
        bad_args = True  # Invalid number of arguments

    if bad_args:
        usage_advice()
        sys.exit(1)
Parse the command line to obtain connectivity details to be used when
    listening for incoming connections. A simplistic approach is adopted:

    3 arguments - Cloud connectivity to be used
                  [LOCAL_CLOUD_ADDRESS LOCAL_CLOUD_PASSWORD PEER_CLOUD_ADDRESS]

    2 arguments - Direct TCP connectivity to be used
                  [TCP_ADDRESS TCP_PORT]

    0 arguments - the built-in macros must be set appropriately
    
Parse the command line to obtain connectivity details to be used when
listening for incoming connections. A simplistic approach is adopted.

3 arguments - Cloud connectivity to be used
[LOCAL_CLOUD_ADDRESS LOCAL_CLOUD_PASSWORD PEER_CLOUD_ADDRESS]

2 arguments - Direct TCP connectivity to be used
[TCP_ADDRESS TCP_PORT]

0 arguments - the built-in macros must be set appropriately
Parse the command line to obtain connectivity details to be used when listening for incoming connections . A simplistic approach is adopted . 3 arguments - Cloud connectivity to be used [ LOCAL_CLOUD_ADDRESS LOCAL_CLOUD_PASSWORD PEER_CLOUD_ADDRESS ] 2 arguments - Direct TCP connectivity to be used [ TCP_ADDRESS TCP_PORT ] 0 arguments - the built - in macros must be set appropriately
def parse_command_line():
    global LOCAL_CLOUD_ADDRESS, LOCAL_CLOUD_PASSWORD, PEER_CLOUD_ADDRESS
    global TCP_ADDRESS, TCP_PORT
    global using_cloud
    bad_args = False
    argc = len(sys.argv)
    if argc == 4 or argc == 3 or argc == 1:
        if argc == 4:  
            LOCAL_CLOUD_ADDRESS = sys.argv[1]
            LOCAL_CLOUD_PASSWORD = sys.argv[2]
            PEER_CLOUD_ADDRESS = sys.argv[3]
        elif argc == 3:  
            TCP_ADDRESS = sys.argv[1]
            TCP_PORT = extract_port_num(sys.argv[2])
            using_cloud = False
        else:  
            if LOCAL_CLOUD_ADDRESS or LOCAL_CLOUD_PASSWORD or \
               PEER_CLOUD_ADDRESS:
                using_cloud = True
            elif TCP_PORT or TCP_ADDRESS:
                using_cloud = False
        if using_cloud and (not LOCAL_CLOUD_ADDRESS or
                            not LOCAL_CLOUD_PASSWORD or
                            not PEER_CLOUD_ADDRESS):
            bad_args = True
        elif not using_cloud and (not TCP_PORT or not TCP_ADDRESS):
            bad_args = True
    else:
        bad_args = True  
    if bad_args:
        usage_advice()
        sys.exit(1)
def parse_command_line ( ) : global LOCAL_CLOUD_ADDRESS , LOCAL_CLOUD_PASSWORD , PEER_CLOUD_ADDRESS global TCP_ADDRESS , TCP_PORT global using_cloud bad_args = False argc = len ( sys . argv ) if argc == 4 or argc == 3 or argc == 1 : if argc == 4 : LOCAL_CLOUD_ADDRESS = sys . argv [ 1 ] LOCAL_CLOUD_PASSWORD = sys . argv [ 2 ] PEER_CLOUD_ADDRESS = sys . argv [ 3 ] elif argc == 3 : TCP_ADDRESS = sys . argv [ 1 ] TCP_PORT = extract_port_num ( sys . argv [ 2 ] ) using_cloud = False else : if LOCAL_CLOUD_ADDRESS or LOCAL_CLOUD_PASSWORD or PEER_CLOUD_ADDRESS : using_cloud = True elif TCP_PORT or TCP_ADDRESS : using_cloud = False if using_cloud and ( not LOCAL_CLOUD_ADDRESS or not LOCAL_CLOUD_PASSWORD or not PEER_CLOUD_ADDRESS ) : bad_args = True elif not using_cloud and ( not TCP_PORT or not TCP_ADDRESS ) : bad_args = True else : bad_args = True if bad_args : usage_advice ( ) sys . exit ( 1 )
Parse the command line to obtain connectivity details to be used when
listening for incoming connections.
Parse the command line to obtain connectivity details to be used when listening for incoming connections .
"""Parse the command line to obtain connectivity details to be used when
    listening for incoming connections. A simplistic approach is adopted:

    3 arguments - Cloud connectivity to be used
                  [LOCAL_CLOUD_ADDRESS LOCAL_CLOUD_PASSWORD PEER_CLOUD_ADDRESS]

    2 arguments - Direct TCP connectivity to be used
                  [TCP_ADDRESS TCP_PORT]

    0 arguments - the built-in macros must be set appropriately
    """ # Parse any supplied command line arguments # Cloud arguments # Direct TCP arguments # Examine hard-coded values from global variables above # Check if all required connectivity details are provided either via # editing the global variables above, or on the command-line # Invalid number of arguments