#!/usr/global/bin/perl -w # ############################################################### # # File: ad_nam.pl # # Purpose: To run DSP in order to add the image name to the DSP # file converted to a .GIF for display on the web. # # ############################################################### # ################################################# # Read file and get input filename, and image name $LF = "/usr/people/globec/port8080/htdocs/temp-dir/fnam"; open LF or die "Can not find file:\n $LF $!\n"; sysread LF, $fnams, 50000; @imgs = split(/\n/,$fnams); close (LF); #print "$#imgs\n"; #print "$imgs[0]\n"; # This is the image name #print "$imgs[1]\n"; # Input filename # ################################################### # Make dsp file "tmp.dsp" to create new image file # This is one way to get the image name into DSP. system "rm -f /usr/people/globec/port8080/htdocs/temp-dir/tmp.dsp"; open (OUT, ">/usr/people/globec/port8080/htdocs/temp-dir/tmp.dsp") || die " Sorry, couldn't create file tmp.dsp\n $!\n"; print OUT "dp 1, size=512,512\n"; print OUT "clr\n"; print OUT "clrgr\n"; print OUT "defp petes\n"; print OUT "pal 24\n"; print OUT "load $imgs[1]\n"; print OUT "colrgr 1,0,31,31,31\n"; print OUT "cdr\n"; print OUT "font fix.8\n"; print OUT "str 50,25,1,0,$imgs[0]\n"; print OUT "end\n"; print OUT "mergev\n"; print OUT "dsabgr\n"; print OUT "replace 0,1,4,255,0,in=IMAGE0: out=IMAGE0:\n"; print OUT "save in=IMAGE0: out=/usr/people/globec/port8080/htdocs/temp-dir/nim.img\n"; close (OUT); # ########################################################## # Run DSP tmp.dsp file to make new image open (OUT, ">/usr/people/globec/port8080/htdocs/temp-dir/ad_nam.csh") || die"Sorry, couldn't create file tmp.dsp\n $!\n"; print OUT "#!/bin/tcsh \n"; #print OUT "source /home/user/rgroman/.cshrc \n"; #print OUT "source /home/user/rgroman/.login \n"; print OUT "dsp < /usr/people/globec/port8080/htdocs/temp-dir/tmp.dsp\n"; print OUT "exit \n"; close (OUT); system "chmod u+x /usr/people/globec/port8080/htdocs/temp-dir/tmp.dsp"; system "chmod u+x /usr/people/globec/port8080/htdocs/temp-dir/ad_nam.csh"; #system "dsp < /usr/people/globec/port8080/htdocs/temp-dir/tmp.dsp"; # ############################################# # Rename back to original filename #system "rm -f $imgs[1]"; #system "mv /usr/people/globec/port8080/htdocs/temp-dir/nim.img $imgs[1]"; exit