1 // vim: noet sw=4 ts=4:
3 ==================================================================================
4 Copyright (c) 2020 Nokia
5 Copyright (c) 2020 AT&T Intellectual Property.
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ==================================================================================
22 ******************************************************************************
25 * Abstract: This routine will get the address of the first listening
26 * block on the tp list and return it in ASCII format to the
27 * caller. The dest buffer is assumed to be at least 256 bytes
29 * Parms: gptr - Pointer to the global information block
30 * buf - Pointer to the buffer to hold the ascii string
31 * Returns: NI_OK if block found, NI_ERROR if no listen block exists
33 * Author: E. Scott Daniels
35 ******************************************************************************
37 #include "sisetup.h" // get the standard include stuff
39 extern int SIgetaddr( struct ginfo_blk *gptr, char *buf ) {
40 struct tp_blk *tpptr; // Pointer into tp list
41 int status = SI_ERROR; // return status
42 char *ibuf; // SIaddr now points us at a string, rather than filling ours
44 for( tpptr = gptr->tplist; tpptr != NULL && !(tpptr->flags & TPF_LISTENFD); tpptr = tpptr->next );
48 SIaddress( tpptr->addr, (void *) &ibuf, AC_TODOT ); // convert to dot fmt
49 strncpy( buf, ibuf, 256 ); // copy into caller's buffer
51 status = SI_OK; // ok status for return