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

Revision 24908, 1.2 KB checked in by ghudson, 14 years ago (diff)
In delete: * Patches from Jonathan Kamens: - The "-f" flag to delete should suppress nonexistent file errors but not other errors. - When the "-v" flag is specified to expunge, the correct totals should be reported. Previously, the totals were incorrect. - Code cleanup.
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#include <com_err.h>
13#include <stdio.h>
14#include "delete_errs.h"
15#include "mit-copying.h"
16#include "util.h"
17
18char *whoami;
19int error_reported = 1;
20int error_occurred = 0;
21int report_errors = 1;
22int error_code = 0;
23
24/*
25 * Proper use of this procedure requires strict adherance to the way
26 * it is supposed to be used by all procedures in a program.  Whenever
27 * there is an error, set_error must be called with the error value.
28 * Then, either the procedure that detects the error must call
29 * error(), or it must pass the error up to its parent for the parent
30 * to report.
31 */
32
33
34void error(str)
35char *str;
36{
37     if (report_errors && (! error_reported)) {
38          if (*str)
39               fprintf(stderr, "%s: %s: %s\n", whoami, str,
40                       error_message(error_code));
41          else
42               fprintf(stderr, "%s: %s\n", whoami, error_message(error_code));
43     }
44     error_reported = 1;
45}
Note: See TracBrowser for help on using the repository browser.