|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ T f ┃
Length: 2230 (0x8b6) Types: TextFile Names: »format.c«
└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen └─ ⟦this⟧ »cph85dist/rman/daemon/format.c«
#ifndef lint static char *RCSid = "$Header: format.c,v 1.6 85/08/27 15:16:41 broome Exp $"; #endif /* * $Log: format.c,v $ * Revision 1.6 85/08/27 15:16:41 broome * Last cleanup before release. * * Revision 1.5 85/08/06 11:43:56 broome * Added check for exit status, * remove core if it dumped ... * * Revision 1.4 85/07/06 16:55:50 broome * * Revision 1.3 85/07/03 17:34:18 broome * * Revision 1.2 85/07/02 21:05:43 broome * * Revision 1.1 85/06/25 11:23:33 broome * Initial revision */ #include <stdio.h> #include <sys/file.h> #include <sys/wait.h> #include "response.h" #define NROFF "/usr/bin/nroff" /* * Format the named file into catable form, placing the output into `dest'. */ format (src, dest) char *src, *dest; { union wait status; int pid, fd; extern int errno; /* tell them what's going on */ printf ("%d-formatting file %s ==> %s ....\r\n", INFO_FMT, src, dest); (void) fflush (stdout); if ((fd = creat (dest, 0644)) == -1) { /* can't create file */ printf ("%d Cannot create output file %s (%d)\r\n", ERR_OUTPUT, dest, errno); return (1); } switch (pid = fork()) { case -1: return (1); /* can't fork */ case 0: if (fd != 1) { /* child */ dup2 (fd, 1); close (fd); } execl (NROFF, "nroff", "-man", src, 0); perror ("exec"); exit (1); default: close (fd); /* parent */ while (wait (&status) != pid) ; if (status.w_coredump) { /* shouldn't core dump */ (void) unlink ("core"); /* clean up */ printf ("%d Format encountered core dump!\r\n", ERR_CORE); return (1); } if (status.w_retcode) { /* non-zero exit status */ printf ("%d Format returned non-zero exit code.\r\n", ERR_EXIT); return (2); } printf ("%d-done.\r\n", INFO_DONE); return (0); /* all was ok */ } }