1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

* photoid.c: Provide default image viewer for Win32.

* misc.c (pct_expando): %t means extension, not name ("jpg", not "jpeg").

* keyserver.c (keyserver_spawn), photoid.c (show_photos), exec.h, exec.c:
Allow the caller to determine the temp file extension when starting an
exec_write and change all callers.
This commit is contained in:
David Shaw 2002-05-04 00:39:15 +00:00
parent 201ad25df9
commit 4991e018bf
6 changed files with 34 additions and 14 deletions

View file

@ -61,7 +61,10 @@ char *mkdtemp(char *template);
/* Makes a temp directory and filenames */
static int make_tempdir(struct exec_info *info)
{
char *tmp=opt.temp_dir;
char *tmp=opt.temp_dir,*ext=info->ext;
if(!ext)
ext=info->binary?"bin":"txt";
/* Make up the temp dir and files in case we need them */
if(tmp==NULL)
@ -112,17 +115,17 @@ static int make_tempdir(struct exec_info *info)
{
info->madedir=1;
info->tempfile_in=m_alloc(strlen(info->tempdir)
+strlen(DIRSEP_S)+6+strlen(EXTSEP_S)+3+1);
info->tempfile_in=m_alloc(strlen(info->tempdir)+strlen(DIRSEP_S)+6+
strlen(EXTSEP_S)+strlen(ext)+1);
sprintf(info->tempfile_in,"%s" DIRSEP_S "datain" EXTSEP_S "%s",
info->tempdir,info->binary?"bin":"txt");
info->tempdir,ext);
if(!info->writeonly)
{
info->tempfile_out=m_alloc(strlen(info->tempdir)
+strlen(DIRSEP_S)+7+strlen(EXTSEP_S)+3+1);
info->tempfile_out=m_alloc(strlen(info->tempdir)+strlen(DIRSEP_S)+7+
strlen(EXTSEP_S)+strlen(ext)+1);
sprintf(info->tempfile_out,"%s" DIRSEP_S "dataout" EXTSEP_S "%s",
info->tempdir,info->binary?"bin":"txt");
info->tempdir,ext);
}
}
@ -233,7 +236,7 @@ static int expand_args(struct exec_info *info,const char *args_in)
shell -c. If there are tempfiles, then it's a system. */
int exec_write(struct exec_info **info,const char *program,
const char *args_in,int writeonly,int binary)
const char *args_in,const char *ext,int writeonly,int binary)
{
int ret=G10ERR_GENERAL;
@ -257,6 +260,8 @@ int exec_write(struct exec_info **info,const char *program,
*info=m_alloc_clear(sizeof(struct exec_info));
if(ext)
(*info)->ext=m_strdup(ext);
(*info)->binary=binary;
(*info)->writeonly=writeonly;
@ -500,6 +505,7 @@ int exec_finish(struct exec_info *info)
}
m_free(info->command);
m_free(info->ext);
m_free(info->tempdir);
m_free(info->tempfile_in);
m_free(info->tempfile_out);