3 ###############################################################################
6 # Author : Chris Koeritz #
7 # Rights : Copyright (C) 1996-$now by Author #
11 # Operates on a number stored in a text file. the number can be retrieved #
12 # for whatever purpose or it can be incremented. #
14 ###############################################################################
15 # This program is free software; you can redistribute it and/or modify it #
16 # under the terms of the GNU General Public License as published by the Free #
17 # Software Foundation; either version 2 of the License or (at your option) #
18 # any later version. See: "http://www.gruntose.com/Info/GNU/GPL.html" for a #
19 # version of the License. Please send any updates to "fred@gruntose.com". #
20 ###############################################################################
22 # A number is retrieved from the passed in filename and returned.
24 local($number_file) = @_;
25 #print "num file is $number_file\n";
26 open(NUMBERING, "$number_file");
27 local($number) = int(<NUMBERING>);
28 if ($number <= 0) { $number = 1; }
29 if ($number < 10) { $number = '0'.$number; }
30 if ($number < 100) { $number = '0'.$number; }
31 if ($number < 1000) { $number = '0'.$number; }
32 # upgraded to 6 digit numbers. whoo hoo.
33 if ($number < 10000) { $number = '0'.$number; }
34 if ($number < 100000) { $number = '0'.$number; }
39 # the number in the passed filename is increased.
41 local($number_file) = @_;
42 local($number) = &get_number($number_file);
43 if ($number < 0) { $number = '000000'; }
45 if ($number > 999999) { $number = '000000'; }
46 open(NUMBERING, "> $number_file");
47 #print "number is now $number\n";
48 print NUMBERING "$number\n";
52 # stores the number specified into the file specified.
54 local($number, $number_file) = @_;
55 #print "storing $number into $number_file\n";
56 open(NUMBERING, "> $number_file");
57 print NUMBERING "$number\n";