/* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* MAKEPNAME * * PURPOSE: * Put together the various pieces of the plate file name. * This is operating system-dependent -- this version works for * Unix or VMS by using the VMS parameter. * * CALLING SEQUENCE: * filename=makepname(h) * * INPUTS: * h (* Header) header structure * * OUTPUTS: * returns pointer to null-terminated plate filename (with * generic .YX extension) * * MODIFICATION HISTORY * Created by R. White, 7 August 1991 */ #include #include #include #include "header.h" #ifdef VMS /* * VMS filename characters: * "." separates subdirectories * "]" marks end of subdirectories */ #define DIR_SEP_CHAR "." #define DIR_END_CHAR "]" #else /* * Unix filename characters: * "/" separates subdirectories * "/" marks end of subdirectories */ #define DIR_SEP_CHAR "/" #define DIR_END_CHAR "/" #endif extern char *makepname(h) Header *h; { char *filename; int nf; /* * filename for plate images is: * plate_root + plate_name + '/' + compression + '/' + plate_name + '.YX' * * or for VMS: * * plate_root + plate_name + '.' + compression + ']' + plate_name + '.YX' * * where + means concatentation. YX gets replaced by the appropriate * subimage extension. */ /* * length of string (including null at end) */ nf = strlen(h->plate_root) + 2*strlen(h->plate_name) + strlen(h->compression) + 6; filename = malloc(nf); strcpy(filename, h->plate_root); strcat(filename, h->plate_name); strcat(filename, DIR_SEP_CHAR); strcat(filename, h->compression); strcat(filename, DIR_END_CHAR); strcat(filename, h->plate_name); /* * generic extension, will be replaced with actual extension for * each file */ strcat(filename, ".YX"); return(filename); }