#!/usr/local/bin/perl # # author kang soonlai skang@tisl.ukans.edu # name write-job # date 24 Jan 1996 # 6 oct 1996 v1.1 # # after add-job has been called, if the user is satisfied with the content # it will write it to the file, and post it to the eecs job page. # # modify these: $indexfile, $tempfile, $numfile, $header and $datafile. # ############################################################################ # define file to be edited #$indexfile = "/tools/www/common/db/jobs/index.html"; #$tempfile = "/tools/www/common/db/jobs/temp.html"; #$numfile = "/tools/www/common/db/jobs/num"; $indexfile = "/users/skang/public_html/experiment/jobindex.html"; $tempfile = "/users/skang/public_html/experiment/job.html"; $numfile = "/users/skang/public_html/experiment/num"; # print new job entry first or last? first = y, last = n; $first = 'n'; # Print out a content-type for HTTP/1.0 compatibility print "Content-type: text/html\n\n"; # for writing to the job listing file. $header = 17; # this is the line number to skip when writing to the file. $position = shift(@ARGV); $position =~ s/_/ /g; # use number as file name so that no same file will be created open (NUMFILE,"+<$numfile") || die("Can't open $numfile: $!\n"); $filename = ; chop $filename; $filename++ ; seek(NUMFILE,0,0); print (NUMFILE "$filename\n"); close (NUMFILE) ; $datafile = "/users/skang/public_html/experiment/$filename.html"; # get local time ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $day = sprintf("%02d/%02d/%02d",$year,$mon+1,$mday); # copy the temp file to the numbered file. system("cp $tempfile $datafile"); if ($first eq 'y') { # open index file and save it to memory for later writing open(JOB, "$indexfile") || die "Can't open $indexfile!\n"; $i = 0; while ($info = ) { chop $info ; $lines[$i] = $info ; $i++ ; } close (JOB); $i = 0 ; open(JOBS, "> $indexfile") || die "Can't open $indexfile!\n"; foreach $line (@lines) { print JOBS "$line\n"; $i++; if ( $i==$header ) { print JOBS ""; print JOBS "\n"; print JOBS "\t$position $day
\n"; } } } else { # print new entry last. open(JOBS, ">> $indexfile") || die "Can't open $indexfile!\n"; print JOBS ""; print JOBS "\n"; print JOBS "\t$position $day
\n"; } close (JOBS); # Print a title and initial heading print "Thank you\n"; print "

Thank you

\n"; # say thank you? Just to be polite print "Your tag has been added to the"; print " "; print "EECS Job page!";