Ejemplo n.º 1
0
char	*do_crypt (char *str, Crypt *key, int flag)
{
    size_t	c;
    char	*free_it = NULL;

    c = strlen(str);
    if (flag)
    {
        if (key->prog)
            free_it = str = (char*)prog_crypt(str, &c, key, flag);
        else
            my_encrypt(str, c, key->key);
        str = enquote_it(str, c);
    }
    else
    {
        str = dequote_it(str, &c);
        if (key->prog)
            str = (char*)prog_crypt(free_it = str, &c, key, flag);
        else
            my_decrypt(str, c, key->key);
    }
    new_free(&free_it);
    return (str);
}
Ejemplo n.º 2
0
Archivo: files.c Proyecto: tcava/bx2
char *	file_readb (int fd, int numb)
{
	File *ptr = lookup_file(fd);
	if (!ptr)
		return malloc_strdup(empty_string);
	else
	{
		char *blah = (char *)new_malloc(numb+1);
		char *bleh = NULL;
                if (ptr->elf->fp) {
                    clearerr(ptr->elf->fp);
                    numb = fread(blah, 1, numb, ptr->elf->fp);
#ifdef HAVE_LIBARCHIVE
                } else if (ptr->elf->a) {
                    numb = archive_read_data(ptr->elf->a, blah, numb);
#endif
                } else {
                    /* others */
                }
		bleh = enquote_it(blah, numb);
		new_free(&blah);
		return bleh;
	}
}