type
stringclasses
5 values
content
stringlengths
9
163k
functions
void gtk_tool_item_group_set_collapsed (GtkToolItemGroup *group, gboolean collapsed) { GtkWidget *parent; GtkToolItemGroupPrivate* priv; g_return_if_fail (GTK_IS_TOOL_ITEM_GROUP (group)); priv = group->priv; parent = gtk_widget_get_parent (GTK_WIDGET (group)); ...
functions
void gtk_tool_item_group_set_ellipsize (GtkToolItemGroup *group, PangoEllipsizeMode ellipsize) { g_return_if_fail (GTK_IS_TOOL_ITEM_GROUP (group)); if (ellipsize != group->priv->ellipsize) { group->priv->ellipsize = ellipsize; gtk_tool_item_group_header_adjust_...
functions
gboolean gtk_tool_item_group_get_collapsed (GtkToolItemGroup *group) { g_return_val_if_fail (GTK_IS_TOOL_ITEM_GROUP (group), DEFAULT_COLLAPSED); return group->priv->collapsed; }
functions
PangoEllipsizeMode gtk_tool_item_group_get_ellipsize (GtkToolItemGroup *group) { g_return_val_if_fail (GTK_IS_TOOL_ITEM_GROUP (group), DEFAULT_ELLIPSIZE); return group->priv->ellipsize; }
functions
GtkReliefStyle gtk_tool_item_group_get_header_relief (GtkToolItemGroup *group) { g_return_val_if_fail (GTK_IS_TOOL_ITEM_GROUP (group), GTK_RELIEF_NORMAL); return gtk_button_get_relief (GTK_BUTTON (group->priv->header)); }
functions
void gtk_tool_item_group_insert (GtkToolItemGroup *group, GtkToolItem *item, gint position) { GtkWidget *parent, *child_widget; GtkToolItemGroupChild *child; g_return_if_fail (GTK_IS_TOOL_ITEM_GROUP (group)); g_return_if_fail (GTK_IS_TOO...
functions
void gtk_tool_item_group_set_item_position (GtkToolItemGroup *group, GtkToolItem *item, gint position) { gint old_position; GList *link; GtkToolItemGroupChild *child; GtkToolItemGroupPrivate* priv; g_return_if_fai...
functions
gint gtk_tool_item_group_get_item_position (GtkToolItemGroup *group, GtkToolItem *item) { gint position; g_return_val_if_fail (GTK_IS_TOOL_ITEM_GROUP (group), -1); g_return_val_if_fail (GTK_IS_TOOL_ITEM (item), -1); if (gtk_tool_item_group_get_child (group, item, &p...
functions
guint gtk_tool_item_group_get_n_items (GtkToolItemGroup *group) { g_return_val_if_fail (GTK_IS_TOOL_ITEM_GROUP (group), 0); return g_list_length (group->priv->children); }
functions
void _gtk_tool_item_group_item_size_request (GtkToolItemGroup *group, GtkRequisition *item_size, gboolean homogeneous_only, gint *requested_rows) { GtkRequisition child_requis...
functions
void _gtk_tool_item_group_paint (GtkToolItemGroup *group, cairo_t *cr) { GtkWidget *widget = GTK_WIDGET (group); GtkToolItemGroupPrivate* priv = group->priv; gdk_cairo_set_source_pixmap (cr, widget->window, widget->allocation.x, ...
functions
gint _gtk_tool_item_group_get_size_for_limit (GtkToolItemGroup *group, gint limit, gboolean vertical, gboolean animation) { GtkRequisition requisition; GtkToolIte...
functions
gint _gtk_tool_item_group_get_height_for_width (GtkToolItemGroup *group, gint width) { return _gtk_tool_item_group_get_size_for_limit (group, width, TRUE, group->priv->animation); }
functions
gint _gtk_tool_item_group_get_width_for_height (GtkToolItemGroup *group, gint height) { return _gtk_tool_item_group_get_size_for_limit (group, height, FALSE, TRUE); }
functions
void gtk_tool_palette_reconfigured_foreach_item (GtkWidget *child, gpointer data) { if (GTK_IS_TOOL_ITEM (child)) gtk_tool_item_toolbar_reconfigured (GTK_TOOL_ITEM (child)); }
functions
void _gtk_tool_item_group_palette_reconfigured (GtkToolItemGroup *group) { gtk_container_foreach (GTK_CONTAINER (group), gtk_tool_palette_reconfigured_foreach_item, NULL); gtk_tool_item_group_header_adjust_style (group); }
includes
#include <ctype.h>
includes
#include <stdio.h>
includes
#include <string.h>
includes
#include <stdlib.h>
includes
#include <readline/readline.h>
includes
#include <readline/history.h>
includes
#include <arpa/inet.h>
includes
#include <io.h>
defines
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
structs
struct command { int (*func)(int, char **); const char * name; const char * args; const char * help; };
functions
int parse_string_or_hexdata(const char *in, u8 *out, size_t *outlen) { if (in == NULL) return SC_ERROR_INVALID_ARGUMENTS; if (*in == '"') { u8 quote = *in++; size_t count = 0; while (*in != quote && *in != '\0' && count < *outlen) out[count++] = *in++; if (*in == '\0') return SC_ERROR_INVALID_ARGUME...
functions
void die(int ret) { sc_file_free(current_file); if (card) { sc_disconnect_card(card); }
functions
void select_current_path_or_die(void) { if (current_path.type || current_path.len) { int r = sc_lock(card); if (r == SC_SUCCESS) r = sc_select_file(card, &current_path, NULL); sc_unlock(card); if (r) { fprintf(stderr, "unable to select parent DF: %s\n", sc_strerror(r)); die(1); }
functions
void check_ret(int r, int op, const char *err, const sc_file_t *file) { fprintf(stderr, "%s: %s\n", err, sc_strerror(r)); if (r == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED) fprintf(stderr, "ACL for operation: %s\n", util_acl_to_str(sc_file_get_acl_entry(file, op))); }
functions
int arg_to_fid(const char *arg, u8 *fid) { unsigned int fid0, fid1; if (strlen(arg) != 4) { fprintf(stderr, "Wrong ID length.\n"); return -1; }
functions
int arg_to_path(const char *arg, sc_path_t *path, int is_id) { memset(path, 0, sizeof(sc_path_t)); if (strncasecmp(arg, "aid:", strlen("aid:")) == 0) { /* DF aid */ const char *p = arg + strlen("aid:"); int r; path->type = SC_PATH_TYPE_DF_NAME; path->len = sizeof(path->value); if ((r = sc_hex_to_bin(p,...
functions
void print_file(const sc_file_t *file) { const char *format = " %02X%02X "; const char *st = NULL; if(!file->type_attr_len) st = "???"; switch (file->type) { case SC_FILE_TYPE_WORKING_EF: st = "wEF"; break; case SC_FILE_TYPE_INTERNAL_EF: st = "iEF"; break; case SC_FILE_TYPE_DF: format = "[%02X%02X]...
functions
int do_echo(int argc, char **argv) { int i; for (i = 0; i < argc; i++) { printf("%s%s", argv[i], (i < argc) ? " " : ""); }
functions
int pattern_match(const char *pattern, const char *string) { if (pattern == NULL || string == NULL) return 0; while (*pattern != '\0' && *string != '\0') { /* wildcard matching multiple characters */ if (*pattern == '*') { for (pattern++; *string != '\0' ; string++) if (pattern_match(pattern, string)) ...
functions
else if (*pattern == '[') { char *end = strchr(pattern, ']'); int match = 0; for (pattern++; end != NULL && pattern != end; pattern++) { if (tolower(*pattern) == tolower(*string)) match++; }
functions
int do_ls(int argc, char **argv) { u8 buf[256], *cur = buf; int r, count; r = sc_lock(card); if (r == SC_SUCCESS) r = sc_list_files(card, buf, sizeof(buf)); sc_unlock(card); if (r < 0) { check_ret(r, SC_AC_OP_LIST_FILES, "unable to receive file listing", current_file); return -1; }
functions
int do_find(int argc, char **argv) { u8 fid[2], end[2]; sc_path_t path; int r; fid[0] = 0; fid[1] = 0; end[0] = 0xFF; end[1] = 0xFF; switch (argc) { case 2: if (arg_to_fid(argv[1], end) != 0) return usage(do_find); /* fall through */ case 1: if (arg_to_fid(argv[0], fid) != 0) return usage(do_find...
functions
int do_find_tags(int argc, char **argv) { u8 start[2], end[2], rbuf[256]; int r; unsigned int tag, tag_end; start[0] = 0x00; start[1] = 0x00; end[0] = 0xFF; end[1] = 0xFF; switch (argc) { case 2: if (arg_to_fid(argv[1], end) != 0) return usage(do_find_tags); /* fall through */ case 1: if (arg_to_fid...
functions
int do_cd(int argc, char **argv) { sc_path_t path; sc_file_t *file; int r; if (argc != 1) return usage(do_cd); if (strcmp(argv[0], "..") == 0) { path = current_path; if (path.len < 4) { fprintf(stderr, "unable to go up, already in MF.\n"); return -1; }
functions
int read_and_util_print_binary_file(sc_file_t *file) { unsigned char *buf = NULL; int r, ret = -1; size_t size; if (file->size) { size = file->size; }
functions
int read_and_print_record_file(sc_file_t *file, unsigned char sfi) { u8 buf[256]; int rec, r; for (rec = 1; ; rec++) { r = sc_lock(card); if (r == SC_SUCCESS) r = sc_read_record(card, rec, buf, sizeof(buf), SC_RECORD_BY_REC_NR | sfi); sc_unlock(card); if (r == SC_ERROR_RECORD_NOT_FOUND) return 0;...
functions
int do_cat(int argc, char **argv) { int r, err = 1; sc_path_t path; sc_file_t *file = NULL; int not_current = 1; int sfi = 0; if (argc > 1) return usage(do_cat); if (!argc) { path = current_path; file = current_file; not_current = 0; }
functions
int do_info(int argc, char **argv) { sc_file_t *file; sc_path_t path; size_t i; const char *st = NULL; int r, not_current = 1; const id2str_t *ac_ops = NULL; if (!argc) { path = current_path; file = current_file; not_current = 0; }
functions
else if (argc == 1) { if (arg_to_path(argv[0], &path, 0) != 0) return usage(do_info); r = sc_lock(card); if (r == SC_SUCCESS) r = sc_select_file(card, &path, &file); sc_unlock(card); if (r) { fprintf(stderr, "unable to select file: %s\n", sc_strerror(r)); return -1; }
functions
int create_file(sc_file_t *file) { int r; r = sc_lock(card); if (r == SC_SUCCESS) r = sc_create_file(card, file); sc_unlock(card); if (r) { check_ret(r, SC_AC_OP_CREATE, "CREATE FILE failed", current_file); return -1; }
functions
int do_create(int argc, char **argv) { sc_path_t path; sc_file_t *file; unsigned int size; int r, op; if (argc < 2) return usage(do_create); if (arg_to_path(argv[0], &path, 1) != 0) return usage(do_create); /* %z isn't supported everywhere */ if (sscanf(argv[1], "%u", &size) != 1) return usage(do_create)...
functions
int do_mkdir(int argc, char **argv) { sc_path_t path; sc_file_t *file; unsigned int size; int r, op; if (argc != 2) return usage(do_mkdir); if (arg_to_path(argv[0], &path, 1) != 0) return usage(do_mkdir); if (sscanf(argv[1], "%u", &size) != 1) return usage(do_mkdir); file = sc_file_new(); file->id = (pa...
functions
int do_delete(int argc, char **argv) { sc_path_t path; int r; if (argc != 1) return usage(do_delete); if (arg_to_path(argv[0], &path, 1) != 0) return usage(do_delete); if (path.len != 2) return usage(do_delete); path.type = SC_PATH_TYPE_FILE_ID; r = sc_lock(card); if (r == SC_SUCCESS) r = sc_delete_fil...
functions
int do_pininfo(int argc, char **argv) { const id2str_t typeNames[] = { { SC_AC_CHV, "CHV" }
functions
int do_verify(int argc, char **argv) { const id2str_t typeNames[] = { { SC_AC_CHV, "CHV" }
functions
int do_change(int argc, char **argv) { int ref, r, tries_left = -1; u8 oldpin[64]; u8 newpin[64]; size_t oldpinlen = 0; size_t newpinlen = 0; struct sc_pin_cmd_data data; memset(&data, 0, sizeof(data)); data.cmd = SC_PIN_CMD_CHANGE; if (argc < 1 || argc > 3) return usage(do_change); if (strncasecmp(argv[0...
functions
int do_unblock(int argc, char **argv) { int ref, r; u8 puk[64]; u8 newpin[64]; size_t puklen = 0; size_t newpinlen = 0; struct sc_pin_cmd_data data; memset(&data, 0, sizeof(data)); data.cmd = SC_PIN_CMD_UNBLOCK; if (argc < 1 || argc > 3) return usage(do_unblock); if (strncasecmp(argv[0], "CHV", 3)) { fp...
functions
int do_get(int argc, char **argv) { u8 buf[256]; int r, err = 1; size_t count = 0; unsigned int idx = 0; sc_path_t path; sc_file_t *file = NULL; char *filename; FILE *outf = NULL; if (argc < 1 || argc > 2) return usage(do_get); if (arg_to_path(argv[0], &path, 0) != 0) return usage(do_get); filename = (...
functions
int do_update_binary(int argc, char **argv) { u8 buf[240]; size_t buflen = sizeof(buf); int r, err = 1; int offs; sc_path_t path; sc_file_t *file; if (argc != 3) return usage(do_update_binary); if (arg_to_path(argv[0], &path, 0) != 0) return usage(do_update_binary); offs = strtol(argv[1],NULL,10); print...
functions
int do_update_record(int argc, char **argv) { u8 buf[240]; size_t buflen; int r, i, err = 1; int rec, offs; sc_path_t path; sc_file_t *file; if (argc != 4) return usage(do_update_record); if (arg_to_path(argv[0], &path, 0) != 0) return usage(do_update_record); rec = strtol(argv[1],NULL,10); offs = strto...
functions
else if (rec < 1 || rec > file->record_count) { fprintf(stderr, "Invalid record number %i\n", rec); goto err; }
functions
int do_put(int argc, char **argv) { u8 buf[256]; int r, err = 1; size_t count = 0; unsigned int idx = 0; sc_path_t path; sc_file_t *file = NULL; const char *filename; FILE *inf = NULL; if (argc < 1 || argc > 2) return usage(do_put); if (arg_to_path(argv[0], &path, 0) != 0) return usage(do_put); filenam...
functions
int do_debug(int argc, char **argv) { int i; if (!argc) printf("Current debug level is %d\n", ctx->debug); else { if (sscanf(argv[0], "%d", &i) != 1) return -1; printf("Debug level set to %d\n", i); ctx->debug = i; if (i > 1) { sc_ctx_log_to_file(ctx, "stderr"); }
functions
int do_erase(int argc, char **argv) { int r; if (argc != 0) return usage(do_erase); r = sc_lock(card); if (r == SC_SUCCESS) r = sc_card_ctl(card, SC_CARDCTL_ERASE_CARD, NULL); sc_unlock(card); if (r) { fprintf(stderr, "Failed to erase card: %s\n", sc_strerror (r)); return -1; }
functions
int do_random(int argc, char **argv) { unsigned char buffer[SC_MAX_EXT_APDU_BUFFER_SIZE]; int r, count; const char *filename = NULL; FILE *outf = NULL; if (argc < 1 || argc > 2) return usage(do_random); count = atoi(argv[0]); if (count < 0 || (size_t) count > sizeof buffer) { fprintf(stderr, "Number must b...
functions
int do_get_data(int argc, char **argv) { unsigned char buffer[256]; unsigned int tag; FILE *fp; int r; if (argc != 1 && argc != 2) return usage(do_get_data); tag = strtoul(argv[0], NULL, 16); r = sc_lock(card); if (r == SC_SUCCESS) r = sc_get_data(card, tag, buffer, sizeof(buffer)); sc_unlock(card); if ...
functions
int do_put_data(int argc, char **argv) { unsigned int tag; u8 buf[SC_MAX_EXT_APDU_BUFFER_SIZE]; size_t buflen = sizeof(buf); int r; if (argc != 2) return usage(do_put_data); /* Extract DO's tag */ tag = strtoul(argv[0], NULL, 16); /* Extract the new content */ /* buflen is the max length of reception buff...
functions
int do_apdu(int argc, char **argv) { sc_apdu_t apdu; u8 buf[SC_MAX_EXT_APDU_BUFFER_SIZE]; u8 rbuf[SC_MAX_EXT_APDU_BUFFER_SIZE]; size_t len, i; int r; if (argc < 1) return usage(do_apdu); /* loop over the args and parse them, making sure the result fits into buf[] */ for (i = 1, len = 0; i < (unsigned) argc ...
functions
int do_asn1(int argc, char **argv) { int r, err = 1; sc_path_t path; sc_file_t *file = NULL; int not_current = 1; size_t len; unsigned char *buf = NULL; if (argc > 1) return usage(do_asn1); /* select file */ if (argc) { if (arg_to_path(argv[0], &path, 0) != 0) { fprintf(stderr, "Invalid file path\n");...
functions
int do_sm(int argc, char **argv) { int r = SC_ERROR_NOT_SUPPORTED, ret = -1; if (argc != 1) return usage(do_sm); #ifdef ENABLE_SM if (!strcmp(argv[0],"open")) { if (!card->sm_ctx.ops.open) { fprintf(stderr, "Not supported\n"); return -1; }
functions
endif if (r == SC_SUCCESS) { ret = 0; printf("Success!\n"); }
functions
int do_help(int argc, char **argv) { struct command *cmd; printf("%s commands:\n", (argc) ? "Matching" : "Supported"); for (cmd = cmds; cmd->name; cmd++) { int i; int match = 0; for (i = 0; i < argc; i++) { if (strncmp(cmd->name, argv[i], strlen(argv[i])) == 0) match++; }
functions
int do_quit(int argc, char **argv) { die(0); return 0; }
functions
int parse_cmdline(char *in, char **argv, int argvsize) { int argc; for (argc = 0; argc < argvsize-1; argc++) { in += strspn(in, " \t\n"); if (*in == '\0') { /* end of input reached */ argv[argc] = NULL; return argc; }
main
int main(int argc, char *argv[]) { int r, c, long_optind = 0, err = 0; sc_context_param_t ctx_param; int lcycle = SC_CARDCTRL_LIFECYCLE_ADMIN; FILE *script = stdin; printf("OpenSC Explorer version %s\n", sc_get_version()); while (1) { c = getopt_long(argc, argv, "r:c:vwm:", options, &long_optind); if (c == ...
includes
#include <stdio.h>
includes
#include <string.h>
includes
#include <ctype.h>
includes
#include <time.h>
includes
#include <math.h>
defines
#define CLASSES 40000 /* default */
defines
#define TAG351 351 /* DecsMfn tag - MH by serverw::\bases\mdl.006\aot\get*\ */
defines
#define TAG020 20 /* DecsCateg tag - standard A00.000.000.000...000 - currently up to 39 chrs */
defines
#define MAXCATLEN LE2 /* 60 */
defines
#define MAXCATLEN 47 /* 111.222.333.444.555.666.777.888.999.000.111.222 */
defines
#define DECSTAGNAME(x) ( \
defines
#define TAG022 22 /* DecsCDallCategs tag */
defines
#define TAG005 5 /* DecsCDCateg1MFN tag */
defines
#define MYDECSTAG022 22
defines
#define MAXTABV05 42099
defines
#define MAXARGS 512
defines
#define ENVASIZE 32000
defines
#define ANSITABS 1
defines
#define FORCECGI 0
defines
#define MDLPROC 1
defines
#define G01TAG999 999
defines
#define G01TAG001 1
defines
#define MAXN20 30
defines
#define MAXZ20 12 /* hoje=10 (1*3+9*4=39) */
defines
#define MAXL20 (MAXZ20*4)
defines
#define MAXNVG 30
defines
#define MAXN05 30
defines
#define MFQTAENV 102
defines
#define FMTASIZE 32000