PAM Programming Manual
Link-Level Programming Examples
PAM Programming Manual—142482
B-16
Procedures
 };
/* -------------------- Test Foreign Address ------------------- */
 if (argc < 12) {
 fprintf(stdout, “Foreign Address is bad.\n”);
 exit(Abend_exit);
 }
/* ------------------- Convert Foreign Address --------------------
Convert a string of ASCII digits into a string of hex digits.
---------------------------------------------------------------- */
 strcpy(Addr_Text, argv[11]);
 hex_digit_ndx = 0;
 while ( ( ( hex_digit_ndx / 2 ) < 
 ( zlam_val_mac_addr_size_b + 2 ) ) &&
 ( Addr_Text[hex_digit_ndx] != ’\0’) )
 {
 if ( ( Addr_Text[ hex_digit_ndx ] >= ’0’) &&
 ( Addr_Text[ hex_digit_ndx ] <= ’9’) )
 hex_value = ( Addr_Text [ hex_digit_ndx ] - ’0’ );
 else if ( ( Addr_Text[ hex_digit_ndx ] >= ’A’ ) &&
 ( Addr_Text[ hex_digit_ndx ] <= ’F’ ))
 hex_value = 10 + ( Addr_Text[ hex_digit_ndx ] - ’A’);
 else
 {
 fprintf(stdout, “Foreign Addr Digit is bad.\n”);
 exit(Abend_exit);
 };
 if ( ( (int) (hex_digit_ndx / 2) ) * 2 == hex_digit_ndx )
 Foreign_Addr[ hex_digit_ndx / 2 ] = 
 ( ( hex_value << 4 ) + 
 Foreign_Addr[ hex_digit_ndx / 2 ] );
 else
 Foreign_Addr[ hex_digit_ndx / 2 ] = ( hex_value +
 Foreign_Addr[ hex_digit_ndx / 2 ] );
 hex_digit_ndx = ( hex_digit_ndx + 1 );
 }
/* --------------------- Initialize Buffers -------------------- */
 for (buffer_lst_ndx = 0;
 buffer_lst_ndx <= (Max_NoWait_Depth - 1);
 buffer_lst_ndx++);
 buffer_lst[ buffer_lst_ndx ].in_use_flag = False;
 }










