mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-12 22:11:29 +02:00
gpg: Re-indent two files.
--
This commit is contained in:
parent
e30cb8f617
commit
63c6514415
429
g10/mainproc.c
429
g10/mainproc.c
File diff suppressed because it is too large
Load Diff
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
/* FIXME: Implement opt.interactive. */
|
/* FIXME: Implement opt.interactive. */
|
||||||
|
|
||||||
/****************
|
/*
|
||||||
* Check whether FNAME exists and ask if it's okay to overwrite an
|
* Check whether FNAME exists and ask if it's okay to overwrite an
|
||||||
* existing one.
|
* existing one.
|
||||||
* Returns: True: it's okay to overwrite or the file does not exist
|
* Returns: True: it's okay to overwrite or the file does not exist
|
||||||
@ -92,7 +92,7 @@ overwrite_filep( const char *fname )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/*
|
||||||
* Strip known extensions from iname and return a newly allocated
|
* Strip known extensions from iname and return a newly allocated
|
||||||
* filename. Return NULL if we can't do that.
|
* filename. Return NULL if we can't do that.
|
||||||
*/
|
*/
|
||||||
@ -108,12 +108,14 @@ make_outfile_name( const char *iname )
|
|||||||
if (n > 4 && (!CMP_FILENAME(iname+n-4, EXTSEP_S GPGEXT_GPG)
|
if (n > 4 && (!CMP_FILENAME(iname+n-4, EXTSEP_S GPGEXT_GPG)
|
||||||
|| !CMP_FILENAME(iname+n-4, EXTSEP_S "pgp")
|
|| !CMP_FILENAME(iname+n-4, EXTSEP_S "pgp")
|
||||||
|| !CMP_FILENAME(iname+n-4, EXTSEP_S "sig")
|
|| !CMP_FILENAME(iname+n-4, EXTSEP_S "sig")
|
||||||
|| !CMP_FILENAME(iname+n-4, EXTSEP_S "asc") ) ) {
|
|| !CMP_FILENAME(iname+n-4, EXTSEP_S "asc")))
|
||||||
|
{
|
||||||
char *buf = xstrdup (iname);
|
char *buf = xstrdup (iname);
|
||||||
buf[n-4] = 0;
|
buf[n-4] = 0;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
else if( n > 5 && !CMP_FILENAME(iname+n-5, EXTSEP_S "sign") ) {
|
else if (n > 5 && !CMP_FILENAME(iname+n-5, EXTSEP_S "sign"))
|
||||||
|
{
|
||||||
char *buf = xstrdup (iname);
|
char *buf = xstrdup (iname);
|
||||||
buf[n-5] = 0;
|
buf[n-5] = 0;
|
||||||
return buf;
|
return buf;
|
||||||
@ -168,7 +170,7 @@ ask_outfile_name( const char *name, size_t namelen )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/*
|
||||||
* Make an output filename for the inputfile INAME.
|
* Make an output filename for the inputfile INAME.
|
||||||
* Returns an IOBUF and an errorcode
|
* Returns an IOBUF and an errorcode
|
||||||
* Mode 0 = use ".gpg"
|
* Mode 0 = use ".gpg"
|
||||||
@ -308,7 +310,7 @@ open_outfile (int inp_fd, const char *iname, int mode, int restrictedperm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/*
|
||||||
* Try to open a file without the extension ".sig" or ".asc"
|
* Try to open a file without the extension ".sig" or ".asc"
|
||||||
* Return NULL if such a file is not available.
|
* Return NULL if such a file is not available.
|
||||||
*/
|
*/
|
||||||
@ -318,12 +320,15 @@ open_sigfile( const char *iname, progress_filter_context_t *pfx )
|
|||||||
IOBUF a = NULL;
|
IOBUF a = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if( !iobuf_is_pipe_filename (iname) ) {
|
if (!iobuf_is_pipe_filename (iname))
|
||||||
|
{
|
||||||
len = strlen(iname);
|
len = strlen(iname);
|
||||||
if( len > 4 && (!strcmp(iname + len - 4, EXTSEP_S "sig")
|
if( len > 4 && (!strcmp(iname + len - 4, EXTSEP_S "sig")
|
||||||
|| (len > 5 && !strcmp(iname + len - 5, EXTSEP_S "sign"))
|
|| (len > 5 && !strcmp(iname + len - 5, EXTSEP_S "sign"))
|
||||||
|| !strcmp(iname + len - 4, EXTSEP_S "asc")) ) {
|
|| !strcmp(iname + len - 4, EXTSEP_S "asc")))
|
||||||
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf = xstrdup(iname);
|
buf = xstrdup(iname);
|
||||||
buf[len-(buf[len-1]=='n'?5:4)] = 0 ;
|
buf[len-(buf[len-1]=='n'?5:4)] = 0 ;
|
||||||
a = iobuf_open( buf );
|
a = iobuf_open( buf );
|
||||||
@ -340,9 +345,11 @@ open_sigfile( const char *iname, progress_filter_context_t *pfx )
|
|||||||
xfree (buf);
|
xfree (buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* Copy the option file skeleton to the given directory.
|
* Copy the option file skeleton to the given directory.
|
||||||
*/
|
*/
|
||||||
@ -370,12 +377,14 @@ copy_options_file( const char *destdir )
|
|||||||
src = NULL;
|
src = NULL;
|
||||||
gpg_err_set_errno (EPERM);
|
gpg_err_set_errno (EPERM);
|
||||||
}
|
}
|
||||||
if( !src ) {
|
if (!src)
|
||||||
|
{
|
||||||
log_info (_("can't open '%s': %s\n"), fname, strerror(errno));
|
log_info (_("can't open '%s': %s\n"), fname, strerror(errno));
|
||||||
xfree(fname);
|
xfree(fname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strcpy (stpcpy (fname, destdir), DIRSEP_S GPGEXT_GPG EXTSEP_S "conf");
|
strcpy (stpcpy (fname, destdir), DIRSEP_S GPGEXT_GPG EXTSEP_S "conf");
|
||||||
|
|
||||||
oldmask = umask (077);
|
oldmask = umask (077);
|
||||||
if (is_secured_filename (fname))
|
if (is_secured_filename (fname))
|
||||||
{
|
{
|
||||||
@ -385,23 +394,29 @@ copy_options_file( const char *destdir )
|
|||||||
else
|
else
|
||||||
dst = fopen( fname, "w" );
|
dst = fopen( fname, "w" );
|
||||||
umask (oldmask);
|
umask (oldmask);
|
||||||
if( !dst ) {
|
|
||||||
|
if (!dst)
|
||||||
|
{
|
||||||
log_info (_("can't create '%s': %s\n"), fname, strerror(errno) );
|
log_info (_("can't create '%s': %s\n"), fname, strerror(errno) );
|
||||||
fclose (src);
|
fclose (src);
|
||||||
xfree (fname);
|
xfree (fname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( (c=getc(src)) != EOF ) {
|
while ((c = getc (src)) != EOF)
|
||||||
if( linefeeds < 3 ) {
|
{
|
||||||
|
if (linefeeds < 3)
|
||||||
|
{
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
linefeeds++;
|
linefeeds++;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
putc (c, dst);
|
putc (c, dst);
|
||||||
if (c== '\n')
|
if (c== '\n')
|
||||||
esc = 1;
|
esc = 1;
|
||||||
else if (esc == 1) {
|
else if (esc == 1)
|
||||||
|
{
|
||||||
if (c == ' ' || c == '\t')
|
if (c == ' ' || c == '\t')
|
||||||
;
|
;
|
||||||
else if (c == '#')
|
else if (c == '#')
|
||||||
@ -411,8 +426,10 @@ copy_options_file( const char *destdir )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (dst);
|
fclose (dst);
|
||||||
fclose (src);
|
fclose (src);
|
||||||
|
|
||||||
log_info (_("new configuration file '%s' created\n"), fname);
|
log_info (_("new configuration file '%s' created\n"), fname);
|
||||||
if (any_option)
|
if (any_option)
|
||||||
log_info (_("WARNING: options in '%s'"
|
log_info (_("WARNING: options in '%s'"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user