diff options
Diffstat (limited to 'dviware/quicspool/src/cleanup.c')
-rw-r--r-- | dviware/quicspool/src/cleanup.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/dviware/quicspool/src/cleanup.c b/dviware/quicspool/src/cleanup.c new file mode 100644 index 0000000000..571d902e27 --- /dev/null +++ b/dviware/quicspool/src/cleanup.c @@ -0,0 +1,86 @@ +#ifndef lint +static char *rcs = "$Header: cleanup.c,v 1.1 88/01/15 13:03:17 simpson Rel $"; +#endif +/* +$Log: cleanup.c,v $ + * Revision 1.1 88/01/15 13:03:17 simpson + * initial release + * + * Revision 0.1 87/12/11 18:30:43 simpson + * beta test + * +*/ + +/* Cleanup and error routines */ + +#include <stdio.h> +#include <local/profile.h> +#include <local/qms.h> +#include "constants.h" +#include "fontnode.h" + + +Boolean Accounting = FALSE; +FILE *Accting; +int NumPages = 0; +char *User; +char *Host; + +/* This routine is called on exit. It does some housekeeping before + * exiting. + */ +void cleanup(head, exitstatus) +struct FontNode *head; +int exitstatus; +{ + struct FontNode *p; + void sanestate(); + int portfont = 1204; + PROFILE_VALUE *v, *getbindingvalue(); + + for (p = head; p; p = p->next) /* Delete user fonts */ + if (p->qmsnumber > 30000 && (p->flags & LOADED)) + printf("%s%d%c%s", DOWNLOAD, p->qmsnumber, p->flags & PORT ? + 'P' : 'L', ENDCMD); + if ((v = getbindingvalue("portraitfont")) && v->class == PROFILE_INTEGER) + portfont = v->value.i; + sanestate(portfont); + fputs(QUICOFF, stdout); + if (Accounting) { +#ifdef TRW + FILE *f; + char badge[51], costcenter[51], chargenumber[51], sessionid[51]; + char s[51], *strcpy(); + + if (!(f = fopen(ACCTFILE, "r"))) + goto getout; + while (fgets(s, 51, f)) + if (strlen(s) > 0) { + if (s[strlen(s) - 1] == '\n') + s[strlen(s) - 1] = '\0'; + switch (s[0]) { + case 'b': + (void)strcpy(badge, &s[1]); + break; + case 'e': + (void)strcpy(costcenter, &s[1]); + break; + case 'u': + (void)strcpy(chargenumber, &s[1]); + break; + case 's': + (void)strcpy(sessionid, &s[1]); + break; + } + } + fprintf(Accting, "%s %s %s %s %d %s@%s\n", badge, costcenter, + chargenumber, sessionid, NumPages, User, Host); + (void)fclose(f); +#else + fprintf(Accting, "%d %s@%s\n", NumPages, User, Host); +#endif + (void)fclose(Accting); + } +getout: + exit(exitstatus); +} |