1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-10 21:38:50 +01:00
gnupg/g10/status.c

81 lines
2.2 KiB
C
Raw Normal View History

1998-01-30 17:23:16 +01:00
/* status.c
1998-02-24 19:50:46 +01:00
* Copyright (C) 1998 Free Software Foundation, Inc.
1998-01-30 17:23:16 +01:00
*
1998-02-24 19:50:46 +01:00
* This file is part of GNUPG.
1998-01-30 17:23:16 +01:00
*
1998-02-24 19:50:46 +01:00
* GNUPG is free software; you can redistribute it and/or modify
1998-01-30 17:23:16 +01:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
1998-02-24 19:50:46 +01:00
* GNUPG is distributed in the hope that it will be useful,
1998-01-30 17:23:16 +01:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
1998-02-03 13:09:20 +01:00
#include <string.h>
1998-01-30 17:23:16 +01:00
#include <unistd.h>
#include "status.h"
static int fd = -1;
void
set_status_fd( int newfd )
{
fd = newfd;
}
void
write_status( int no )
1998-03-09 22:44:06 +01:00
{
write_status_text( no, NULL );
}
void
write_status_text( int no, const char *text)
1998-01-30 17:23:16 +01:00
{
const char *s;
if( fd == -1 )
return; /* not enabled */
switch( no ) {
case STATUS_ENTER : s = "ENTER\n"; break;
case STATUS_LEAVE : s = "LEAVE\n"; break;
case STATUS_ABORT : s = "ABORT\n"; break;
case STATUS_GOODSIG: s = "GOODSIG\n"; break;
1998-06-25 12:19:08 +02:00
case STATUS_SIGEXPIRED: s = "SIGEXPIRED\n"; break;
1998-07-09 15:37:17 +02:00
case STATUS_KEYREVOKED: s = "KEYREVOKED\n"; break;
1998-01-30 17:23:16 +01:00
case STATUS_BADSIG : s = "BADSIG\n"; break;
case STATUS_ERRSIG : s = "ERRSIG\n"; break;
1998-02-04 19:54:31 +01:00
case STATUS_BADARMOR : s = "BADARMOR\n"; break;
1998-05-29 13:53:54 +02:00
case STATUS_RSA_OR_IDEA : s= "RSA_OR_IDEA\n"; break;
1998-07-09 15:37:17 +02:00
case STATUS_TRUST_UNDEFINED: s = "TRUST_UNDEFINED\n"; break;
case STATUS_TRUST_NEVER : s = "TRUST_NEVER\n"; break;
case STATUS_TRUST_MARGINAL : s = "TRUST_MARGINAL\n"; break;
case STATUS_TRUST_FULLY : s = "TRUST_FULLY\n"; break;
case STATUS_TRUST_ULTIMATE : s = "TRUST_ULTIMATE\n"; break;
1998-01-30 17:23:16 +01:00
default: s = "?\n"; break;
}
1998-05-29 13:53:54 +02:00
write( fd, "[GNUPG:] ", 9 );
1998-03-09 22:44:06 +01:00
if( text ) {
write( fd, s, strlen(s)-1 );
write( fd, " ", 1 );
write( fd, text, strlen(text) );
write( fd, "\n", 1 );
}
else
write( fd, s, strlen(s) );
1998-01-30 17:23:16 +01:00
}