libs/nameserver/src/startproc.cpp
//---------------------------------------------------------------------------
// This static function will launch name server.
// Returns 0 if unable to launch or 1 if OK.
//---------------------------------------------------------------------------
This static function will launch name server.
Returns 0 if unable to launch or 1 if OK.
This static function will launch name server . Returns 0 if unable to launch or 1 if OK .
int LaunchNameServer(int stop) {
	char	nameservCmd[1024];
	char*	location;
	int		i;
    memset(nameservCmd,0,1024*sizeof(char));
    location = getenv("CODE_ROVER_HOME");
    if(location != NULL) {
        strcpy(nameservCmd, location);
        strcat(nameservCmd, "\\bin\\nameserv.exe");
    } else {
        location = getenv("PSETHOME");
        if(location != NULL) {
            strcpy(nameservCmd, location);
            strcat(nameservCmd, "/bin/nameserv");
        } else {
            strcpy(nameservCmd, "nameserv");
        }
    }
	if(do_debug)
		strcat(nameservCmd," -debug");
	if(stop==STOP_SERVER)
		strcat(nameservCmd," -stop");
	if(start_new_process(nameservCmd,START_NO_WAIT)!=-1) {
		int port,host;
		for(i=0;i<200;i++) {
			if(NameServerGetService("TEST",port,host)<0) 
				break;
		}
		if(i==200) {
			_DBG(fprintf(log_fd,"Can not connect to Nameserv.\n"));
			return 0;
		}
		if(stop) {
			_DBG(fprintf(log_fd,"Nameserv has been stoped.\n"));
		} else {
			_DBG(fprintf(log_fd,"Nameserv has been started.\n"));
		}
		return 1;
	} else {
		_DBG(fprintf(log_fd,"Nameserv has NOT been started.\n"));
		return 0;
	}
}
int LaunchNameServer ( int stop ) { char nameservCmd [ 1024 ] ; char * location ; int i ; memset ( nameservCmd , 0 , 1024 * sizeof ( char ) ) ; location = getenv ( " " ) ; if ( location != NULL ) { strcpy ( nameservCmd , location ) ; strcat ( nameservCmd , " \\ \\ " ) ; } else { location = getenv ( " " ) ; if ( location != NULL ) { strcpy ( nameservCmd , location ) ; strcat ( nameservCmd , " " ) ; } else { strcpy ( nameservCmd , " " ) ; } } if ( do_debug ) strcat ( nameservCmd , " " ) ; if ( stop == STOP_SERVER ) strcat ( nameservCmd , " " ) ; if ( start_new_process ( nameservCmd , START_NO_WAIT ) != -1 ) { int port , host ; for ( i = 0 ; i < 200 ; i ++ ) { if ( NameServerGetService ( " " , port , host ) < 0 ) break ; } if ( i == 200 ) { _DBG ( fprintf ( log_fd , " \n " ) ) ; return 0 ; } if ( stop ) { _DBG ( fprintf ( log_fd , " \n " ) ) ; } else { _DBG ( fprintf ( log_fd , " \n " ) ) ; } return 1 ; } else { _DBG ( fprintf ( log_fd , " \n " ) ) ; return 0 ; } }
This static function will launch name server.
This static function will launch name server .