[BACK]Return to tcfserrors.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tcfs

Annotation of src/usr.bin/tcfs/tcfserrors.c, Revision 1.1.1.1

1.1       provos      1: /*
                      2:  *     Transparent Cryptographic File System (TCFS) for NetBSD
                      3:  *     Author and mantainer:   Luigi Catuogno [luicat@tcfs.unisa.it]
                      4:  *
                      5:  *     references:             http://tcfs.dia.unisa.it
                      6:  *                             tcfs-bsd@tcfs.unisa.it
                      7:  */
                      8:
                      9: /*
                     10:  *     Base utility set v0.1
                     11:  *
                     12:  *       $Source: /usr/src/tcfs-utils_0.1/lib/RCS/tcfserrors.c,v $
                     13:  *        $State: Exp $
                     14:  *     $Revision: 1.1 $
                     15:  *       $Author: luicat $
                     16:  *         $Date: 2000/01/14 13:44:51 $
                     17:  *
                     18:  */
                     19:
                     20: static const char *RCSid="$id: $";
                     21:
                     22: /* RCS_HEADER_ENDS_HERE */
                     23:
                     24:
                     25:
                     26: #include <stdio.h>
                     27: #include <unistd.h>
                     28: #include "tcfserrors.h"
                     29:
                     30: void tcfs_error (int error_type, char *custom_message)
                     31: {
                     32:        if (error_type!=ER_CUSTOM && error_type!=OK)
                     33:                fprintf (stderr, "Error: ");
                     34:
                     35:        switch (error_type)
                     36:        {
                     37:                case ER_AUTH:
                     38:                case ER_MEM:
                     39:                case ER_TCFS:
                     40:                case ER_PERM:
                     41:                case ER_ENABLE:
                     42:                case ER_DISABLE:
                     43:                case ER_COUNT:
                     44:                case ER_USER:
                     45:                case OK:
                     46:                        fprintf (stderr, "%s\n", tcfs_errors_strings[error_type]);
                     47:                        exit (error_type);
                     48:                case ER_CUSTOM:
                     49:                        fprintf (stderr, "%s\n", custom_message);
                     50:                        exit (1);
                     51:                case ER_UNKOPT:
                     52:                        if (custom_message)
                     53:                                fprintf (stderr, "%s: %s\n", tcfs_errors_strings[error_type], custom_message);
                     54:                        else
                     55:                                fprintf (stderr, "%s\n", tcfs_errors_strings[error_type]);
                     56:
                     57:                        exit (error_type);
                     58:                        break; /* Useless code */
                     59:                default:
                     60:                        fprintf (stderr, "internal error.\n");
                     61:                        exit (1);
                     62:        }
                     63: }
                     64:
                     65: void show_usage (char *fmt, char *arg)
                     66: {
                     67:        printf (fmt, arg);
                     68: }