Xref: utzoo news.software.b:3611 comp.sources.d:4395 Path: utzoo!utstat!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!gem.mps.ohio-state.edu!rpi!tale From: tale@pawl.rpi.edu (David C Lawrence) Newsgroups: news.software.b,comp.sources.d Subject: Re: C News "upact" in Perl 3.0 Message-ID: Date: 22 Nov 89 06:17:13 GMT References: <2565B57C.10978@ateng.com> <1989Nov19.014731.26346@utzoo.uucp> <25682EB0.24425@ateng.com> Organization: Rensselaer Polytechnic Institute, Troy NY Lines: 43 According to henry@utzoo.uucp (Henry Spencer): Henry> Uh, in any modern C News distribution you will find Henry> updatemin.c, which does the same thing in C. In <25682EB0.24425@ateng.com> chip@ateng.com (Chip Salzenberg) writes: Chip> Uh... I knew that. :-) I didn't know it. I'm glad your posting prompted Henry's note, for two reasons. A) It munged my active file by always setting $min to 1 + $max. B) updatemin is faster anyway. It fixed the damage done by the perl upact pretty quickly. :-) Now I am also quite content to run updatemin nightly from cron after expire. The problem with upact was in dirlow(). $min never got set. I don't understand exactly what was failing, but many printf's later I tracked it down to the fact that though $low was being set in the "while" control structure, it's value was still "" when it exited: sub dirlow { local ($dir) = @_; local ($low, $f); opendir(dir,$dir) || return ""; $low = ""; while ($f = readdir(dir)) { printf "%s\n", $f; next unless $f =~ /^[0-9]+$/; $low = $f if ($low eq "") || ($f < $low); } closedir(dir); return $low; } This is in perl 3.0.1.2, patchlevel 6, GCC 1.35 compiled on a Sun 3, SunOS 4.0.3 system. Dave -- (setq mail '("tale@pawl.rpi.edu" "tale@ai.mit.edu" "tale@rpitsmts.bitnet"))