[Mew-dist 12333] Re: [Mew-Win32 02395] imget --src=local with ^Z (Re: b25.)

Shuichi KITAGUCHI ( 北口修一 ) kit at example.com
2000年 2月 11日 (金) 16:39:26 JST


From: Kazu Yamamoto (山本和彦) <kazu at example.com>
Subject: [Mew-dist 12301] Re: [Mew-Win32 02395] imget --src=local with ^Z (Re:  b25.)
Date: Wed, 9 Feb 2000 10:45:36 +0900

北口です。

...
かず> それなら、Open という関数を用意して、プラットフォームの違いを吸収した
かず> らどうですか? 
...
かず> 任せました。> kit

任されてしまいましたので(^^;、パッチです。

慎重に手を入れたつもりですが、間違いがあるかもしれませんのでご注意ください。


--
Shuichi Kitaguchi <kit at example.com>
-------------- next part --------------
Index: imcat.in
===================================================================
RCS file: /usr/local/CVS/im/imcat.in,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 imcat.in
*** imcat.in	2000/01/29 12:33:52	1.1.1.7
--- imcat.in	2000/02/11 07:23:43
***************
*** 112,118 ****
  	print $BOUNDARY if $opt_boundary;
  	foreach (split(',', $msg)) {
  	    my $path = &expand_path($_);
! 	    if (open(MSG, "<$path")) {
  
  		while (<MSG>) {
  		    print;
--- 112,118 ----
  	print $BOUNDARY if $opt_boundary;
  	foreach (split(',', $msg)) {
  	    my $path = &expand_path($_);
! 	    if (im_open(\*MSG, "<$path")) {
  
  		while (<MSG>) {
  		    print;
***************
*** 127,133 ****
  	my $path = &message_name($opt_src, $msg);
  	&join_msg($path) if ($opt_join);
  	print $BOUNDARY if $opt_boundary;
! 	if (open(MSG, "<$path")) {
  	    while (<MSG>) {
  		print;
  	    }
--- 127,133 ----
  	my $path = &message_name($opt_src, $msg);
  	&join_msg($path) if ($opt_join);
  	print $BOUNDARY if $opt_boundary;
! 	if (im_open(\*MSG, "<$path")) {
  	    while (<MSG>) {
  		print;
  	    }
***************
*** 209,215 ****
  	} else {
  	    $path = $_;
  	}
! 	if (open(MSG, "<$path")) {
  	    $/ = "\n\n";
  	    $header = <MSG>;
  	    $/ = "\n";
--- 209,215 ----
  	} else {
  	    $path = $_;
  	}
! 	if (im_open(\*MSG, "<$path")) {
  	    $/ = "\n\n";
  	    $header = <MSG>;
  	    $/ = "\n";
***************
*** 265,271 ****
  	    im_warn("no path for message $locate, skipping.\n");
  	    next;
  	}
! 	if (open(MSG, "<$path")) {
  	    $/ = "\n\n";
  	    $header = <MSG>;
  	    $/ = "\n";
--- 265,271 ----
  	    im_warn("no path for message $locate, skipping.\n");
  	    next;
  	}
! 	if (im_open(\*MSG, "<$path")) {
  	    $/ = "\n\n";
  	    $header = <MSG>;
  	    $/ = "\n";
***************
*** 317,323 ****
  
      # show in sequence
      for ($i = 1; $i <= $#paths; $i++) {
! 	if (open(MSG, "<$paths[$i]")) {
  	    $/ = "\n\n";
  	    if ($i == 1) {		# first partial message
  		my $header = <MSG>;	# header of enclosing message
--- 317,323 ----
  
      # show in sequence
      for ($i = 1; $i <= $#paths; $i++) {
! 	if (im_open(\*MSG, "<$paths[$i]")) {
  	    $/ = "\n\n";
  	    if ($i == 1) {		# first partial message
  		my $header = <MSG>;	# header of enclosing message
Index: imhist.in
===================================================================
RCS file: /usr/local/CVS/im/imhist.in,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 imhist.in
*** imhist.in	2000/01/29 12:33:53	1.1.1.7
--- imhist.in	2000/02/11 07:23:43
***************
*** 139,145 ****
  sub add_msg_info ($$) {
      my ($path, $msg) = @_;
      local (@Hdr) = ();
!     if (open(MSG, "<$path")) {
  	&read_header(\*MSG, \@Hdr, 0);
  	my $mid = &header_value(\@Hdr, 'Message-ID');
  #	my $dt = &header_value(\@Hdr, 'Date');
--- 139,145 ----
  sub add_msg_info ($$) {
      my ($path, $msg) = @_;
      local (@Hdr) = ();
!     if (im_open(\*MSG, "<$path")) {
  	&read_header(\*MSG, \@Hdr, 0);
  	my $mid = &header_value(\@Hdr, 'Message-ID');
  #	my $dt = &header_value(\@Hdr, 'Date');
Index: imhsync.in
===================================================================
RCS file: /usr/local/CVS/im/imhsync.in,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 imhsync.in
*** imhsync.in	2000/01/29 12:33:53	1.1.1.7
--- imhsync.in	2000/02/11 07:23:43
***************
*** 99,105 ****
      my ($msg, $folder) = @_;
      my ($multi_folder);
      local (@Hdr) = ();
!     if (open(MSG, "<$msg")) {
  	&read_header(\*MSG, \@Hdr, 0);
  	close (MSG);
  	my $mid = &header_value(\@Hdr, 'Message-ID');
--- 99,105 ----
      my ($msg, $folder) = @_;
      my ($multi_folder);
      local (@Hdr) = ();
!     if (im_open(\*MSG, "<$msg")) {
  	&read_header(\*MSG, \@Hdr, 0);
  	close (MSG);
  	my $mid = &header_value(\@Hdr, 'Message-ID');
Index: imjoin.in
===================================================================
RCS file: /usr/local/CVS/im/imjoin.in,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 imjoin.in
*** imjoin.in	2000/01/29 12:33:53	1.1.1.7
--- imjoin.in	2000/02/11 07:23:43
***************
*** 106,112 ****
      my $total = 0;
      my ($path, $header);
      foreach $path (@paths) {
! 	if (open(MSG, "<$path")) {
  	    $/ = "\n\n";
  	    $header = <MSG>;
  	    $/ = "\n";
--- 106,112 ----
      my $total = 0;
      my ($path, $header);
      foreach $path (@paths) {
! 	if (im_open(\*MSG, "<$path")) {
  	    $/ = "\n\n";
  	    $header = <MSG>;
  	    $/ = "\n";
***************
*** 157,163 ****
  
      # show in sequence
      for ($i = 1; $i <= $#index; $i++) {
! 	if (open(MSG, "<$index[$i]")) {
  	    $/ = "\n\n";
  	    if ($i == 1) {		# first partial message
  		my $header = <MSG>;	# header of enclosing message
--- 157,163 ----
  
      # show in sequence
      for ($i = 1; $i <= $#index; $i++) {
! 	if (im_open(\*MSG, "<$index[$i]")) {
  	    $/ = "\n\n";
  	    if ($i == 1) {		# first partial message
  		my $header = <MSG>;	# header of enclosing message
***************
*** 221,227 ****
  	$path = $msg;
      }
  
!     if (open(MSG, "<$path")) {
  	$/ = "\n\n";
  	$header = <MSG>;
  	$/ = "\n";
--- 221,227 ----
  	$path = $msg;
      }
  
!     if (im_open(\*MSG, "<$path")) {
  	$/ = "\n\n";
  	$header = <MSG>;
  	$/ = "\n";
Index: imls.in
===================================================================
RCS file: /usr/local/CVS/im/imls.in,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 imls.in
*** imls.in	2000/01/29 12:33:53	1.1.1.7
--- imls.in	2000/02/11 07:23:43
***************
*** 410,416 ****
  	my $nmzidx = $_;
  	my @messages = ();
  
! 	open( NMZ, "namazu -aeS \"$opt_grep\" $nmzidx|") 
  	    || im_err( "namazu error\n");
  	@messages = sort {$a <=> $b} <NMZ>;
  	close( NMZ );
--- 410,416 ----
  	my $nmzidx = $_;
  	my @messages = ();
  
! 	im_open(\*NMZ, "namazu -aeS \"$opt_grep\" $nmzidx|") 
  	    || im_err( "namazu error\n");
  	@messages = sort {$a <=> $b} <NMZ>;
  	close( NMZ );
Index: immknmz.in
===================================================================
RCS file: /usr/local/CVS/im/immknmz.in,v
retrieving revision 1.1.1.6
diff -c -r1.1.1.6 immknmz.in
*** immknmz.in	2000/01/29 12:33:53	1.1.1.6
--- immknmz.in	2000/02/11 07:23:43
***************
*** 75,81 ****
  $tempfile =~ s/\/$//;
  $tempfile = "$tempfile/immknmz_temporary_file";
  
! open( FILE, "<$folderspath" );
  while ( <FILE> ){
      chomp;
      $msgfolder = $_;
--- 75,81 ----
  $tempfile =~ s/\/$//;
  $tempfile = "$tempfile/immknmz_temporary_file";
  
! im_open(\*FILE, "<$folderspath" );
  while ( <FILE> ){
      chomp;
      $msgfolder = $_;
***************
*** 106,112 ****
  	}
  
  	if ( scalar(@filelist) > 0 ){
! 	    open(TEMPFILE,">$tempfile");
  	    foreach ( @filelist ){
  		if (&win95p){
  		    print TEMPFILE "$msgfolder\\$_\n";
--- 106,112 ----
  	}
  
  	if ( scalar(@filelist) > 0 ){
! 	    im_open(\*TEMPFILE,">$tempfile");
  	    foreach ( @filelist ){
  		if (&win95p){
  		    print TEMPFILE "$msgfolder\\$_\n";
Index: imput.in
===================================================================
RCS file: /usr/local/CVS/im/imput.in,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 imput.in
*** imput.in	2000/01/29 12:33:54	1.1.1.7
--- imput.in	2000/02/11 07:23:44
***************
*** 1179,1189 ****
  	}
  	$message_file = &expand_path($d);
      }
!     unless (open(READ, "<$message_file")) {
  	im_err("Can not open: $message_file\n");
  	&error_exit;
      }
-     binmode(READ);
      if (&read_header(\*READ, \@Header, 0) < 0) {
  	&error_exit;
      }
--- 1179,1188 ----
  	}
  	$message_file = &expand_path($d);
      }
!     unless (im_open(\*READ, "<$message_file")) {
  	im_err("Can not open: $message_file\n");
  	&error_exit;
      }
      if (&read_header(\*READ, \@Header, 0) < 0) {
  	&error_exit;
      }
***************
*** 1206,1212 ****
      } else {
  	$message_file = &expand_path($file);
      }
!     unless (open(MP_READ, "<$message_file")) {
  	im_err("Can not open: $message_file\n");
  	&error_exit;
      }
--- 1205,1211 ----
      } else {
  	$message_file = &expand_path($file);
      }
!     unless (im_open(\*MP_READ, "<$message_file")) {
  	im_err("Can not open: $message_file\n");
  	&error_exit;
      }
***************
*** 1586,1592 ****
      }
      my ($message_file) = &expand_path($d);
      local (*DIST);
!     unless (open(DIST, "<$message_file")) {
  	im_err("Can not open: $message_file\n");
  	&error_exit;
      }
--- 1585,1591 ----
      }
      my ($message_file) = &expand_path($d);
      local (*DIST);
!     unless (im_open(\*DIST, "<$message_file")) {
  	im_err("Can not open: $message_file\n");
  	&error_exit;
      }
***************
*** 1622,1638 ****
  	my $tmp = &conf_dir . "/anno$$\_"
  			. substr($cur,rindex($cur,"/")+1,-1) . ".tmp";
  	# copy to temporary file
! 	unless (open(ORIGINAL, "<$cur")) {
  	    im_notice("anno: open failed(1): $cur ($!).\n");
  	    next;
  	}
! 	unless (open(TMP, ">$tmp")) {
  	    im_err("anno: creation failed: $tmp ($!).\n");
  	    close(ORIGINAL);
  	    return -1;
  	}
- 	binmode(TMP);
- 	binmode(ORIGINAL);
  	print TMP $first . $second;
  	my $checked = 0;
  	my $inheader = 1;
--- 1621,1635 ----
  	my $tmp = &conf_dir . "/anno$$\_"
  			. substr($cur,rindex($cur,"/")+1,-1) . ".tmp";
  	# copy to temporary file
! 	unless (im_open(\*ORIGINAL, "<$cur")) {
  	    im_notice("anno: open failed(1): $cur ($!).\n");
  	    next;
  	}
! 	unless (im_open(\*TMP, ">$tmp")) {
  	    im_err("anno: creation failed: $tmp ($!).\n");
  	    close(ORIGINAL);
  	    return -1;
  	}
  	print TMP $first . $second;
  	my $checked = 0;
  	my $inheader = 1;
***************
*** 1677,1695 ****
  	    return -1;
  	}
  	# copy back to original file (in case of links)
! 	unless (open(TMP, "<$tmp")) {
  	    im_err("anno: open failed(2): $tmp ($!).\n");
  	    unlink($tmp);
  	    return -1;
  	}
! 	unless (open(ORIGINAL, "+<$cur")) {
  	    im_err("anno: open failed(3): $cur ($!).\n");
  	    close(TMP);
  	    unlink($tmp);
  	    return -1;
  	}
- 	binmode(TMP);
- 	binmode(ORIGINAL);
  	my $size = -s ORIGINAL;
  	seek(ORIGINAL, 0, 2);
  	unless (print ORIGINAL $first . $second) {
--- 1674,1690 ----
  	    return -1;
  	}
  	# copy back to original file (in case of links)
! 	unless (im_open(\*TMP, "<$tmp")) {
  	    im_err("anno: open failed(2): $tmp ($!).\n");
  	    unlink($tmp);
  	    return -1;
  	}
! 	unless (im_open(\*ORIGINAL, "+<$cur")) {
  	    im_err("anno: open failed(3): $cur ($!).\n");
  	    close(TMP);
  	    unlink($tmp);
  	    return -1;
  	}
  	my $size = -s ORIGINAL;
  	seek(ORIGINAL, 0, 2);
  	unless (print ORIGINAL $first . $second) {
***************
*** 1707,1720 ****
  	    unlink($tmp);
  	    return -1;
  	}
! 	unless (open(ORIGINAL, "+<$cur")) {
  	    im_err("anno: open failed(4): $cur ($!).\n");
  	    close(TMP);
  	    unlink($tmp);
  	    return -1;
  	}
- 	binmode(TMP);
- 	binmode(ORIGINAL);
  	while (<TMP>) {
  	    unless (print ORIGINAL $_) {
  		close(TMP);
--- 1702,1713 ----
  	    unlink($tmp);
  	    return -1;
  	}
! 	unless (im_open(\*ORIGINAL, "+<$cur")) {
  	    im_err("anno: open failed(4): $cur ($!).\n");
  	    close(TMP);
  	    unlink($tmp);
  	    return -1;
  	}
  	while (<TMP>) {
  	    unless (print ORIGINAL $_) {
  		close(TMP);
***************
*** 1760,1766 ****
  	next unless ($q =~ /^\d+$/);
  #	$QUEUE = 'QUEUE';
  	rename ("$queue_dir/$q", "$queue_dir/$q.wrk");
! 	unless (open(QUEUE, "<$queue_dir/$q.wrk")) {
  	    im_err("can't open $queue_dir/$q.wrk\n");
  	    rename ("$queue_dir/$q.wrk", "$queue_dir/$q");
  	    return;
--- 1753,1759 ----
  	next unless ($q =~ /^\d+$/);
  #	$QUEUE = 'QUEUE';
  	rename ("$queue_dir/$q", "$queue_dir/$q.wrk");
! 	unless (im_open(\*QUEUE, "<$queue_dir/$q.wrk")) {
  	    im_err("can't open $queue_dir/$q.wrk\n");
  	    rename ("$queue_dir/$q.wrk", "$queue_dir/$q");
  	    return;
Index: imsort.in
===================================================================
RCS file: /usr/local/CVS/im/imsort.in,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 imsort.in
*** imsort.in	2000/01/29 12:33:54	1.1.1.7
--- imsort.in	2000/02/11 07:23:44
***************
*** 157,163 ****
      local $/ = '';
      my ($ml, $num);
  
!     if (open(MSG, "< $path")){
  	($_ = <MSG>) =~ s/\n\s+/ /g;
  	close(MSG);
      } else {
--- 157,163 ----
      local $/ = '';
      my ($ml, $num);
  
!     if (im_open(\*MSG, "< $path")){
  	($_ = <MSG>) =~ s/\n\s+/ /g;
  	close(MSG);
      } else {
Index: imtar.in
===================================================================
RCS file: /usr/local/CVS/im/imtar.in,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 imtar.in
*** imtar.in	2000/01/29 12:33:55	1.1.1.7
--- imtar.in	2000/02/11 07:23:44
***************
*** 89,96 ****
      if ($dst eq "stdout") {
          binmode(STDOUT);
      } else {
!         if (open(MMDF,">>$dst")) {
!             binmode(MMDF);
              select MMDF;   # xxx
          } else {
              im_die("cannot open $dst\n");
--- 89,95 ----
      if ($dst eq "stdout") {
          binmode(STDOUT);
      } else {
!         if (im_open(\*MMDF,">>$dst")) {
              select MMDF;   # xxx
          } else {
              im_die("cannot open $dst\n");
***************
*** 108,115 ****
  sub open_msg ($) {
      my $msg = $_;
      my $mmdf_delimiter="\001\001\001\001";
!     if (open(ART, "<$msg")) {
!         binmode(ART);
          print "$mmdf_delimiter\n";
          print while(<ART>);
          print "$mmdf_delimiter\n";
--- 107,113 ----
  sub open_msg ($) {
      my $msg = $_;
      my $mmdf_delimiter="\001\001\001\001";
!     if (im_open(\*ART, "<$msg")) {
          print "$mmdf_delimiter\n";
          print while(<ART>);
          print "$mmdf_delimiter\n";
Index: IM/File.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/File.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 File.pm
*** IM/File.pm	2000/01/29 12:33:55	1.1.1.7
--- IM/File.pm	2000/02/11 07:23:46
***************
*** 126,132 ****
      my ($id, $date, $hdr);
      local $/ = '';
  
!     if (open(MSG, "<$p")){
          $hdr = <MSG>;  close(MSG);
      } else {
  	im_warn("no message id in $m.\n");
--- 126,132 ----
      my ($id, $date, $hdr);
      local $/ = '';
  
!     if (im_open(\*MSG, "<$p")){
          $hdr = <MSG>;  close(MSG);
      } else {
  	im_warn("no message id in $m.\n");
Index: IM/Folder.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Folder.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 Folder.pm
*** IM/Folder.pm	2000/01/29 12:33:55	1.1.1.7
--- IM/Folder.pm	2000/02/11 07:23:46
***************
*** 84,90 ****
      return inbox_folder() if (! -f context_file());
  
      $folder = '';
!     open(IN, '< ' . context_file()) || im_die("can't open context file.\n");
      while (<IN>) {
  	chomp;
  	if (/^CurrentFolder[:=]\s*(\S+)$/) {
--- 84,90 ----
      return inbox_folder() if (! -f context_file());
  
      $folder = '';
!     im_open(\*IN, '< ' . context_file()) || im_die("can't open context file.\n");
      while (<IN>) {
  	chomp;
  	if (/^CurrentFolder[:=]\s*(\S+)$/) {
***************
*** 103,109 ****
      $buf = '';
  
      if (-f context_file()) {
! 	open(IN, '<' . context_file()) || im_die("can't open context file.\n");
  	while (<IN>) {
  	    chomp;
  	    next if (/^CurrentFolder[:=]\s*(\S+)$/);
--- 103,109 ----
      $buf = '';
  
      if (-f context_file()) {
! 	im_open(\*IN, '<' . context_file()) || im_die("can't open context file.\n");
  	while (<IN>) {
  	    chomp;
  	    next if (/^CurrentFolder[:=]\s*(\S+)$/);
***************
*** 112,118 ****
  	close(IN);
      }
  
!     open(OUT, '>' . context_file()) || im_die("can't open context file.\n");
      print OUT $buf;
      print OUT "CurrentFolder=$folder\n";
      close(OUT);
--- 112,118 ----
  	close(IN);
      }
  
!     im_open(\*OUT, '>' . context_file()) || im_die("can't open context file.\n");
      print OUT $buf;
      print OUT "CurrentFolder=$folder\n";
      close(OUT);
***************
*** 337,343 ****
   	$dir =~ s/\/\d+$//;
   	$dir = &expand_path($dir);
   	my($file) = ($dir . "/" . &touchfile());
! 	open(OF,">$file");
  	close(OF);
      } elsif (&os2p) {
  	my ($dir) = shift;
--- 337,343 ----
   	$dir =~ s/\/\d+$//;
   	$dir = &expand_path($dir);
   	my($file) = ($dir . "/" . &touchfile());
! 	im_open(\*OF,">$file");
  	close(OF);
      } elsif (&os2p) {
  	my ($dir) = shift;
Index: IM/Grep.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Grep.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 Grep.pm
*** IM/Grep.pm	2000/01/29 12:33:56	1.1.1.7
--- IM/Grep.pm	2000/02/11 07:23:46
***************
*** 105,111 ****
  	my($all, $head, $body) = ('', '', '');
  	local($/);
  
! 	unless (open(MES, "< $m")) {
  	    if (! $main::opt_quiet) {
  		im_warn("message $m not exists: $!\n");
  	    }
--- 105,111 ----
  	my($all, $head, $body) = ('', '', '');
  	local($/);
  
! 	unless (im_open(\*MES, "< $m")) {
  	    if (! $main::opt_quiet) {
  		im_warn("message $m not exists: $!\n");
  	    }
Index: IM/History.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/History.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 History.pm
*** IM/History.pm	2000/01/29 12:33:56	1.1.1.7
--- IM/History.pm	2000/02/11 07:23:46
***************
*** 102,113 ****
      return 0 unless ($with_lock);
  
      if ($DBtype eq 'DB') {
! 	unless (open(HIST_FH, "+<&=$fd")) {
  	    im_err "history: dup $fd ($!)\n";
  	    return -1;
  	}
      } elsif ($DBtype eq 'NDBM' or $DBtype eq 'SDBM') {
! 	unless (open(HIST_FH, "+<$dbfile.pag")) {
  	    im_err "history: open $dbfile.pag ($!)\n";
  	    return -1;
  	}
--- 102,113 ----
      return 0 unless ($with_lock);
  
      if ($DBtype eq 'DB') {
! 	unless (im_open(\*HIST_FH, "+<&=$fd")) {
  	    im_err "history: dup $fd ($!)\n";
  	    return -1;
  	}
      } elsif ($DBtype eq 'NDBM' or $DBtype eq 'SDBM') {
! 	unless (im_open(\*HIST_FH, "+<$dbfile.pag")) {
  	    im_err "history: open $dbfile.pag ($!)\n";
  	    return -1;
  	}
Index: IM/Imap.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Imap.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 Imap.pm
*** IM/Imap.pm	2000/01/29 12:33:56	1.1.1.7
--- IM/Imap.pm	2000/02/11 07:23:46
***************
*** 944,950 ****
      my @Message;
      local (*SRC);
  
!     unless (open(SRC, "<$src_path")) {
  	im_warn("can't open local message $src_path.\n");
  	return -1;
      }
--- 944,950 ----
      my @Message;
      local (*SRC);
  
!     unless (im_open(\*SRC, "<$src_path")) {
  	im_warn("can't open local message $src_path.\n");
  	return -1;
      }
Index: IM/LocalMbox.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/LocalMbox.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 LocalMbox.pm
*** IM/LocalMbox.pm	2000/01/29 12:33:57	1.1.1.7
--- IM/LocalMbox.pm	2000/02/11 07:23:47
***************
*** 195,201 ****
  		return -1;
  	    }
  
! 	    unless (open (SAVE, "+>$mbox")) {
  		im_err("can't open $mbox ($!).\n");
  		close(SAVE);
  		return -1;
--- 195,201 ----
  		return -1;
  	    }
  
! 	    unless (im_open(\*SAVE, "+>$mbox")) {
  		im_err("can't open $mbox ($!).\n");
  		close(SAVE);
  		return -1;
***************
*** 250,259 ****
      my ($src, $dst) = @_;
  
      im_debug("copy from $src to $dst\n") if (&debug('local'));
!     unless (open(SRC, "<$src")) {
  	return -1;
      }
!     unless (open(DST, "+>$dst")) {
  	return -1;
      }
      while (<SRC>) {
--- 250,259 ----
      my ($src, $dst) = @_;
  
      im_debug("copy from $src to $dst\n") if (&debug('local'));
!     unless (im_open(\*SRC, "<$src")) {
  	return -1;
      }
!     unless (im_open(\*DST, "+>$dst")) {
  	return -1;
      }
      while (<SRC>) {
***************
*** 323,329 ****
      local (*MBOX);
  
      im_notice("opening MBOX ($mbox)\n");
!     unless (open(MBOX, "<$mbox")) {
  	# XXX not found or unreadable...
  	return -1;
      }
--- 323,329 ----
      local (*MBOX);
  
      im_notice("opening MBOX ($mbox)\n");
!     unless (im_open(\*MBOX, "<$mbox")) {
  	# XXX not found or unreadable...
  	return -1;
      }
***************
*** 357,363 ****
      im_info("Getting new messages from local mailbox into $dst....\n")
  	if ($how eq 'get');
      im_warn("opening MBOX ($mbox)\n") if (&verbose);
!     unless (open(MBOX, "<$mbox")) {
  	# XXX not found or unreadable...
  	return -1;
      }
--- 357,363 ----
      im_info("Getting new messages from local mailbox into $dst....\n")
  	if ($how eq 'get');
      im_warn("opening MBOX ($mbox)\n") if (&verbose);
!     unless (im_open(\*MBOX, "<$mbox")) {
  	# XXX not found or unreadable...
  	return -1;
      }
***************
*** 530,536 ****
  sub local_empty ($) {
      my $mbox = shift;
      unless (truncate($mbox, 0)) {
! 	unless (open(MBOX, ">$mbox")) {
  	    im_warn("mailbox can not be zeroed.\n");
  	    return;
  	}
--- 530,536 ----
  sub local_empty ($) {
      my $mbox = shift;
      unless (truncate($mbox, 0)) {
! 	unless (im_open(\*MBOX, ">$mbox")) {
  	    im_warn("mailbox can not be zeroed.\n");
  	    return;
  	}
***************
*** 563,569 ****
  #	    sleep(5);
  #	}
  
! 	unless (open(LOCKFILE, ">$base.$$")) {
  	    im_warn("can't create lock file $base.$$: $!\n");
  	    im_warn("use 'flock' instead of 'file' if possible.\n");
  	    return -1;
--- 563,569 ----
  #	    sleep(5);
  #	}
  
! 	unless (im_open(\*LOCKFILE, ">$base.$$")) {
  	    im_warn("can't create lock file $base.$$: $!\n");
  	    im_warn("use 'flock' instead of 'file' if possible.\n");
  	    return -1;
***************
*** 585,591 ****
  	$locked_by_file = 1;
      }
      if ($type =~ /flock/) {
! 	unless (open(LOCK_FH, "+<$base")) {
  	    im_err "can't open $base :$!\n";
  	    return -1;
  	}
--- 585,591 ----
  	$locked_by_file = 1;
      }
      if ($type =~ /flock/) {
! 	unless (im_open(\*LOCK_FH, "+<$base")) {
  	    im_err "can't open $base :$!\n";
  	    return -1;
  	}
Index: IM/Log.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Log.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 Log.pm
*** IM/Log.pm	2000/01/29 12:33:57	1.1.1.7
--- IM/Log.pm	2000/02/11 07:23:47
***************
*** 103,109 ****
      return unless ($file =~ /^(\S+)$/);
      $file = $1;	# to pass through taint check
      &msg_mode(1);
!     unless (open(HISTORY, ">>$file")) {
  	im_warn("can't open history file: $file ($!)\n");
  	return;
      }
--- 103,109 ----
      return unless ($file =~ /^(\S+)$/);
      $file = $1;	# to pass through taint check
      &msg_mode(1);
!     unless (im_open(\*HISTORY, ">>$file")) {
  	im_warn("can't open history file: $file ($!)\n");
  	return;
      }
Index: IM/MsgStore.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/MsgStore.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 MsgStore.pm
*** IM/MsgStore.pm	2000/01/29 12:33:58	1.1.1.7
--- IM/MsgStore.pm	2000/02/11 07:23:47
***************
*** 247,253 ****
      unless ($fcc_dir) {
  	msg_mode(1);
  	im_debug("FCC file: $fcc_folder\n") if (&debug('fcc'));
! 	unless (open(FCC, ">>$fcc_folder")) {
  	    im_warn("can't open FCC file: $fcc_folder\n");
  	    return undef;
  	}
--- 247,253 ----
      unless ($fcc_dir) {
  	msg_mode(1);
  	im_debug("FCC file: $fcc_folder\n") if (&debug('fcc'));
! 	unless (im_open(\*FCC, ">>$fcc_folder")) {
  	    im_warn("can't open FCC file: $fcc_folder\n");
  	    return undef;
  	}
***************
*** 289,295 ****
  sub excl_create (*$) {
      (local *MESSAGE, my $file) = @_;
      msg_mode(1);
!     return -1 unless (sysopen(MESSAGE, $file, file_attr()));
      return 0;
  }
  
--- 289,295 ----
  sub excl_create (*$) {
      (local *MESSAGE, my $file) = @_;
      msg_mode(1);
!     return -1 unless (im_sysopen(\*MESSAGE, $file, file_attr()));
      return 0;
  }
  
Index: IM/Nntp.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Nntp.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 Nntp.pm
*** IM/Nntp.pm	2000/01/29 12:33:58	1.1.1.7
--- IM/Nntp.pm	2000/02/11 07:23:48
***************
*** 411,418 ****
      $server =~ s!/\d+$!!;
      my $nntphist = &nntphistoryfile() . '-' . $server;
      if ( -f $nntphist ) {
! 	open (NEWSHIST, "+<$nntphist");
! 	binmode(NEWSHIST);
  	while ($pos = tell(NEWSHIST), $_ = <NEWSHIST>) {
  	    /^([^:]+):\s*(\d+)/;
  	    if ($group eq $1) {
--- 411,417 ----
      $server =~ s!/\d+$!!;
      my $nntphist = &nntphistoryfile() . '-' . $server;
      if ( -f $nntphist ) {
! 	im_open(\*NEWSHIST, "+<$nntphist");
  	while ($pos = tell(NEWSHIST), $_ = <NEWSHIST>) {
  	    /^([^:]+):\s*(\d+)/;
  	    if ($group eq $1) {
***************
*** 435,442 ****
  	  }
      } else {
  #	open (NEWSHIST, ">$nntphist");
! 	sysopen(NEWSHIST, $nntphist, O_RDWR()|O_CREAT());
! 	binmode(NEWSHIST);
      }
      seek(NEWSHIST, 0, 2);
      printf NEWSHIST "$group: %${size}s%07d\n", '', $number;
--- 434,440 ----
  	  }
      } else {
  #	open (NEWSHIST, ">$nntphist");
! 	im_sysopen(\*NEWSHIST, $nntphist, O_RDWR()|O_CREAT());
      }
      seek(NEWSHIST, 0, 2);
      printf NEWSHIST "$group: %${size}s%07d\n", '', $number;
***************
*** 452,459 ****
      $server =~ s!\%\d+$!!;
      $server =~ s!/\d+$!!;
      my $nntphist = &nntphistoryfile() . '-' . $server;
!     if (open (NEWSHIST, "<$nntphist")) {
!         binmode(NEWSHIST);
  	while (<NEWSHIST>) {
  	    /^([^:]+):\s*(\d+)/;
  	    if ($group eq $1) {
--- 450,456 ----
      $server =~ s!\%\d+$!!;
      $server =~ s!/\d+$!!;
      my $nntphist = &nntphistoryfile() . '-' . $server;
!     if (im_open(\*NEWSHIST, "<$nntphist")) {
  	while (<NEWSHIST>) {
  	    /^([^:]+):\s*(\d+)/;
  	    if ($group eq $1) {
Index: IM/Pop.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Pop.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 Pop.pm
*** IM/Pop.pm	2000/01/29 12:33:58	1.1.1.7
--- IM/Pop.pm	2000/02/11 07:23:48
***************
*** 305,311 ****
  	    return -1;
  	}
  	im_notice("reading POP history: $histfile\n");
! 	if (open (HIST, "<$histfile")) {
  	    while (<HIST>) {
  		chomp;
  		if (/^(\S+)\s(\d+)$/) {
--- 305,311 ----
  	    return -1;
  	}
  	im_notice("reading POP history: $histfile\n");
! 	if (im_open(\*HIST, "<$histfile")) {
  	    while (<HIST>) {
  		chomp;
  		if (/^(\S+)\s(\d+)$/) {
***************
*** 411,417 ****
  
  	if ($new > 0 && $main::opt_keep != 0) {
  	    im_notice("writing UIDL history: $histfile\n");
! 	    if (open (HIST, ">$histfile")) {
  		if ($keep_proto eq 'UIDL') {
  		    for ($i = 1; $i <= $msgs; $i++) {
  			if (($h = $uidl[$i]) ne '' && $history{$h} > 0) {
--- 411,417 ----
  
  	if ($new > 0 && $main::opt_keep != 0) {
  	    im_notice("writing UIDL history: $histfile\n");
! 	    if (im_open(\*HIST, ">$histfile")) {
  		if ($keep_proto eq 'UIDL') {
  		    for ($i = 1; $i <= $msgs; $i++) {
  			if (($h = $uidl[$i]) ne '' && $history{$h} > 0) {
Index: IM/Recipient.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Recipient.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 Recipient.pm
*** IM/Recipient.pm	2000/01/29 12:33:58	1.1.1.7
--- IM/Recipient.pm	2000/02/11 07:23:48
***************
*** 265,271 ****
  sub include_open ($) {
      my ($file) = shift;
      return undef if $Include_Files{$file};
!     open($file, $file) || return undef;
      $Include_Files{$file} = 1;
      return $file;
  }
--- 265,271 ----
  sub include_open ($) {
      my ($file) = shift;
      return undef if $Include_Files{$file};
!     im_open($file, $file) || return undef;
      $Include_Files{$file} = 1;
      return $file;
  }
Index: IM/Scan.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Scan.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 Scan.pm
*** IM/Scan.pm	2000/01/29 12:33:58	1.1.1.7
--- IM/Scan.pm	2000/02/11 07:23:49
***************
*** 247,254 ****
  	$Head{'folder:'} = '+' . $folder;
      }
  
!     open(MSG, "<$path") || return;
!     binmode(MSG);
  
      ##
      ## Collect file attributes
--- 247,253 ----
  	$Head{'folder:'} = '+' . $folder;
      }
  
!     im_open(\*MSG, "<$path") || return;
  
      ##
      ## Collect file attributes
***************
*** 911,917 ****
      }
      my $file = petname_file();
      return unless $file;
!     unless (open(PETNAMES, $file)) {
  	im_warn("can't open petname file $file\n");
  	return;
      } 
--- 910,916 ----
      }
      my $file = petname_file();
      return unless $file;
!     unless (open(im_PETNAMES, $file)) {
  	im_warn("can't open petname file $file\n");
  	return;
      } 
Index: IM/Ssh.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Ssh.pm,v
retrieving revision 1.1.1.6
diff -c -r1.1.1.6 Ssh.pm
*** IM/Ssh.pm	2000/01/29 12:33:59	1.1.1.6
--- IM/Ssh.pm	2000/02/11 07:23:49
***************
*** 73,80 ****
  	    im_warn( "Accident in Port Forwading: $buf\n" );
  	} elsif ( $pid == 0 ) {
  	    close $read;
! 	    open( STDOUT, ">&$write" );
! 	    open( STDERR, ">&$write" );
  	    exec( $SSH, '-n', '-x', '-o', 'BatchMode yes',
  		  "-L$local:$server:$remote", $host,
  		  sprintf( 'echo ssh_proxy_connect ; sleep %s', &command_timeout() ) );
--- 73,80 ----
  	    im_warn( "Accident in Port Forwading: $buf\n" );
  	} elsif ( $pid == 0 ) {
  	    close $read;
! 	    open(STDOUT, ">&$write" );
! 	    open(STDERR, ">&$write" );
  	    exec( $SSH, '-n', '-x', '-o', 'BatchMode yes',
  		  "-L$local:$server:$remote", $host,
  		  sprintf( 'echo ssh_proxy_connect ; sleep %s', &command_timeout() ) );
Index: IM/Util.pm
===================================================================
RCS file: /usr/local/CVS/im/IM/Util.pm,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 Util.pm
*** IM/Util.pm	2000/01/29 12:33:59	1.1.1.7
--- IM/Util.pm	2000/02/11 07:23:49
***************
*** 26,32 ****
  	     progname
  	     im_getlogin
  	     im_msg im_info im_debug im_notice im_warn im_err im_die im_die2
! 	     im_save_error im_saved_errors
  	     debug_option set_debug debug set_verbose verbose
  	     flush);
  
--- 26,32 ----
  	     progname
  	     im_getlogin
  	     im_msg im_info im_debug im_notice im_warn im_err im_die im_die2
! 	     im_save_error im_saved_errors im_open im_sysopen
  	     debug_option set_debug debug set_verbose verbose
  	     flush);
  
***************
*** 251,256 ****
--- 251,278 ----
      print '';
      $| = 0;
      select($old);
+ }
+ 
+ #
+ # open file
+ #
+ 
+ sub im_open($$) {
+     my ($d, $a) = @_;
+     my ($r);
+     if ($r = open($d, $a)) {
+ 	binmode($d) if &win95p();
+     }
+     return $r;
+ }
+ 
+ sub im_sysopen($$$) {
+     my ($d, $f, $a) = @_;
+     my ($r);
+     if ($r = sysopen($d, $f, $a)) {
+ 	binmode($d) if &win95p();
+     }
+     return $r;
  }
  
  1;


Mew-dist メーリングリストの案内