本文整理汇总了C++中dgettext函数的典型用法代码示例。如果您正苦于以下问题:C++ dgettext函数的具体用法?C++ dgettext怎么用?C++ dgettext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dgettext函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_pkcs11_key_value
static int
get_pkcs11_key_value(libzfs_handle_t *hdl, zfs_cmd_t *zc,
zfs_crypto_zckey_t cmd, pkcs11_uri_t *p11uri,
char **keydata, size_t *keydatalen)
{
KMF_KEYSTORE_TYPE kstype = KMF_KEYSTORE_PK11TOKEN;
KMF_KEY_CLASS keyclass = KMF_SYMMETRIC;
KMF_ENCODE_FORMAT format = KMF_FORMAT_RAWKEY;
KMF_ATTRIBUTE attr[10];
KMF_KEY_HANDLE keys;
KMF_CREDENTIAL cred;
KMF_RAW_SYM_KEY rkey;
KMF_HANDLE_T kmfh;
KMF_RETURN err;
boolean_t true_val = B_TRUE;
CK_SLOT_ID slot;
CK_TOKEN_INFO info;
size_t n = 0;
uint32_t numkeys = 0; /* Ask for all of the named keys */
char *token = NULL;
if (kmf_initialize(&kmfh, NULL, NULL) != KMF_OK) {
errno = EINVAL;
return (-1);
}
kmf_set_attr_at_index(attr, n++, KMF_KEYSTORE_TYPE_ATTR, &kstype,
sizeof (kstype));
if (p11uri->token) {
token = strdup((const char *)p11uri->token);
} else {
/* If the token wasn't set we assume the metaslot */
token = strdup(METASLOT_TOKEN_LABEL);
}
kmf_set_attr_at_index(attr, n++, KMF_TOKEN_LABEL_ATTR,
token, strlen(token));
kmf_set_attr_at_index(attr, n++, KMF_READONLY_ATTR,
&true_val, sizeof (true_val));
kmf_set_attr_at_index(attr, n++, KMF_TOKEN_BOOL_ATTR,
&true_val, sizeof (true_val));
err = kmf_configure_keystore(kmfh, n, attr);
if (err != KMF_OK)
goto out;
if ((err = kmf_pk11_token_lookup(kmfh, token, &slot)) != KMF_OK ||
(err = C_GetTokenInfo(slot, &info)) != CKR_OK)
goto out;
/* Always prompt for PIN since the key is likey CKA_SENSITIVE */
if (prompt_pkcs11_pin(hdl, zc, cmd, p11uri, &cred.cred,
&cred.credlen) != 0)
goto out;
kmf_set_attr_at_index(attr, n++, KMF_CREDENTIAL_ATTR,
&cred, sizeof (KMF_CREDENTIAL));
kmf_set_attr_at_index(attr, n++, KMF_KEYLABEL_ATTR,
p11uri->object, strlen((const char *)p11uri->object));
kmf_set_attr_at_index(attr, n++, KMF_KEYCLASS_ATTR, &keyclass,
sizeof (keyclass));
kmf_set_attr_at_index(attr, n++, KMF_ENCODE_FORMAT_ATTR, &format,
sizeof (format));
kmf_set_attr_at_index(attr, n++, KMF_COUNT_ATTR,
&numkeys, sizeof (numkeys));
err = kmf_find_key(kmfh, n, attr);
if (err != KMF_OK || numkeys != 1)
goto out;
kmf_set_attr_at_index(attr, n++, KMF_KEY_HANDLE_ATTR, &keys,
sizeof (KMF_KEY_HANDLE));
err = kmf_find_key(kmfh, n, attr);
err = kmf_get_sym_key_value(kmfh, &keys, &rkey);
if (err != KMF_OK)
goto out;
if (rkey.keydata.len == *keydatalen) {
*keydata = zfs_alloc(hdl, rkey.keydata.len);
bcopy(rkey.keydata.val, *keydata, rkey.keydata.len);
}
*keydatalen = rkey.keydata.len;
kmf_free_bigint(&rkey.keydata);
out:
if (token != NULL)
free(token);
(void) kmf_finalize(kmfh);
if (numkeys == 1 && err == KMF_OK) {
return (0);
} else if (err == KMF_ERR_AUTH_FAILED) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"PKCS#11 token login failed."));
} else if (numkeys == 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"PKCS#11 token object not found."));
} else if (numkeys > 1) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"keysource points to multiple PKCS#11"
" objects"));
}
//.........这里部分代码省略.........
开发者ID:corbosman,项目名称:zfs-crypto,代码行数:101,代码来源:libzfs_crypto.c
示例2: get_key_material
/*
* Attempts to fetch key material, no matter where it might live. The key
* material is allocated and returned in km_out. *can_retry_out will be set
* to B_TRUE if the user is providing the key material interactively, allowing
* for re-entry attempts.
*/
static int
get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,
zfs_keyformat_t keyformat, char *keylocation, const char *fsname,
uint8_t **km_out, size_t *kmlen_out, boolean_t *can_retry_out)
{
int ret, i;
zfs_keylocation_t keyloc = ZFS_KEYLOCATION_NONE;
FILE *fd = NULL;
uint8_t *km = NULL, *km2 = NULL;
size_t kmlen, kmlen2;
boolean_t can_retry = B_FALSE;
/* verify and parse the keylocation */
keyloc = zfs_prop_parse_keylocation(keylocation);
/* open the appropriate file descriptor */
switch (keyloc) {
case ZFS_KEYLOCATION_PROMPT:
fd = stdin;
if (isatty(fileno(fd))) {
can_retry = B_TRUE;
/* raw keys cannot be entered on the terminal */
if (keyformat == ZFS_KEYFORMAT_RAW) {
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Cannot enter raw keys on the terminal"));
goto error;
}
}
break;
case ZFS_KEYLOCATION_URI:
fd = fopen(&keylocation[7], "r");
if (!fd) {
ret = errno;
errno = 0;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Failed to open key material file"));
goto error;
}
break;
default:
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Invalid keylocation."));
goto error;
}
/* fetch the key material into the buffer */
ret = get_key_material_raw(fd, fsname, keyformat, B_FALSE, newkey,
&km, &kmlen);
if (ret != 0)
goto error;
/* do basic validation of the key material */
switch (keyformat) {
case ZFS_KEYFORMAT_RAW:
/* verify the key length is correct */
if (kmlen < WRAPPING_KEY_LEN) {
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Raw key too short (expected %u)."),
WRAPPING_KEY_LEN);
goto error;
}
if (kmlen > WRAPPING_KEY_LEN) {
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Raw key too long (expected %u)."),
WRAPPING_KEY_LEN);
goto error;
}
break;
case ZFS_KEYFORMAT_HEX:
/* verify the key length is correct */
if (kmlen < WRAPPING_KEY_LEN * 2) {
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Hex key too short (expected %u)."),
WRAPPING_KEY_LEN * 2);
goto error;
}
if (kmlen > WRAPPING_KEY_LEN * 2) {
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Hex key too long (expected %u)."),
WRAPPING_KEY_LEN * 2);
goto error;
}
/* check for invalid hex digits */
for (i = 0; i < WRAPPING_KEY_LEN * 2; i++) {
//.........这里部分代码省略.........
开发者ID:cbreak-black,项目名称:zfs,代码行数:101,代码来源:libzfs_crypto.c
示例3: zfs_crypto_create
int
zfs_crypto_create(libzfs_handle_t *hdl, char *parent_name, nvlist_t *props,
nvlist_t *pool_props, uint8_t **wkeydata_out, uint_t *wkeylen_out)
{
int ret;
char errbuf[1024];
uint64_t crypt = ZIO_CRYPT_INHERIT, pcrypt = ZIO_CRYPT_INHERIT;
uint64_t keyformat = ZFS_KEYFORMAT_NONE;
char *keylocation = NULL;
zfs_handle_t *pzhp = NULL;
uint8_t *wkeydata = NULL;
uint_t wkeylen = 0;
boolean_t local_crypt = B_TRUE;
(void) snprintf(errbuf, sizeof (errbuf),
dgettext(TEXT_DOMAIN, "Encryption create error"));
/* lookup crypt from props */
ret = nvlist_lookup_uint64(props,
zfs_prop_to_name(ZFS_PROP_ENCRYPTION), &crypt);
if (ret != 0)
local_crypt = B_FALSE;
/* lookup key location and format from props */
(void) nvlist_lookup_uint64(props,
zfs_prop_to_name(ZFS_PROP_KEYFORMAT), &keyformat);
(void) nvlist_lookup_string(props,
zfs_prop_to_name(ZFS_PROP_KEYLOCATION), &keylocation);
if (parent_name != NULL) {
/* get a reference to parent dataset */
pzhp = make_dataset_handle(hdl, parent_name);
if (pzhp == NULL) {
ret = ENOENT;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Failed to lookup parent."));
goto out;
}
/* Lookup parent's crypt */
pcrypt = zfs_prop_get_int(pzhp, ZFS_PROP_ENCRYPTION);
/* Params require the encryption feature */
if (!encryption_feature_is_enabled(pzhp->zpool_hdl)) {
if (proplist_has_encryption_props(props)) {
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Encryption feature not enabled."));
goto out;
}
ret = 0;
goto out;
}
} else {
/*
* special case for root dataset where encryption feature
* feature won't be on disk yet
*/
if (!nvlist_exists(pool_props, "[email protected]")) {
if (proplist_has_encryption_props(props)) {
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Encryption feature not enabled."));
goto out;
}
ret = 0;
goto out;
}
pcrypt = ZIO_CRYPT_OFF;
}
/* Check for encryption being explicitly truned off */
if (crypt == ZIO_CRYPT_OFF && pcrypt != ZIO_CRYPT_OFF) {
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Invalid encryption value. Dataset must be encrypted."));
goto out;
}
/* Get the inherited encryption property if we don't have it locally */
if (!local_crypt)
crypt = pcrypt;
/*
* At this point crypt should be the actual encryption value. If
* encryption is off just verify that no encryption properties have
* been specified and return.
*/
if (crypt == ZIO_CRYPT_OFF) {
if (proplist_has_encryption_props(props)) {
ret = EINVAL;
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Encryption must be turned on to set encryption "
"properties."));
goto out;
}
//.........这里部分代码省略.........
开发者ID:cbreak-black,项目名称:zfs,代码行数:101,代码来源:libzfs_crypto.c
示例4: hn_others_menu_get_items
static void
hn_others_menu_get_items (GtkMenu *menu,
HNOthersButton *button,
GtkTreeModel *model,
GtkTreeIter *iter)
{
GtkMenu *submenu = NULL;
GtkWidget *menu_item = NULL;
gchar *item_name = NULL;
gchar *item_comment = NULL;
GdkPixbuf *item_icon = NULL;
GdkPixbuf *item_thumb_icon = NULL;
gchar *item_exec = NULL;
gchar *item_service = NULL;
gchar *item_desktop_id = NULL;
gchar *item_text_domain = NULL;
GtkTreeIter child_iter;
gint children;
gboolean my_iterator = FALSE;
g_return_if_fail (menu);
if (!model)
{
GtkTreeIter iter0;
model = get_menu_contents();
iter = g_malloc0 (sizeof (GtkTreeIter));
my_iterator = TRUE;
/* Get the top level iterator. */
if (!gtk_tree_model_get_iter_first(model, &iter0) ||
!gtk_tree_model_iter_children(model, iter, &iter0))
{
g_object_unref (G_OBJECT (model));
return;
}
}
else
{
g_object_ref (G_OBJECT (model));
}
/* Loop! */
do {
item_name = NULL;
item_icon = NULL;
item_thumb_icon = NULL;
item_exec = NULL;
item_service = NULL;
item_desktop_id = NULL;
item_text_domain = NULL;
gtk_tree_model_get (model, iter,
TREE_MODEL_NAME, &item_name,
TREE_MODEL_ICON, &item_icon,
TREE_MODEL_THUMB_ICON, &item_thumb_icon,
TREE_MODEL_EXEC, &item_exec,
TREE_MODEL_SERVICE, &item_service,
TREE_MODEL_DESKTOP_ID, &item_desktop_id,
TREE_MODEL_COMMENT, &item_comment,
TREE_MODEL_TEXT_DOMAIN, &item_text_domain,
-1);
children = 0;
/* If the item has children. */
if (gtk_tree_model_iter_children (model, &child_iter, iter))
{
gchar *child_string = NULL;
/* It's a submenu */
submenu = GTK_MENU (gtk_menu_new ());
gtk_widget_set_name (GTK_WIDGET (submenu),
NAVIGATOR_MENU_NAME);
/* Create a menu item and add it to the menu. */
children = gtk_tree_model_iter_n_children (model, iter);
child_string = g_strdup_printf(MENU_ITEM_N_ITEMS (children), children);
menu_item = hildon_thumb_menu_item_new_with_labels (
(item_text_domain && *item_text_domain) ?
dgettext(item_text_domain, item_name):
_(item_name),
NULL,
child_string);
g_free(child_string);
gtk_menu_shell_append (GTK_MENU_SHELL (menu),
GTK_WIDGET (menu_item));
/* Add the submenu icon */
if (item_icon && item_thumb_icon)
{
hildon_thumb_menu_item_set_images (
HILDON_THUMB_MENU_ITEM (menu_item),
//.........这里部分代码省略.........
开发者ID:bruce721,项目名称:next.vifii.com,代码行数:101,代码来源:hn-others-button.c
示例5: zfs_crypto_unload_key
int
zfs_crypto_unload_key(zfs_handle_t *zhp)
{
int ret;
char errbuf[1024];
char prop_encroot[MAXNAMELEN];
uint64_t keystatus, keyformat;
boolean_t is_encroot;
(void) snprintf(errbuf, sizeof (errbuf),
dgettext(TEXT_DOMAIN, "Key unload error"));
/* check that encryption is enabled for the pool */
if (!encryption_feature_is_enabled(zhp->zpool_hdl)) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"Encryption feature not enabled."));
ret = EINVAL;
goto error;
}
/* Fetch the keyformat. Check that the dataset is encrypted. */
keyformat = zfs_prop_get_int(zhp, ZFS_PROP_KEYFORMAT);
if (keyformat == ZFS_KEYFORMAT_NONE) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"'%s' is not encrypted."), zfs_get_name(zhp));
ret = EINVAL;
goto error;
}
/*
* Fetch the key location. Check that we are working with an
* encryption root.
*/
ret = zfs_crypto_get_encryption_root(zhp, &is_encroot, prop_encroot);
if (ret != 0) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"Failed to get encryption root for '%s'."),
zfs_get_name(zhp));
goto error;
} else if (!is_encroot) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"Keys must be unloaded for encryption root of '%s' (%s)."),
zfs_get_name(zhp), prop_encroot);
ret = EINVAL;
goto error;
}
/* check that the key is loaded */
keystatus = zfs_prop_get_int(zhp, ZFS_PROP_KEYSTATUS);
if (keystatus == ZFS_KEYSTATUS_UNAVAILABLE) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"Key already unloaded for '%s'."), zfs_get_name(zhp));
ret = ENOENT;
goto error;
}
/* call the ioctl */
ret = lzc_unload_key(zhp->zfs_name);
if (ret != 0) {
switch (ret) {
case EPERM:
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"Permission denied."));
break;
case ENOENT:
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"Key already unloaded for '%s'."),
zfs_get_name(zhp));
break;
case EBUSY:
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"'%s' is busy."), zfs_get_name(zhp));
break;
}
zfs_error(zhp->zfs_hdl, EZFS_CRYPTOFAILED, errbuf);
}
return (ret);
error:
zfs_error(zhp->zfs_hdl, EZFS_CRYPTOFAILED, errbuf);
return (ret);
}
开发者ID:cbreak-black,项目名称:zfs,代码行数:84,代码来源:libzfs_crypto.c
示例6: dgettext
char *_p_CDGetText (char *domainname, char *msgid)
{
return dgettext (domainname, msgid);
}
开发者ID:c0ns0le,项目名称:cygwin,代码行数:4,代码来源:intlc.c
示例7: recognizer_load
recognizer
recognizer_load(char* directory, char* name, char** subset)
{
recognizer rec; /*the recognizer*/
rec_info* rinf; /*rec_info for recognizer information*/
static bool intl_init = false; /*true if recog. manager initted.*/
if( intl_init == false ) {
intl_init = true;
intl_initialize();
}
/*The name takes precedence.*/
rinf = make_rec_info(directory, name, subset);
if (rinf == nil) {
the_last_error =
dgettext(INTL_DOMAIN,
"Ran out of memory during prelinking initialization.");
return((recognizer)nil);
}
/* fprint(2, "Got past make_rec_info.\n"); */
/*Let recognition code create recognizer and initialize*/
rec = __recognizer_internal_initialize(rinf);
if (rec == nil) {
return((recognizer)nil);
}
/* fprint(2, "Did rii.\n"); */
/*Check whether it's been correctly initialized*/
if( rec->recognizer_load_state == nil ||
rec->recognizer_save_state == nil ||
rec->recognizer_load_dictionary == nil ||
rec->recognizer_save_dictionary == nil ||
rec->recognizer_free_dictionary == nil ||
rec->recognizer_add_to_dictionary == nil ||
rec->recognizer_delete_from_dictionary == nil ||
rec->recognizer_error == nil ||
rec->recognizer_set_context == nil ||
rec->recognizer_get_context == nil ||
rec->recognizer_clear == nil ||
rec->recognizer_get_buffer == nil ||
rec->recognizer_set_buffer == nil ||
rec->recognizer_translate == nil ||
rec->recognizer_get_extension_functions == nil ||
rec->recognizer_get_gesture_names == nil ||
rec->recognizer_set_gesture_action == nil
) {
recognizer_unload(rec);
/* fprint(2, "Unloading b/c null function pointer.\n"); */
the_last_error =
dgettext(INTL_DOMAIN,
"One or more recognizer function pointers is nil.");
return((recognizer)nil);
}
/*Set the rec_info structure.*/
rec->recognizer_info = rinf;
/*Check whether home directory is there for recognizer info.*/
/*
* ari -- don't bother. We're not going to load from each user's
* home directory at this point. Instead, we'll use a stupid
* little a-b-c file because it loads FAST.
*
* if( check_for_user_home() < 0 ) {
* recognizer_unload(rec);
* return((recognizer)nil);
* }
*/
/*We got it!*/
/* fprint(2, "Done.\n"); */
return(rec);
}
开发者ID:aahud,项目名称:harvey,代码行数:79,代码来源:hre_api.c
示例8: uu_strerror
const char *
uu_strerror(uint32_t code)
{
const char *str;
switch (code) {
case UU_ERROR_NONE:
str = dgettext(TEXT_DOMAIN, "No error");
break;
case UU_ERROR_INVALID_ARGUMENT:
str = dgettext(TEXT_DOMAIN, "Invalid argument");
break;
case UU_ERROR_UNKNOWN_FLAG:
str = dgettext(TEXT_DOMAIN, "Unknown flag passed");
break;
case UU_ERROR_NO_MEMORY:
str = dgettext(TEXT_DOMAIN, "Out of memory");
break;
case UU_ERROR_CALLBACK_FAILED:
str = dgettext(TEXT_DOMAIN, "Callback-initiated failure");
break;
case UU_ERROR_NOT_SUPPORTED:
str = dgettext(TEXT_DOMAIN, "Operation not supported");
break;
case UU_ERROR_EMPTY:
str = dgettext(TEXT_DOMAIN, "No value provided");
break;
case UU_ERROR_UNDERFLOW:
str = dgettext(TEXT_DOMAIN, "Value too small");
break;
case UU_ERROR_OVERFLOW:
str = dgettext(TEXT_DOMAIN, "Value too large");
break;
case UU_ERROR_INVALID_CHAR:
str = dgettext(TEXT_DOMAIN,
"Value contains unexpected character");
break;
case UU_ERROR_INVALID_DIGIT:
str = dgettext(TEXT_DOMAIN,
"Value contains digit not in base");
break;
case UU_ERROR_SYSTEM:
str = dgettext(TEXT_DOMAIN, "Underlying system error");
break;
case UU_ERROR_UNKNOWN:
str = dgettext(TEXT_DOMAIN, "Error status not known");
break;
default:
errno = ESRCH;
str = NULL;
break;
}
return (str);
}
开发者ID:64116278,项目名称:zfs,代码行数:67,代码来源:uu_misc.c
示例9: rpc_netshareenum
static int
rpc_netshareenum(struct smb_ctx *ctx, int *entriesp, int *totalp,
struct share_info **entries_listp)
{
char ctx_string[2+16+1]; /* enough for 64-bit pointer, in hex */
unsigned_char_p_t binding;
unsigned32 binding_status;
rpc_binding_handle_t binding_h;
int error, i, entries;
char *addrstr, *srvnamestr;
unsigned short *usrvnamestr;
unsigned32 level;
SHARE_ENUM_STRUCT share_info;
SHARE_INFO_1_CONTAINER share_info_1_container;
SHARE_INFO_1 *shares, *share;
unsigned32 total_entries;
unsigned32 status, free_status;
struct share_info *entry_list, *elp;
static EXCEPTION rpc_x_connect_rejected;
static int exceptions_initialized;
sprintf(ctx_string, "%p", ctx);
rpc_string_binding_compose(NULL, "ncacn_np", ctx_string,
"srvsvc", NULL, &binding, &binding_status);
if (binding_status != rpc_s_ok) {
smb_error(dgettext(TEXT_DOMAIN,
"rpc_string_binding_compose failed with %d"),
0, binding_status);
return (EINVAL);
}
rpc_binding_from_string_binding(binding, &binding_h, &status);
rpc_string_free(&binding, (unsigned32 *)&free_status);
if (binding_status != rpc_s_ok) {
smb_error(dgettext(TEXT_DOMAIN,
"rpc_binding_from_string_binding failed with %d"), 0,
binding_status);
return (EINVAL);
}
level = 1;
share_info.share_union.level = 1;
share_info.share_union.tagged_union.share1 = &share_info_1_container;
share_info_1_container.share_count = 0;
share_info_1_container.shares = NULL;
/*
* Convert the server IP address to a string, and send that as
* the "server name" - that's what Windows appears to do, and
* that avoids problems with NetBIOS names containing
* non-ASCII characters.
*/
addrstr = inet_ntoa(ctx->ct_srvinaddr.sin_addr);
srvnamestr = malloc(strlen(addrstr) + 3);
if (srvnamestr == NULL) {
status = errno;
smb_error(dgettext(TEXT_DOMAIN,
"can't allocate string for server address"), status);
rpc_binding_free(&binding_h, &free_status);
return (status);
}
strcpy(srvnamestr, "\\\\");
strcat(srvnamestr, addrstr);
usrvnamestr = convert_utf8_to_leunicode(srvnamestr);
if (usrvnamestr == NULL) {
smb_error(dgettext(TEXT_DOMAIN,
"can't convert string for server address to Unicode"), 0);
rpc_binding_free(&binding_h, &free_status);
free(srvnamestr);
return (EINVAL);
}
if (!exceptions_initialized) {
EXCEPTION_INIT(rpc_x_connect_rejected);
exc_set_status(&rpc_x_connect_rejected, rpc_s_connect_rejected);
exceptions_initialized = 1;
}
/* printf("Calling NetrShareEnum.."); XXX */
TRY
status = NetrShareEnum(binding_h, usrvnamestr, &level,
&share_info, 4294967295U, &total_entries, NULL);
if (status != 0)
smb_error(dgettext(TEXT_DOMAIN,
"error from NetrShareEnum call: status = 0x%08x"),
0, status);
/*CSTYLED*/
CATCH (rpc_x_connect_rejected)
/*
* This is what we get if we can't open the pipe.
* That's a normal occurrence when we're talking
* to a system that (presumably) doesn't support
* DCE RPC on the server side, such as Windows 95/98/Me,
* so we don't log an error.
*/
/*CSTYLED*/
status = ENOTSUP;
CATCH_ALL
/*
* XXX - should we handle some exceptions differently,
* returning different errors, and try RAP only for
* ENOTSUP?
*/
smb_error(dgettext(TEXT_DOMAIN,
"error from NetrShareEnum call: exception = %u"),
//.........这里部分代码省略.........
开发者ID:apprisi,项目名称:illumos-gate,代码行数:101,代码来源:netshareenum.c
示例10: gimp_enum_get_value
/**
* gimp_enum_get_value:
* @enum_type: the #GType of a registered enum
* @value: an integer value
* @value_name: return location for the value's name (or %NULL)
* @value_nick: return location for the value's nick (or %NULL)
* @value_desc: return location for the value's translated description (or %NULL)
* @value_help: return location for the value's translated help (or %NULL)
*
* Checks if @value is valid for the enum registered as @enum_type.
* If the value exists in that enum, its name, nick and its translated
* description and help are returned (if @value_name, @value_nick,
* @value_desc and @value_help are not %NULL).
*
* Return value: %TRUE if @value is valid for the @enum_type,
* %FALSE otherwise
*
* Since: GIMP 2.2
**/
gboolean
gimp_enum_get_value (GType enum_type,
gint value,
const gchar **value_name,
const gchar **value_nick,
const gchar **value_desc,
const gchar **value_help)
{
GEnumClass *enum_class;
GEnumValue *enum_value;
gboolean success = FALSE;
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), FALSE);
enum_class = g_type_class_ref (enum_type);
enum_value = g_enum_get_value (enum_class, value);
if (enum_value)
{
if (value_name)
*value_name = enum_value->value_name;
if (value_nick)
*value_nick = enum_value->value_nick;
if (value_desc || value_help)
{
GimpEnumDesc *enum_desc;
enum_desc = gimp_enum_get_desc (enum_class, value);
if (value_desc)
{
if (enum_desc && enum_desc->value_desc)
{
const gchar *context;
context = gimp_type_get_translation_context (enum_type);
if (context) /* the new way, using NC_() */
*value_desc = g_dpgettext2 (gimp_type_get_translation_domain (enum_type),
context,
enum_desc->value_desc);
else /* for backward compatibility */
*value_desc = g_strip_context (enum_desc->value_desc,
dgettext (gimp_type_get_translation_domain (enum_type),
enum_desc->value_desc));
}
else
{
*value_desc = NULL;
}
}
if (value_help)
{
*value_help = ((enum_desc && enum_desc->value_help) ?
dgettext (gimp_type_get_translation_domain (enum_type),
enum_desc->value_help) :
NULL);
}
}
success = TRUE;
}
g_type_class_unref (enum_class);
return success;
}
开发者ID:frne,项目名称:gimp,代码行数:89,代码来源:gimputils.c
示例11: error_message
const char * KRB5_CALLCONV
error_message(long code)
{
unsigned long offset;
unsigned long l_offset;
struct et_list *e;
unsigned long table_num;
int started = 0;
unsigned int divisor = 100;
char *cp, *cp1;
const struct error_table *table;
if (CALL_INIT_FUNCTION(com_err_initialize))
return 0;
l_offset = (unsigned long)code & ((1<<ERRCODE_RANGE)-1);
offset = l_offset;
table_num = ((unsigned long)code - l_offset) & ERRCODE_MAX;
if (table_num == 0
#ifdef __sgi
/* Irix 6.5 uses a much bigger table than other UNIX
systems I've looked at, but the table is sparse. The
sparse entries start around 500, but sys_nerr is only
152. */
|| (code > 0 && code <= 1600)
#endif
) {
if (code == 0)
goto oops;
/* This could trip if int is 16 bits. */
if ((unsigned long)(int)code != (unsigned long)code)
abort ();
cp = get_thread_buffer();
if (cp && strerror_r(code, cp, ET_EBUFSIZ) == 0)
return cp;
return strerror(code);
}
k5_mutex_lock(&et_list_lock);
dprintf(("scanning list for %x\n", table_num));
for (e = et_list; e != NULL; e = e->next) {
dprintf(("\t%x = %s\n", e->table->base & ERRCODE_MAX,
e->table->msgs[0]));
if ((e->table->base & ERRCODE_MAX) == table_num) {
table = e->table;
goto found;
}
}
goto no_table_found;
found:
k5_mutex_unlock(&et_list_lock);
dprintf (("found it!\n"));
/* This is the right table */
/* This could trip if int is 16 bits. */
if ((unsigned long)(unsigned int)offset != offset)
goto no_table_found;
if (table->n_msgs <= (unsigned int) offset)
goto no_table_found;
/* If there's a string at the end of the table, it's a text domain. */
if (table->msgs[table->n_msgs] != NULL)
return dgettext(table->msgs[table->n_msgs], table->msgs[offset]);
else
return table->msgs[offset];
no_table_found:
k5_mutex_unlock(&et_list_lock);
#if defined(_WIN32)
/*
* WinSock errors exist in the 10000 and 11000 ranges
* but might not appear if WinSock is not initialized
*/
if (code >= WSABASEERR && code < WSABASEERR + 1100) {
table_num = 0;
offset = code;
divisor = WSABASEERR;
}
#endif
#ifdef _WIN32
{
LPVOID msgbuf;
if (! FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL /* lpSource */,
(DWORD) code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &msgbuf,
(DWORD) 0 /*sizeof(buffer)*/,
NULL /* va_list */ )) {
/*
* WinSock errors exist in the 10000 and 11000 ranges
* but might not appear if WinSock is not initialized
*/
if (code >= WSABASEERR && code < WSABASEERR + 1100) {
table_num = 0;
offset = code;
//.........这里部分代码省略.........
开发者ID:Akasurde,项目名称:krb5,代码行数:101,代码来源:error_message.c
示例12: zfs_key_load
int
zfs_key_load(zfs_handle_t *zhp, boolean_t mount, boolean_t share,
boolean_t recursive)
{
zfs_handle_t *pzhp = NULL;
zprop_source_t propsrctype;
char source[ZFS_MAXNAMELEN];
char keysource[MAXNAMELEN];
uint64_t ret, crypt, keystatus;
zfs_cmd_t zc = { {0 }};
char errbuf[1024];
fprintf(stderr, "zfs_key_load\r\n");
(void) strlcpy(zc.zc_name, zfs_get_name(zhp), sizeof (zc.zc_name));
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"cannot load key for '%s'"), zc.zc_name);
zfs_refresh_properties(zhp);
crypt = zfs_prop_get_int(zhp, ZFS_PROP_ENCRYPTION);
if (crypt == ZIO_CRYPT_OFF) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"encryption not enabled on dataset %s."), zc.zc_name);
return (zfs_error(zhp->zfs_hdl, EZFS_KEYERR, errbuf));
}
keystatus = zfs_prop_get_int(zhp, ZFS_PROP_KEYSTATUS);
if (keystatus == ZFS_CRYPT_KEY_AVAILABLE && !recursive) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"already loaded."));
return (zfs_error(zhp->zfs_hdl, EZFS_KEYERR, errbuf));
}
if (zfs_prop_get(zhp, ZFS_PROP_KEYSOURCE, keysource, ZFS_MAXNAMELEN,
&propsrctype, source, sizeof (source), FALSE) != 0) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"no keysource property available."));
return (zfs_error(zhp->zfs_hdl, EZFS_KEYERR, errbuf));
}
if (propsrctype == ZPROP_SRC_INHERITED) {
#if 0 // FIXME
if (strcmp(source, ZONE_INVISIBLE_SOURCE) == 0) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"key must be loaded from global zone."));
return (zfs_error(zhp->zfs_hdl, EZFS_KEYERR, errbuf));
}
#endif
pzhp = make_dataset_handle(zhp->zfs_hdl, source);
if (pzhp == NULL) {
errno = EINVAL;
return (zfs_error(zhp->zfs_hdl, EZFS_KEYERR, errbuf));
}
keystatus = zfs_prop_get_int(pzhp, ZFS_PROP_KEYSTATUS);
zfs_close(pzhp);
}
if (propsrctype == ZPROP_SRC_DEFAULT) {
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
"invalid keysource property."));
return (zfs_error(zhp->zfs_hdl, EZFS_KEYERR, errbuf));
}
if (!zfs_can_prompt_if_needed(keysource)) {
errno = ENOTTY;
return (-1);
}
/*
* NONE we are the top ds asking for crypto so we
* need to get and load the key.
*
* UNAVAILABLE we need to load the key of a higher level
* dataset.
*
* AVAILABLE we are done other than filling in who we
* are inheriting the wrapping key from.
*/
if (propsrctype == ZPROP_SRC_INHERITED &&
keystatus == ZFS_CRYPT_KEY_AVAILABLE) {
(void) strlcpy(zc.zc_crypto.zic_inherit_dsname, source,
sizeof (zc.zc_crypto.zic_inherit_dsname));
ret = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_CRYPTO_KEY_INHERIT, &zc);
goto out;
}
zc.zc_crypto.zic_crypt = crypt;
ret = key_hdl_to_zc(zhp->zfs_hdl, zhp, keysource, crypt, &zc,
ZFS_CRYPTO_KEY_LOAD);
if (ret != 0) {
if (errno == ENOTTY)
ret = 0;
goto out;
}
ret = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_CRYPTO_KEY_LOAD, &zc);
out:
//.........这里部分代码省略.........
开发者ID:corbosman,项目名称:zfs-crypto,代码行数:101,代码来源:libzfs_crypto.c
示例13: key_hdl_to_zc
static int
key_hdl_to_zc(libzfs_handle_t *hdl, zfs_handle_t *zhp, char *keysource,
int crypt, zfs_cmd_t *zc, zfs_crypto_zckey_t cmd)
{
// CK_SESSION_HANDLE session;
int ret = 0;
key_format_t format;
key_locator_t locator;
char *uri;
//pkcs11_uri_t p11uri;
size_t keylen = zio_crypt_table[crypt].ci_keylen;
char *keydata = NULL;
size_t keydatalen = 0;
char *tmpkeydata = NULL;
size_t tmpkeydatalen = 0;
uint64_t salt;
//struct cb_arg_curl cb_curl = { 0 };
fprintf(stderr, "in key_hdl_to_zc\r\n");
zc->zc_crypto.zic_clone_newkey = hdl->libzfs_crypt.zc_clone_newkey;
if (!keysource_prop_parser(keysource, &format, &locator, &uri)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"invalid keysource property."));
return (-1);
}
/*
* First check if there was anything in the handle already
* if so we use that and we are done with locating the data.
* Note that we may be looking at other fields
* and zic_clone_newkey even if zc_key_data_len is empty.
*
* We allow this regardless of the locator so that things
* like a PAM module can provide the passphrase but the user
* can still have "passphrase,prompt" to use zfs(1M) interactively.
*/
if (hdl->libzfs_crypt.zc_key_data_len != 0) {
keydata = zfs_alloc(hdl, hdl->libzfs_crypt.zc_key_data_len);
bcopy(hdl->libzfs_crypt.zc_key_data, keydata,
hdl->libzfs_crypt.zc_key_data_len);
keydatalen = hdl->libzfs_crypt.zc_key_data_len;
goto format_key;
}
/*
* Get the key from the URI or prompt for it.
* If the format is raw then prompting is a simple read(2)
* otherwise we put up a prompt saying what we are asking for.
* We can't do this with the 'zfs mount -a' that is in
* sys:/system/filesystem/local:default but we shouldn't
* cause errors or warnings there either.
*/
switch (locator) {
case KEY_LOCATOR_PROMPT:
if (format == KEY_FORMAT_RAW) {
keydata = zfs_alloc(hdl, keylen);
errno = 0;
keydatalen = read(STDIN_FILENO, keydata, keylen);
if (keydatalen != keylen) {
free(keydata);
return (-1);
}
} else {
int tries = 0;
do {
/* get_passphrase allocates keydata */
ret = get_passphrase(hdl, &keydata,
&keydatalen, format, zc, cmd);
} while (ret != 0 && ++tries < 3);
if (ret)
return (-1);
}
break;
case KEY_LOCATOR_FILE_URI:
/*
* Need to tell pkcs11_read_data() how big of a key
* we want in case the locator URI is a device (eg, /dev/random)
* to be read from and not a file.
*
* Note that pkcs11_read_data allocates memory with malloc
* that we need to free.
*/
#if 0 // FIXME
keydatalen = keylen;
ret = pkcs11_read_data(&(uri[7]),
(void **)&keydata, &keydatalen);
if (ret != 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"failed to read key file: %s"), strerror(ret));
errno = ret;
return (-1);
}
#endif
break;
case KEY_LOCATOR_PKCS11_URI:
#if 0 // FIXME
//.........这里部分代码省略.........
开发者ID:corbosman,项目名称:zfs-crypto,代码行数:101,代码来源:libzfs_crypto.c
示例14: fontforge_main
//.........这里部分代码省略.........
GResourceSetProg(GFileRemoveExtension(GFileNormalizePath(path)));
}
#else
GResourceSetProg(argv[0]);
#endif
#if defined(__Mac)
/* The mac seems to default to the "C" locale, LANG and LC_MESSAGES are not*/
/* defined. This means that gettext will not bother to look up any message*/
/* files -- even if we have a "C" or "POSIX" entry in the locale diretory */
/* Now if X11 gives us the command key, I want to force a rebinding to use */
/* Cmd rather than Control key -- more mac-like. But I can't do that if */
/* there is no locale. So I force a locale if there is none specified */
/* I force the US English locale, because that's the what the messages are */
/* by default so I'm changing as little as I can. I think. */
/* Now the locale command will treat a LANG which is "" as undefined, but */
/* gettext will not. So I don't bother to check for null strings or "C" */
/* or "POSIX". If they've mucked with the locale perhaps they know what */
/* they are doing */
{
int did_keybindings = 0;
int useCommandKey = get_mac_x11_prop("enable_key_equivalents") <= 0;
if ( local_x && useCommandKey ) {
hotkeySystemSetCanUseMacCommand( 1 );
/* Ok, we get the command key */
if ( getenv("LANG")==NULL && getenv("LC_MESSAGES")==NULL ) {
setenv("LC_MESSAGES","en_US.UTF-8",0);
}
/* Can we find a set of keybindings designed for the mac with cmd key? */
bind_textdomain_codeset("Mac-FontForge-MenuShortCuts","UTF-8");
bindtextdomain("Mac-FontForge-MenuShortCuts", getLocaleDir());
if ( *dgettext("Mac-FontForge-MenuShortCuts","Flag0x10+")!='F' ) {
GMenuSetShortcutDomain("Mac-FontForge-MenuShortCuts");
did_keybindings = 1;
}
}
if ( !did_keybindings ) {
/* Nope. we can't. Fall back to the normal stuff */
#endif
GMenuSetShortcutDomain("FontForge-MenuShortCuts");
bind_textdomain_codeset("FontForge-MenuShortCuts","UTF-8");
bindtextdomain("FontForge-MenuShortCuts", getLocaleDir());
#if defined(__Mac)
}
}
#endif
bind_textdomain_codeset("FontForge","UTF-8");
bindtextdomain("FontForge", getLocaleDir());
textdomain("FontForge");
GResourceUseGetText();
{
char shareDir[PATH_MAX];
char* sd = getShareDir();
strncpy( shareDir, sd, PATH_MAX );
shareDir[PATH_MAX-1] = '\0';
if(!sd) {
strcpy( shareDir, SHAREDIR );
}
char path[PATH_MAX];
snprintf(path, PATH_MAX, "%s%s", shareDir, "/pixmaps" );
GGadgetSetImageDir( path );
snprintf(path, PATH_MAX, "%s%s", shareDir, "/resources/fontforge.resource" );
开发者ID:MichinariNukazawa,项目名称:fontforge,代码行数:67,代码来源:startui.c
示例15: _show_group_dialog
static gboolean _show_group_dialog (CairoDockGroupDescription *pGroupDescription)
{
gchar *cDescription = NULL;
if (pGroupDescription->cDescription != NULL)
{
if (*pGroupDescription->cDescription == '/')
{
//g_print ("on recupere la description de %s\n", pGroupDescription->cDescription);
gsize length = 0;
GError *erreur = NULL;
g_file_get_contents (pGroupDescription->cDescription,
&cDescription,
&length,
&erreur);
if (erreur != NULL)
{
cd_warning (erreur->message);
g_error_free (erreur);
}
}
}
int iPreviewWidgetWidth;
GtkWidget *pPreviewImage = cairo_dock_get_preview_image (&iPreviewWidgetWidth);
if (pGroupDescription->cPreviewFilePath != NULL && strcmp (pGroupDescription->cPreviewFilePath, "none") != 0)
{
//g_print ("on recupere la prevue de %s\n", pGroupDescription->cPreviewFilePath);
int iPreviewWidth, iPreviewHeight;
GdkPixbuf *pPreviewPixbuf = NULL;
if (gdk_pixbuf_get_file_info (pGroupDescription->cPreviewFilePath, &iPreviewWidth, &iPreviewHeight) != NULL)
{
if (iPreviewWidth > CAIRO_DOCK_PREVIEW_WIDTH)
{
iPreviewHeight *= 1.*CAIRO_DOCK_PREVIEW_WIDTH/iPreviewWidth;
iPreviewWidth = CAIRO_DOCK_PREVIEW_WIDTH;
}
if (iPreviewHeight > CAIRO_DOCK_PREVIEW_HEIGHT)
{
iPreviewWidth *= 1.*CAIRO_DOCK_PREVIEW_HEIGHT/iPreviewHeight;
iPreviewHeight = CAIRO_DOCK_PREVIEW_HEIGHT;
}
if (iPreviewWidth > iPreviewWidgetWidth)
{
iPreviewHeight *= 1.*iPreviewWidgetWidth/iPreviewWidth;
iPreviewWidth = iPreviewWidgetWidth;
}
g_print ("preview : %dx%d\n", iPreviewWidth, iPreviewHeight);
pPreviewPixbuf = gdk_pixbuf_new_from_file_at_size (pGroupDescription->cPreviewFilePath, iPreviewWidth, iPreviewHeight, NULL);
}
if (pPreviewPixbuf == NULL)
{
cd_warning ("pas de prevue disponible");
pPreviewPixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
TRUE,
8,
1,
1);
}
gtk_image_set_from_pixbuf (GTK_IMAGE (pPreviewImage), pPreviewPixbuf);
gdk_pixbuf_unref (pPreviewPixbuf);
gtk_widget_show (pPreviewImage);
}
if (s_pDialog != NULL)
if (! cairo_dock_dialog_unreference (s_pDialog))
cairo_dock_dialog_unreference (s_pDialog);
Icon *pIcon = cairo_dock_get_current_active_icon ();
if (pIcon == NULL || pIcon->cParentDockName == NULL || pIcon->fPersonnalScale > 0)
pIcon = cairo_dock_get_dialogless_icon ();
CairoDock *pDock = cairo_dock_search_dock_from_name (pIcon != NULL ? pIcon->cParentDockName : NULL);
s_pDialog = cairo_dock_show_temporary_dialog_with_icon (dgettext (pGroupDescription->cGettextDomain, cDescription != NULL ? cDescription : pGroupDescription->cDescription), pIcon, CAIRO_CONTAINER (pDock), 0., pGroupDescription->cIcon);
cairo_dock_dialog_reference (s_pDialog);
g_free (cDescription);
s_iSidShowGroupDialog = 0;
return FALSE;
}
开发者ID:BackupTheBerlios,项目名称:cairo-dock-svn,代码行数:79,代码来源:cairo-dock-gui-callbacks.c
示例16: _inf_gettext
const char*
_inf_gettext(const char* msgid)
{
return dgettext(GETTEXT_PACKAGE, msgid);
}
开发者ID:bb-generation,项目名称:infinote,代码行数:5,代码来源:inf-i18n.c
示例17: inuse_svm
/*
* Search the list of devices under SVM for the specified device.
*/
int
inuse_svm(char *slice, nvlist_t *attrs, int *errp)
{
struct svm_list *listp;
int found = 0;
*errp = 0;
if (slice == NULL)
|
请发表评论