src/ManageConnections.c
/*
 * FUNCTION NAME: removeConnectionMenu
 *
 * DESCRIPTION:
 * Function gets from user two cities, then
 * removes a connection between 'em from graph.
 */
FUNCTION NAME: removeConnectionMenu
DESCRIPTION:
Function gets from user two cities, then
removes a connection between 'em from graph.
FUNCTION NAME : removeConnectionMenu DESCRIPTION : Function gets from user two cities then removes a connection between ' em from graph .
void removeConnectionMenu(Graph_t* graph)
{
    if (graph->head == NULL) {
        printErrorUsersActions(EMPTY_GRAPH);
        return;
    }
    char city1[G_CITYS_NAME_LENGTH];
    char city2[G_CITYS_NAME_LENGTH];
    programError_t what_error = NO_ERROR;
    int counter = 2;
    do {
        if ((counter % 4) == 1) {
            showCityList(graph);
        }
        ++counter;
        printErrorUsersActions(what_error);
        getCitysName(FIRST_CITY, city1);
        what_error = checkIfNameIsCorrect(city1);
        if (what_error == NO_ERROR) {
            what_error = checkIfIsInGraph(graph, city1);
        }
    } while (what_error != NO_ERROR);
    counter = 2;
    do {
        if ((counter % 4) == 1) {
            showConnections(graph);
        }
        ++counter;
        printErrorUsersActions(what_error);
        getCitysName(SECOND_CITY, city2);
        what_error = checkIfNameIsCorrect(city2);
        if (what_error == NO_ERROR) {
            what_error = checkIfIsInGraph(graph, city2);
        }
        if (what_error == NO_ERROR) {
            what_error = checkIfNamesAreIdentical(city1, city2);
        }
        if (what_error == NO_ERROR) {
            if (checkIfConnectionIsInGraph(graph, city1, city2) == CONNECTION_ALREADY_IN_GRAPH) {
                what_error = NO_ERROR;
            } else {
                what_error = NO_SUCH_CONNECTION;
            }
        }
    } while (what_error != NO_ERROR);
    removeConnection(graph, city1, city2);
}
void removeConnectionMenu ( Graph_t * graph ) { if ( graph -> head == NULL ) { printErrorUsersActions ( EMPTY_GRAPH ) ; return ; } char city1 [ G_CITYS_NAME_LENGTH ] ; char city2 [ G_CITYS_NAME_LENGTH ] ; programError_t what_error = NO_ERROR ; int counter = 2 ; do { if ( ( counter % 4 ) == 1 ) { showCityList ( graph ) ; } ++ counter ; printErrorUsersActions ( what_error ) ; getCitysName ( FIRST_CITY , city1 ) ; what_error = checkIfNameIsCorrect ( city1 ) ; if ( what_error == NO_ERROR ) { what_error = checkIfIsInGraph ( graph , city1 ) ; } } while ( what_error != NO_ERROR ) ; counter = 2 ; do { if ( ( counter % 4 ) == 1 ) { showConnections ( graph ) ; } ++ counter ; printErrorUsersActions ( what_error ) ; getCitysName ( SECOND_CITY , city2 ) ; what_error = checkIfNameIsCorrect ( city2 ) ; if ( what_error == NO_ERROR ) { what_error = checkIfIsInGraph ( graph , city2 ) ; } if ( what_error == NO_ERROR ) { what_error = checkIfNamesAreIdentical ( city1 , city2 ) ; } if ( what_error == NO_ERROR ) { if ( checkIfConnectionIsInGraph ( graph , city1 , city2 ) == CONNECTION_ALREADY_IN_GRAPH ) { what_error = NO_ERROR ; } else { what_error = NO_SUCH_CONNECTION ; } } } while ( what_error != NO_ERROR ) ; removeConnection ( graph , city1 , city2 ) ; }
FUNCTION NAME: removeConnectionMenu
 DESCRIPTION:
 Function gets from user two cities, then
 removes a connection between 'em from graph.
FUNCTION NAME : removeConnectionMenu DESCRIPTION : Function gets from user two cities then removes a connection between ' em from graph .
/* Check if connection is or is not in the graph */ /* If everything is fine, then remove connection. */