|
Packit |
fd8b60 |
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
Packit |
fd8b60 |
/*
|
|
Packit |
fd8b60 |
* Copyright 2007 Massachusetts Institute of Technology.
|
|
Packit |
fd8b60 |
* All Rights Reserved.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* Export of this software from the United States of America may
|
|
Packit |
fd8b60 |
* require a specific license from the United States Government.
|
|
Packit |
fd8b60 |
* It is the responsibility of any person or organization contemplating
|
|
Packit |
fd8b60 |
* export to obtain such a license before exporting.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
|
Packit |
fd8b60 |
* distribute this software and its documentation for any purpose and
|
|
Packit |
fd8b60 |
* without fee is hereby granted, provided that the above copyright
|
|
Packit |
fd8b60 |
* notice appear in all copies and that both that copyright notice and
|
|
Packit |
fd8b60 |
* this permission notice appear in supporting documentation, and that
|
|
Packit |
fd8b60 |
* the name of M.I.T. not be used in advertising or publicity pertaining
|
|
Packit |
fd8b60 |
* to distribution of the software without specific, written prior
|
|
Packit |
fd8b60 |
* permission. Furthermore if you modify this software you must label
|
|
Packit |
fd8b60 |
* your software as modified software and not distribute it in such a
|
|
Packit |
fd8b60 |
* fashion that it might be confused with the original M.I.T. software.
|
|
Packit |
fd8b60 |
* M.I.T. makes no representations about the suitability of
|
|
Packit |
fd8b60 |
* this software for any purpose. It is provided "as is" without express
|
|
Packit |
fd8b60 |
* or implied warranty.
|
|
Packit |
fd8b60 |
*/
|
|
Packit |
fd8b60 |
/*
|
|
Packit |
fd8b60 |
* Copyright 1987, 1988, 1989 by MIT Student Information Processing
|
|
Packit |
fd8b60 |
* Board
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* For copyright information, see copyright.h.
|
|
Packit |
fd8b60 |
*/
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#include "ss_internal.h"
|
|
Packit |
fd8b60 |
#include "com_err.h"
|
|
Packit |
fd8b60 |
#include "copyright.h"
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
char * ss_name(sci_idx)
|
|
Packit |
fd8b60 |
int sci_idx;
|
|
Packit |
fd8b60 |
{
|
|
Packit |
fd8b60 |
ss_data *infop;
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
infop = ss_info(sci_idx);
|
|
Packit |
fd8b60 |
if (infop->current_request == (char const *)NULL) {
|
|
Packit |
fd8b60 |
return strdup(infop->subsystem_name);
|
|
Packit |
fd8b60 |
} else {
|
|
Packit |
fd8b60 |
char *ret_val;
|
|
Packit |
fd8b60 |
if (asprintf(&ret_val, "%s (%s)",
|
|
Packit |
fd8b60 |
infop->subsystem_name, infop->current_request) < 0)
|
|
Packit |
fd8b60 |
return NULL;
|
|
Packit |
fd8b60 |
return ret_val;
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
void ss_error (int sci_idx, long code, const char * fmt, ...)
|
|
Packit |
fd8b60 |
{
|
|
Packit |
fd8b60 |
char *whoami;
|
|
Packit |
fd8b60 |
va_list pvar;
|
|
Packit |
fd8b60 |
va_start (pvar, fmt);
|
|
Packit |
fd8b60 |
whoami = ss_name (sci_idx);
|
|
Packit |
fd8b60 |
com_err_va (whoami, code, fmt, pvar);
|
|
Packit |
fd8b60 |
free (whoami);
|
|
Packit |
fd8b60 |
va_end(pvar);
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
void ss_perror (sci_idx, code, msg) /* for compatibility */
|
|
Packit |
fd8b60 |
int sci_idx;
|
|
Packit |
fd8b60 |
long code;
|
|
Packit |
fd8b60 |
char const *msg;
|
|
Packit |
fd8b60 |
{
|
|
Packit |
fd8b60 |
ss_error (sci_idx, code, "%s", msg);
|
|
Packit |
fd8b60 |
}
|