1 /* 2 3 * Copyright (c) 1984, 1985, 1986 AT&T 4 * All Rights Reserved 5 6 * THIS IS UNPUBLISHED PROPRIETARY SOURCE 7 * CODE OF AT&T. 8 * The copyright notice above does not 9 * evidence any actual or intended 10 * publication of such source code. 11 12 */ 13 /* @(#)failed.c 1.1 */ 14 15 /* 16 * FAILED.C 17 * 18 * Programmer: D. A. Lambeth 19 * 20 * Owner: D. A. Lambeth 21 * 22 * Date: April 17, 1980 23 * 24 * 25 * 26 * FAILED (S1, S2) 27 * 28 * Program Failure. Print an error diagnostic containing 29 * the strings S1 and S2, and longjmp to an error-handling 30 * routine. 31 * 32 * 33 * 34 * See Also: SETJMP(3C) 35 */ 36 37 /* 38 * FAILED (S1, S2) 39 * 40 * char *S1; 41 * 42 * char *S2; 43 * 44 * Print an error message of the format 45 * 46 * S1 : S2 47 * 48 * at the stderr file. 49 * 50 * Longjmp to the location errshell, which must have been 51 * established previously by a call to setjmp. 52 * 53 * Note that the return value from setjmp will always be 54 * '1'. 55 */ 56 57 #include <stdio.h> 58 #include <setjmp.h> 59 60 extern jmp_buf errshell; 61 extern char colon[], newline[]; 62 63 void failed(s1,s2) 64 char *s1, *s2; 65 { 66 write (2, s1, strlen(s1)); 67 if (s2) 68 { 69 write (2, colon, strlen(colon)); 70 write (2, s2, strlen(s2)); 71 } 72 write (2, newline, strlen(newline)); 73 longjmp(errshell, 1); 74 } 75