source: trunk/athena/bin/delete/errors.c @ 12350

Revision 12350, 1.4 KB checked in by ghudson, 25 years ago (diff)
Some RCS ID cleanup: delete $Log$ and replace other RCS keywords with $Id$.
Line 
1/*
2 * $Id: errors.c,v 1.5 1999-01-22 23:08:58 ghudson Exp $
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.
9 * For copying and distribution information, see the file "mit-copying.h."
10 */
11
12#if (!defined(lint) && !defined(SABER))
13     static char rcsid_errors_c[] = "$Id: errors.c,v 1.5 1999-01-22 23:08:58 ghudson Exp $";
14#endif
15
16#include <com_err.h>
17#include <stdio.h>
18#include "delete_errs.h"
19#include "mit-copying.h"
20
21char *whoami;
22int error_reported = 1;
23int error_occurred = 0;
24int report_errors = 1;
25int 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
37void error(str)
38char *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.