Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 13 Mar 2013 07:59:40 +0100
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: Re: gpg2john (was: Work needed before Jumbo-8)

On 13 Mar, 2013, at 7:45 , magnum <john.magnum@...hmail.com> wrote:
> basename(3) varies with platform. I think this is portable:
> 
> 	#include <libgen.h>
> 	#include <string.h>
> 	
> 	char *login;
> 	int len;
> 
> 	login = basename(strdup(filename));
> 	if (!login || !*login)
> 		strcpy(login, filename);
> 	len = strlen(login) - 4;
> 	if (strcmp(&login[len], ".gpg" ||
> 	    strcmp(&login[len], ".pgp")
> 		login[len] = 0;

s/strcmp/!strcmp/g

magnum

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ