Skip to content
Snippets Groups Projects
Forked from Nettle / nettle
3768 commits behind the upstream repository.
  • Niels Möller's avatar
    e563d808
    * tools/input.c, tools/input.h, tools/output.c, tools/output.h, · e563d808
    Niels Möller authored
    tools/parse.c, tools/parse.h, tools/misc.c, tools/misc.h: Moved
    parts ov sexp-conv.c to separate files
    
    Rev: src/nettle/tools/Makefile.am:1.3
    Rev: src/nettle/tools/input.c:1.1
    Rev: src/nettle/tools/input.h:1.1
    Rev: src/nettle/tools/misc.c:1.1
    Rev: src/nettle/tools/misc.h:1.1
    Rev: src/nettle/tools/output.c:1.1
    Rev: src/nettle/tools/output.h:1.1
    Rev: src/nettle/tools/parse.c:1.1
    Rev: src/nettle/tools/parse.h:1.1
    Rev: src/nettle/tools/sexp-conv.c:1.13
    e563d808
    History
    * tools/input.c, tools/input.h, tools/output.c, tools/output.h,
    Niels Möller authored
    tools/parse.c, tools/parse.h, tools/misc.c, tools/misc.h: Moved
    parts ov sexp-conv.c to separate files
    
    Rev: src/nettle/tools/Makefile.am:1.3
    Rev: src/nettle/tools/input.c:1.1
    Rev: src/nettle/tools/input.h:1.1
    Rev: src/nettle/tools/misc.c:1.1
    Rev: src/nettle/tools/misc.h:1.1
    Rev: src/nettle/tools/output.c:1.1
    Rev: src/nettle/tools/output.h:1.1
    Rev: src/nettle/tools/parse.c:1.1
    Rev: src/nettle/tools/parse.h:1.1
    Rev: src/nettle/tools/sexp-conv.c:1.13
misc.c 1.82 KiB
/* misc.c */

/* nettle, low-level cryptographics library
 *
 * Copyright (C) 2002, 2003 Niels Möller
 *  
 * The nettle library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version.
 * 
 * The nettle library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with the nettle library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 * MA 02111-1307, USA.
 */

#include "misc.h"

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

void
die(const char *format, ...)
{
  va_list args;
  va_start(args, format);
  vfprintf(stderr, format, args);
  va_end(args);

  exit(EXIT_FAILURE);
}

void
werror(const char *format, ...)
{
  va_list args;
  va_start(args, format);
  vfprintf(stderr, format, args);
  va_end(args);

  exit(EXIT_FAILURE);
}

const char
sexp_token_chars[0x80] =
  {
    /* 0, ... 0x1f */
    0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/* SPC ! " # $ % & ' ( ) * + , - . / */
    0,0,0,0,0,0,0,0, 0,0,1,1,0,1,1,1,
 /* 0 1 2 3 4 5 6 7  8 9 : ; < = > ? */
    1,1,1,1,1,1,1,1, 1,1,1,0,0,1,0,0,
    /* @ A ... O */
    0,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,	
    /* P ...             Z [ \ ] ^ _ */
    1,1,1,1,1,1,1,1, 1,1,1,0,0,0,0,1,
    /* ` a, ... o */
    0,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,	
    /* p ...             z { | } ~ DEL */
    1,1,1,1,1,1,1,1, 1,1,1,0,0,0,0,0,
  };