From: Jason Etheridge Date: Mon, 4 Jul 2022 22:12:24 +0000 (-0400) Subject: SIP filters: more mixed use of tabs and spaces X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fd7df775a954485b1fa8cd0aa2c1a70af8032419;p=working%2FSIPServer.git SIP filters: more mixed use of tabs and spaces Signed-off-by: Jason Etheridge --- diff --git a/Sip.pm b/Sip.pm index a1c3be5..762e8fb 100644 --- a/Sip.pm +++ b/Sip.pm @@ -32,28 +32,28 @@ use Sys::Syslog qw(syslog); use POSIX qw(strftime); use Socket qw(:crlf); -use Sip::Constants qw(SIP_DATETIME); +use Sip::Constants qw(:all); use Sip::Checksum qw(checksum); our $VERSION = 0.02; our @ISA = qw(Exporter); our @EXPORT_OK = qw(y_or_n timestamp add_field maybe_add add_count - denied sipbool boolspace write_msg read_SIP_packet - $error_detection $protocol_version $field_delimiter - $last_response); + denied sipbool boolspace write_msg read_SIP_packet + $error_detection $protocol_version $field_delimiter + $last_response); our %EXPORT_TAGS = ( - all => [qw(y_or_n timestamp add_field maybe_add - add_count denied sipbool boolspace write_msg - read_SIP_packet - $error_detection $protocol_version - $field_delimiter $last_response)]); + all => [qw(y_or_n timestamp add_field maybe_add + add_count denied sipbool boolspace write_msg + read_SIP_packet + $error_detection $protocol_version + $field_delimiter $last_response)]); our $error_detection = 0; our $protocol_version = 1; -our $field_delimiter = '|'; # Protocol Default +our $field_delimiter = '|'; # Protocol Default # We need to keep a copy of the last message we sent to the SC, # in case there's a transmission error and the SC sends us a @@ -77,9 +77,9 @@ sub add_field { my ($i, $ent); if (!defined($value)) { - syslog("LOG_DEBUG", "add_field: Undefined value being added to '%s'", - $field_id); - $value = ''; + syslog("LOG_DEBUG", "add_field: Undefined value being added to '%s'", + $field_id); + $value = ''; } # Replace any occurences of the field delimiter in the @@ -87,7 +87,7 @@ sub add_field { $ent = sprintf("&#%d;", ord($field_delimiter)); while (($i = index($value, $field_delimiter)) != ($[-1)) { - substr($value, $i, 1) = $ent; + substr($value, $i, 1) = $ent; } # SIP2 Protocol document specifies that variable fields are from 0 @@ -148,14 +148,14 @@ sub add_count { # If the field is unsupported, it will be undef, return blanks # as per the spec. if (!defined($count)) { - return ' ' x 4; + return ' ' x 4; } $count = sprintf("%04d", $count); if (length($count) != 4) { - syslog("LOG_WARNING", "handle_patron_info: %s wrong size: '%s'", - $label, $count); - $count = ' ' x 4; + syslog("LOG_WARNING", "handle_patron_info: %s wrong size: '%s'", + $label, $count); + $count = ' ' x 4; } return $count; } @@ -300,7 +300,7 @@ sub write_msg { syslog("LOG_ERR", "Error writing to STDOUT $!") unless $rv; } - syslog("LOG_INFO", "OUTPUT MSG: '$msg'"); + syslog("LOG_INFO", "OUTPUT MSG2: '$msg'"); $last_response = $msg; }