Revision 12350,
1.4 KB
checked in by ghudson, 26 years ago
(diff) |
Some RCS ID cleanup: delete $Log$ and replace other RCS keywords with $Id$.
|
Rev | Line | |
---|
[2182] | 1 | /* |
---|
[12350] | 2 | * $Id: errors.c,v 1.5 1999-01-22 23:08:58 ghudson Exp $ |
---|
[2182] | 3 | * |
---|
| 4 | * This program is part of a package including delete, undelete, |
---|
| 5 | * lsdel, expunge and purge. The software suite is meant as a |
---|
| 6 | * replacement for rm which allows for file recovery. |
---|
| 7 | * |
---|
| 8 | * Copyright (c) 1989 by the Massachusetts Institute of Technology. |
---|
[4505] | 9 | * For copying and distribution information, see the file "mit-copying.h." |
---|
[2182] | 10 | */ |
---|
| 11 | |
---|
| 12 | #if (!defined(lint) && !defined(SABER)) |
---|
[12350] | 13 | static char rcsid_errors_c[] = "$Id: errors.c,v 1.5 1999-01-22 23:08:58 ghudson Exp $"; |
---|
[2182] | 14 | #endif |
---|
| 15 | |
---|
| 16 | #include <com_err.h> |
---|
| 17 | #include <stdio.h> |
---|
| 18 | #include "delete_errs.h" |
---|
[4505] | 19 | #include "mit-copying.h" |
---|
[2182] | 20 | |
---|
| 21 | char *whoami; |
---|
| 22 | int error_reported = 1; |
---|
| 23 | int error_occurred = 0; |
---|
| 24 | int report_errors = 1; |
---|
| 25 | int error_code = 0; |
---|
| 26 | |
---|
| 27 | /* |
---|
| 28 | * Proper use of this procedure requires strict adherance to the way |
---|
| 29 | * it is supposed to be used by all procedures in a program. Whenever |
---|
| 30 | * there is an error, set_error must be called with the error value. |
---|
| 31 | * Then, either the procedure that detects the error must call |
---|
| 32 | * error(), or it must pass the error up to its parent for the parent |
---|
| 33 | * to report. |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | void error(str) |
---|
| 38 | char *str; |
---|
| 39 | { |
---|
| 40 | if (report_errors && (! error_reported)) { |
---|
| 41 | if (*str) |
---|
| 42 | fprintf(stderr, "%s: %s: %s\n", whoami, str, |
---|
| 43 | error_message(error_code)); |
---|
| 44 | else |
---|
| 45 | fprintf(stderr, "%s: %s\n", whoami, error_message(error_code)); |
---|
| 46 | } |
---|
| 47 | error_reported = 1; |
---|
| 48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.