Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/krb5/src/util/ss/error.c
34889 views
1
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/*
3
* Copyright 2007 Massachusetts Institute of Technology.
4
* All Rights Reserved.
5
*
6
* Export of this software from the United States of America may
7
* require a specific license from the United States Government.
8
* It is the responsibility of any person or organization contemplating
9
* export to obtain such a license before exporting.
10
*
11
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
12
* distribute this software and its documentation for any purpose and
13
* without fee is hereby granted, provided that the above copyright
14
* notice appear in all copies and that both that copyright notice and
15
* this permission notice appear in supporting documentation, and that
16
* the name of M.I.T. not be used in advertising or publicity pertaining
17
* to distribution of the software without specific, written prior
18
* permission. Furthermore if you modify this software you must label
19
* your software as modified software and not distribute it in such a
20
* fashion that it might be confused with the original M.I.T. software.
21
* M.I.T. makes no representations about the suitability of
22
* this software for any purpose. It is provided "as is" without express
23
* or implied warranty.
24
*/
25
/*
26
* Copyright 1987, 1988, 1989 by MIT Student Information Processing
27
* Board
28
*
29
* For copyright information, see copyright.h.
30
*/
31
32
#include "ss_internal.h"
33
#include "com_err.h"
34
#include "copyright.h"
35
36
char *
37
ss_name(int sci_idx)
38
{
39
ss_data *infop;
40
41
infop = ss_info(sci_idx);
42
if (infop->current_request == (char const *)NULL) {
43
return strdup(infop->subsystem_name);
44
} else {
45
char *ret_val;
46
if (asprintf(&ret_val, "%s (%s)",
47
infop->subsystem_name, infop->current_request) < 0)
48
return NULL;
49
return ret_val;
50
}
51
}
52
53
void
54
ss_error(int sci_idx, long code, const char *fmt, ...)
55
{
56
char *whoami;
57
va_list pvar;
58
va_start (pvar, fmt);
59
whoami = ss_name (sci_idx);
60
com_err_va (whoami, code, fmt, pvar);
61
free (whoami);
62
va_end(pvar);
63
}
64
65
void
66
ss_perror(int sci_idx, long code, char const *msg) /* for compatibility */
67
{
68
ss_error (sci_idx, code, "%s", msg);
69
}
70
71