@@ -79,6 +79,7 @@ retCode parse_common_section()
7979 char * fnct_name = "parse_common_section" ;
8080 char * section = "MB2HAL_INIT" , * tag ;
8181 const char * tmpstr ;
82+ char tmpbuf [INI_MAX_LINELEN ];
8283
8384 if (gbl .ini_file_ptr == NULL ) {
8485 ERR (gbl .init_dbg , "gbl.ini_file_ptr NULL pointer" );
@@ -90,7 +91,7 @@ retCode parse_common_section()
9091 DBG (gbl .init_dbg , "[%s] [%s] [%d]" , section , tag , gbl .init_dbg );
9192
9293 tag = "VERSION" ; //optional
93- tmpstr = iniFind (gbl .ini_file_ptr , tag , section );
94+ tmpstr = iniFindString (gbl .ini_file_ptr , tag , section , tmpbuf , sizeof ( tmpbuf ) );
9495 if (tmpstr != NULL ) {
9596 int major , minor ;
9697 sscanf (tmpstr , "%d.%d" , & major , & minor );
@@ -99,7 +100,7 @@ retCode parse_common_section()
99100 DBG (gbl .init_dbg , "[%s] [%s] [%d]" , section , tag , gbl .version );
100101
101102 tag = "HAL_MODULE_NAME" ; //optional
102- tmpstr = iniFind (gbl .ini_file_ptr , tag , section );
103+ tmpstr = iniFindString (gbl .ini_file_ptr , tag , section , tmpbuf , sizeof ( tmpbuf ) );
103104 if (tmpstr != NULL ) {
104105 gbl .hal_mod_name = strdup (tmpstr );
105106 }
@@ -176,6 +177,7 @@ retCode parse_transaction_section(const int mb_tx_num)
176177 char section [40 ];
177178 char * tag ;
178179 const char * tmpstr ;
180+ char tmpbuf [INI_MAX_LINELEN ];
179181 mb_tx_t * this_mb_tx ;
180182
181183 if (gbl .ini_file_ptr == NULL ) {
@@ -197,7 +199,7 @@ retCode parse_transaction_section(const int mb_tx_num)
197199 snprintf (section , sizeof (section )- 1 , "TRANSACTION_%02d" , mb_tx_num );
198200
199201 tag = "LINK_TYPE" ; //required 1st time, then optional
200- tmpstr = iniFind (gbl .ini_file_ptr , tag , section );
202+ tmpstr = iniFindString (gbl .ini_file_ptr , tag , section , tmpbuf , sizeof ( tmpbuf ) );
201203 if (tmpstr != NULL ) {
202204 if (strcasecmp (tmpstr , "tcp" ) == retOK ) {
203205 this_mb_tx -> cfg_link_type = linkTCP ;
@@ -274,7 +276,7 @@ retCode parse_transaction_section(const int mb_tx_num)
274276
275277
276278 tag = "PIN_NAMES" ;
277- tmpstr = iniFind (gbl .ini_file_ptr , tag , section );
279+ tmpstr = iniFindString (gbl .ini_file_ptr , tag , section , tmpbuf , sizeof ( tmpbuf ) );
278280 if (tmpstr != NULL ) {
279281 if (parse_pin_names (tmpstr , this_mb_tx ) != retOK )
280282 {
@@ -344,7 +346,7 @@ retCode parse_transaction_section(const int mb_tx_num)
344346 DBG (gbl .init_dbg , "[%s] [%s] [%d]" , section , tag , this_mb_tx -> cfg_debug );
345347
346348 tag = "MB_TX_CODE" ; //required
347- tmpstr = iniFind (gbl .ini_file_ptr , tag , section );
349+ tmpstr = iniFindString (gbl .ini_file_ptr , tag , section , tmpbuf , sizeof ( tmpbuf ) );
348350 if (tmpstr != NULL ) {
349351 int i ;
350352 for (i = 0 ; i < mbtxMAX ; i ++ ) {
@@ -367,7 +369,7 @@ retCode parse_transaction_section(const int mb_tx_num)
367369 DBG (gbl .init_dbg , "[%s] [%s] [%s] [%d]" , section , tag , this_mb_tx -> mb_tx_fnct_name , this_mb_tx -> mb_tx_fnct );
368370
369371 tag = "HAL_TX_NAME" ; //optional
370- tmpstr = iniFind (gbl .ini_file_ptr , tag , section );
372+ tmpstr = iniFindString (gbl .ini_file_ptr , tag , section , tmpbuf , sizeof ( tmpbuf ) );
371373 if (tmpstr != NULL ) {
372374 strncpy (this_mb_tx -> hal_tx_name , tmpstr , HAL_NAME_LEN );
373375 }
@@ -376,32 +378,6 @@ retCode parse_transaction_section(const int mb_tx_num)
376378 }
377379 DBG (gbl .init_dbg , "[%s] [%s] [%s]" , section , tag , this_mb_tx -> hal_tx_name );
378380
379- /*
380- str = iniFind(gbl.ini_file_ptr, "PINNAME", mb_tx_name);
381- if (str != NULL) {
382- pin_name = malloc(strlen(str) + 1);
383- rtapi_strxcpy(pin_name, str); // convert a const string into one
384- // we can modify
385- }
386- else {
387- pin_name = malloc(1); // empty string
388- *pin_name = 0;
389- }
390- if (mb_tx->name[0] != 0) {
391- strncpy(mb_tx_name, mb_tx->name, HAL_NAME_LEN);
392- }
393- else {
394- snprintf(mb_tx_name, sizeof(mb_tx_name), "%02d", mb_tx_num);
395- }
396- memcpy(&gbl.mb_tx[mb_tx_num], mb_tx, sizeof(mb_tx_t));
397- rc = create_pins(mb_tx_name, &gbl.mb_tx[mb_tx_num], pin_name);
398- free(pin_name);
399- if (rc != retOK) {
400- ERR(gbl.init_dbg, "Failed to create pins");
401- return retERR;
402- }
403- */
404-
405381 return retOK ;
406382}
407383
@@ -410,6 +386,7 @@ retCode parse_tcp_subsection(const char *section, const int mb_tx_num)
410386 char * fnct_name = "parse_tcp_subsection" ;
411387 char * tag ;
412388 const char * tmpstr ;
389+ char tmpbuf [INI_MAX_LINELEN ];
413390 mb_tx_t * this_mb_tx ;
414391
415392 if (gbl .ini_file_ptr == NULL || section == NULL ) {
@@ -424,7 +401,7 @@ retCode parse_tcp_subsection(const char *section, const int mb_tx_num)
424401 this_mb_tx = & gbl .mb_tx [mb_tx_num ];
425402
426403 tag = "TCP_IP" ; //required 1st time, then optional
427- tmpstr = iniFind (gbl .ini_file_ptr , tag , section );
404+ tmpstr = iniFindString (gbl .ini_file_ptr , tag , section , tmpbuf , sizeof ( tmpbuf ) );
428405 if (tmpstr != NULL ) {
429406 strncpy (this_mb_tx -> cfg_tcp_ip , tmpstr , sizeof (this_mb_tx -> cfg_tcp_ip )- 1 );
430407 }
@@ -466,6 +443,7 @@ retCode parse_serial_subsection(const char *section, const int mb_tx_num)
466443 char * fnct_name = "parse_serial_subsection" ;
467444 char * tag ;
468445 const char * tmpstr ;
446+ char tmpbuf [INI_MAX_LINELEN ];
469447 mb_tx_t * this_mb_tx ;
470448
471449 if (gbl .ini_file_ptr == NULL || section == NULL ) {
@@ -480,7 +458,7 @@ retCode parse_serial_subsection(const char *section, const int mb_tx_num)
480458 this_mb_tx = & gbl .mb_tx [mb_tx_num ];
481459
482460 tag = "SERIAL_PORT" ; //required 1st time
483- tmpstr = iniFind (gbl .ini_file_ptr , tag , section );
461+ tmpstr = iniFindString (gbl .ini_file_ptr , tag , section , tmpbuf , sizeof ( tmpbuf ) );
484462 if (tmpstr != NULL ) {
485463 strncpy (this_mb_tx -> cfg_serial_device , tmpstr , sizeof (this_mb_tx -> cfg_serial_device )- 1 );
486464 }
@@ -548,7 +526,7 @@ retCode parse_serial_subsection(const char *section, const int mb_tx_num)
548526 DBG (gbl .init_dbg , "[%s] [%s] [%d]" , section , tag , this_mb_tx -> cfg_serial_data_bit );
549527
550528 tag = "SERIAL_PARITY" ; //required 1st time
551- tmpstr = iniFind (gbl .ini_file_ptr , tag , section );
529+ tmpstr = iniFindString (gbl .ini_file_ptr , tag , section , tmpbuf , sizeof ( tmpbuf ) );
552530 if (tmpstr != NULL ) {
553531 strncpy (this_mb_tx -> cfg_serial_parity , tmpstr , sizeof (this_mb_tx -> cfg_serial_parity )- 1 );
554532 }
0 commit comments