# #include /* * OUTHD performs miscellaneous housekeeping for the creation of a new * picture file from an existing one when the header information is not * to be changed, save for the inclusion of the calling program's argument * line. The header is modified to reflect the new length of the * comments and is output to FDOUT. OUTHD then copies the existing * comments from FDIN to FDOUT, unless a negative value has been given * for FDIN, or the existing comment length is zero. The call line is * then appended to the comments by a call to PRARGV. */ /* Joseph Pallas 9/18/80 cc -O -c outhd.c */ int outhd(fdin, fdout, newarea, argv) int fdin, fdout; struct cvl_p *newarea; char *argv[]; { register int old_length; register int total; register int arglen; /* update header comment_length field */ old_length = newarea->cv_lcom; arglen = lnargv(argv); newarea->cv_lcom += arglen; /* write new header */ if (ohead(fdout, newarea) == -1) return(-1); /* test for copy */ if ((old_length > 0) && (fdin >= 0)) { if ((total = cpcmnt(fdin, fdout, old_length)) != old_length) return(-1); } else total = 0; /* add new comments */ if (prargv(fdout, argv) != arglen) return(-1); return(total + arglen); }