2001-12-29 12:03:18 +00:00
|
|
|
#ifndef UTIL_H
|
|
|
|
#define UTIL_H
|
|
|
|
|
2002-01-08 13:56:50 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_GETOPT_H
|
|
|
|
#include <getopt.h>
|
|
|
|
#endif
|
2001-12-29 12:03:18 +00:00
|
|
|
#include <stdio.h>
|
2002-01-08 13:56:50 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
2002-10-19 14:04:52 +00:00
|
|
|
#ifdef HAVE_STRINGS_H
|
2002-06-14 12:52:56 +00:00
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
2002-10-19 14:04:52 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
2002-04-05 13:48:00 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <opensc/opensc.h>
|
2001-12-29 12:03:18 +00:00
|
|
|
|
2002-04-19 14:23:31 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2002-01-08 13:56:50 +00:00
|
|
|
extern const struct option options[];
|
|
|
|
extern const char *option_help[];
|
2002-03-24 14:12:38 +00:00
|
|
|
extern const char *app_name;
|
2002-01-08 13:56:50 +00:00
|
|
|
|
2001-12-29 12:03:18 +00:00
|
|
|
void print_binary(FILE *f, const u8 *buf, int count);
|
2002-01-24 16:02:54 +00:00
|
|
|
void hex_dump(FILE *f, const u8 *in, int len, const char *sep);
|
2002-01-09 01:03:10 +00:00
|
|
|
void hex_dump_asc(FILE *f, const u8 *in, size_t count, int addr);
|
2002-04-19 14:23:31 +00:00
|
|
|
void print_usage_and_die(void);
|
2002-02-20 09:56:47 +00:00
|
|
|
const char * acl_to_str(const struct sc_acl_entry *e);
|
2002-02-21 18:53:23 +00:00
|
|
|
void warn(const char *fmt, ...);
|
|
|
|
void error(const char *fmt, ...);
|
|
|
|
void fatal(const char *fmt, ...);
|
2003-01-03 16:57:46 +00:00
|
|
|
/* All singing all dancing card connect routine */
|
|
|
|
int connect_card(struct sc_context *, struct sc_card **,
|
|
|
|
int reader_id, int slot_id, int wait, int quiet);
|
2001-12-29 12:03:18 +00:00
|
|
|
|
2002-04-19 14:23:31 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-12-29 12:03:18 +00:00
|
|
|
#endif
|