Path: utzoo!mnetor!uunet!vixie!paul From: paul@vixie.UUCP (Paul Vixie Esq) Newsgroups: comp.sources.d Subject: Re: A perl program to change usg style dfs into Berkeley Message-ID: <801@vixie.UUCP> Date: 7 Feb 88 19:58:04 GMT References: <1821621@ncrcpx.UUCP> Reply-To: paul@vixie.UUCP (Paul Vixie Esq) Organization: Vixie Enterprises, San Francisco Lines: 52 Keywords: perl source code In article <1821621@ncrcpx.UUCP> craig@ncrcpx.UUCP (R. Craig Peterson) writes: #[...] berkeley style dfs... There was some c source posted not too long ago #to do the same, but there were some problems running it on my system, and #since perl was there, I used it instead of fixing the c version. There is a new, fixed-up version of bdf.c in testing. I'll be sending it out to comp.sources.somethingorother pretty soon now... #The input (which it gets itself from df -t) looks like: # #/usr/acct (/dev/dsk/1s1): 34928 blocks 13049 i-nodes # total: 233070 blocks 29120 i-nodes #/ (/dev/dsk/0s1): 28878 blocks 9506 i-nodes # total: 212924 blocks 26608 i-nodes Beware that there can be blanks and asterisks in irritating places in the output of 'df -t' on a USG system. Also, the /dev/dsk can be /dev/dsk/abcdef (six letters) on some systems. Nice to have all this stuff standardized... #The output looks like: # #Filesystem kbytes used avail capacity iused ifree %iused Mounted on #/usr/acct 116535 99073 17462 85% 16071 13049 55% 1s1 #/ 106462 92023 14439 86% 17103 9505 64% 0s1 This is backwards from Berkeley DF -- the "Filesystem" column has the device file and the "Mounted on" has the mount point. #(P.S. Great work with Perl, Larry!! It looks like I'll be using it #alot more in the future! For the rest of you, if you haven't looked at #Perl, and you process alot of strings, etc., you're missing alot!) I think if I'd had perl when I wrote bdf.c, I'd still have made up my own. Nice as it is, the number of patches per week make perl a little hard to keep up with, especially for the 10-odd USG systems I administer. Still, Perl is obviously a better choice than C for this kind of task; the fact that your version fits in 30 very readable lines vs. my C version at around 200 messy ones clearly shows the advantages of Perl. I therefore echo your sentiments -- great job, Larry. #if test `wc -l < bdf` -ne 30 ; then # echo 'shar: bdf was damaged during transit (should have been 30 bytes)' #fi Actually, it "should have been 30 *LINES*", not "*BYTES*". -- Paul A Vixie Esq paul%vixie@uunet.uu.net {uunet,ptsfa,hoptoad}!vixie!paul San Francisco, (415) 647-7023