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

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