[ Previous ] [ Next ] [ Index ] [ C-Kermit Home ] [ Kermit Home ]
Article: 10879 of comp.protocols.kermit.misc
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: C-Kermit 7.0 Case Study #01 - Cleaning Out Beta-Test Binaries
Date: 7 Jan 2000 23:53:58 GMT
Organization: Columbia University
As time permits, we're going to try to show off some of C-Kermit 7.0's new features in a series of case studies posted here. If you'd like to post your own stories, feel free -- that's what this newsgroup is for! Ditto if you'd like to suggest a topic to be presented.
Today's case study shows how C-Kermit 7.0 can be used to clean up after itself. As those of you who have been following our neverending saga know, the C-Kermit 7.0 release was preceded by a long series of Alpha and Beta tests, in each of which we tried to make binaries available for as many platforms as possible. For example, the Solaris 2.5.1 Intel test binary names look like:
cku193a03.solaris25-i386-2.5.1 (Edit 193 Alpha Test 03) cku195b07.solaris25-i386-2.5.1 (Edit 195 Beta Test 07) cku196b11.solaris25-i386-2.5.1 (Edit 196 Beta Test 11)And then the final release binary for this platform is called:
cku196.solaris25-i386-2.5.1Within a few days after release, we had about 170 final binaries (keep 'em coming!), and hundreds more test ones, each binary consuming about a megabyte of disk space. Before long, our server disk was running out of space.
Problem: Given about 600 C-Kermit binaries, how to remove test binaries for builds that have a final release, but preserve test binaries for the other platforms that we don't yet have final builds for?
Here's how to do it with a Kermit script (the lines are tagged by numbers that are not part of the script):
1. #!/usr/local/bin/kermit + 2. cd /pub/ftp/kermit/bin/ 3. space 4. .\%n := \ffiles(ck?196[-.]*,&a) 5. for \%i 1 \%n 1 { 6. .\%f := \&a[\%i] 7. echo \%f... 8. .\%g := \freplace(\%f,196,19[3-6][ab][0-9][0-9]) 9. .\%m := \ffiles(\%g,&b) 10. if ( > \%m 0 ) { 11. echo { MATCHES: \%g: \%m} 12. for \%j 1 \%m 1 { 13. ; echo { \flpad(\%j,2). \&b[\%j]} 14. delete /verb \&b[\%j] 15. } 16. } 17. } 18. space 19. exit
Here's a line-by-line explanation:
Then we find out how much space we freed (a lot!), and an EXIT command is included at the end; otherwise Kermit issues its prompt and waits for more commands. Kerbang scripts are typically terminated by EXIT.
Note that the arrays created by the \ffiles() function did not need to be declared; they were created dynamically. The array-loading functions are explained in Sections 4.11.4 and 7.10 of the update notes.
We run this script simply by typing its name. No need to start Kermit first; in fact, we never even *see* Kermit.
This is a rather simple script. In fact it could have done more; for example, removing ALL extraneous files, such as older test binaries for which newer test binaries exist, but not a final release binary. Tasks like this are illustrated in some of the file management scripts in the C-Kermit script library.
- Frank
[ Top ] [ Previous] [ Next ] [ C-Kermit Home ] [ Kermit Home ]
C-Kermit 7.0 / Columbia University / kermit@kermitproject.org / 7 Jan 2000