# IMNEWNAME -- Change the name of an image to a new name # # Bernie Simon 1-Apr-88 Original procedure imnewname (oldname, dirname, newname, verbose) char oldname[ARB] # i: Old image name char dirname[ARB] # i: New directory name char newname[ARB] # i: New image name bool verbose # i: Print diagnostic message flag #-- pointer sp, oimage, timage, nimage bool streq() begin # Allocate memory to hold strings call smark (sp) call salloc (oimage, SZ_FNAME, TY_CHAR) call salloc (timage, SZ_FNAME, TY_CHAR) call salloc (nimage, SZ_FNAME, TY_CHAR) # Create input and output image names call imgcluster (oldname, Memc[oimage], SZ_FNAME) call imgcluster (newname, Memc[timage], SZ_FNAME) call strcpy (dirname, Memc[nimage], SZ_FNAME) call strcat (Memc[timage], Memc[nimage], SZ_FNAME) # If the old and new image names are the same # don't bother trying to rename the image if (streq (Memc[oimage], Memc[nimage])) return # Rename image call imrename (Memc[oimage], Memc[nimage]) # Print informational message if (verbose) { call printf ("%s -> %s\n") call pargstr (Memc[oimage]) call pargstr (Memc[nimage]) call flush (STDOUT) } # Free memory call sfree (sp) end