[9089] | 1 | #ifndef lint |
---|
| 2 | #define _NOTICE static char |
---|
| 3 | _NOTICE N1[] = "Copyright (c) 1985,1987 Adobe Systems Incorporated"; |
---|
| 4 | _NOTICE N2[] = "GOVERNMENT END USERS: See Notice file in TranScript library directory"; |
---|
| 5 | _NOTICE N3[] = "-- probably /usr/lib/ps/Notice"; |
---|
| 6 | _NOTICE RCSID[]="$Header: /afs/dev.mit.edu/source/repository/third/transcript/src/psbanner.sysv,v 1.1.1.1 1996-10-07 20:25:50 ghudson Exp $"; |
---|
| 7 | #endif |
---|
| 8 | /* psbanner.c |
---|
| 9 | * |
---|
| 10 | * Copyright (C) 1985,1987 Adobe Systems Incorporated. All rights reserved. |
---|
| 11 | * GOVERNMENT END USERS: See Notice file in TranScript library directory |
---|
| 12 | * -- probably /usr/lib/ps/Notice |
---|
| 13 | * |
---|
| 14 | * System V banner/breakpage program |
---|
| 15 | * |
---|
| 16 | * RCSLOG: |
---|
| 17 | * $Log: not supported by cvs2svn $ |
---|
| 18 | Revision 3.1 1992/08/21 16:26:32 snichols |
---|
| 19 | Release 4.0 |
---|
| 20 | |
---|
| 21 | Revision 3.0 1991/06/17 16:50:45 snichols |
---|
| 22 | Release 3.0 |
---|
| 23 | |
---|
| 24 | Revision 2.3 1991/03/26 20:40:11 snichols |
---|
| 25 | include config.h |
---|
| 26 | |
---|
| 27 | Revision 2.2 1987/11/17 16:50:46 byron |
---|
| 28 | *** empty log message *** |
---|
| 29 | |
---|
| 30 | * Revision 2.2 87/11/17 16:50:46 byron |
---|
| 31 | * Release 2.1 |
---|
| 32 | * |
---|
| 33 | * Revision 2.1.1.2 87/11/12 13:40:42 byron |
---|
| 34 | * Changed Government user's notice. |
---|
| 35 | * |
---|
| 36 | * Revision 2.1.1.1 87/04/23 10:25:53 byron |
---|
| 37 | * Copyright notice. |
---|
| 38 | * |
---|
| 39 | * Revision 2.2 86/11/02 14:19:36 shore |
---|
| 40 | * Product Update |
---|
| 41 | * |
---|
| 42 | * Revision 2.1 85/11/24 11:49:54 shore |
---|
| 43 | * Product Release 2.0 |
---|
| 44 | * |
---|
| 45 | * Revision 1.1 85/11/20 00:25:33 shore |
---|
| 46 | * Initial revision |
---|
| 47 | * |
---|
| 48 | * |
---|
| 49 | */ |
---|
| 50 | |
---|
| 51 | #include <stdio.h> |
---|
| 52 | #include <pwd.h> |
---|
| 53 | #include <string.h> |
---|
| 54 | #include <ctype.h> |
---|
| 55 | #include "transcript.h" |
---|
| 56 | #include "config.h" |
---|
| 57 | |
---|
| 58 | struct passwd *getpwnam(); |
---|
| 59 | VOID quote(); |
---|
| 60 | |
---|
| 61 | /* psbanner |
---|
| 62 | * gets called with argv: |
---|
| 63 | * printer seqid user title date |
---|
| 64 | */ |
---|
| 65 | main(argc, argv) |
---|
| 66 | int argc; |
---|
| 67 | char **argv; |
---|
| 68 | { |
---|
| 69 | struct passwd *pswd; |
---|
| 70 | char *program, *bannerpro, *fulluser; |
---|
| 71 | char *printer, *seqid, *user, *title, *date; |
---|
| 72 | char host[100]; |
---|
| 73 | |
---|
| 74 | program = strrchr(*argv,'/'); |
---|
| 75 | if (program) program++; |
---|
| 76 | else program = *argv; |
---|
| 77 | argv++; |
---|
| 78 | |
---|
| 79 | printer = *argv++; |
---|
| 80 | seqid = *argv++; |
---|
| 81 | user = *argv++; |
---|
| 82 | title = *argv++; |
---|
| 83 | date = *argv++; |
---|
| 84 | |
---|
| 85 | if ((pswd = getpwnam(user)) == NULL) fulluser = ""; |
---|
| 86 | else fulluser = pswd->pw_gecos; |
---|
| 87 | gethostname(host,100); |
---|
| 88 | |
---|
| 89 | bannerpro = envget("BANNERPRO"); |
---|
| 90 | copyfile(bannerpro,stdout); |
---|
| 91 | |
---|
| 92 | quote(user); |
---|
| 93 | quote(fulluser); |
---|
| 94 | quote(host); |
---|
| 95 | quote(seqid); |
---|
| 96 | quote(title); |
---|
| 97 | quote(printer); |
---|
| 98 | quote(date); |
---|
| 99 | printf("Banner\n"); |
---|
| 100 | return(0); |
---|
| 101 | |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | /* send PostScript delimited/quoted string to stdout */ |
---|
| 105 | VOID quote(str) |
---|
| 106 | char *str; |
---|
| 107 | { |
---|
| 108 | int c; |
---|
| 109 | putchar('('); |
---|
| 110 | while ((c = ((*str++) & 0377)) != 0) { |
---|
| 111 | if (isascii(c) && (isprint(c) || isspace(c))) { |
---|
| 112 | if ((c == '(') || (c == ')') || (c =='\\')) { |
---|
| 113 | putchar('\\'); |
---|
| 114 | } |
---|
| 115 | putchar(c); |
---|
| 116 | } |
---|
| 117 | else { |
---|
| 118 | putchar('\\'); |
---|
| 119 | putchar(((c>>6)&03)+'0'); |
---|
| 120 | putchar(((c>>3)&07)+'0'); |
---|
| 121 | putchar((c&07)+'0'); |
---|
| 122 | } |
---|
| 123 | } |
---|
| 124 | putchar(')'); |
---|
| 125 | putchar('\n'); |
---|
| 126 | } |
---|