~ubuntu-branches/ubuntu/hardy/gnupg/hardy-updates

« back to all changes in this revision

Viewing changes to g10/openfile.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-11-03 09:18:26 UTC
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20061103091826-89kwl8tk1xypbmtk
Tags: upstream-1.4.5
ImportĀ upstreamĀ versionĀ 1.4.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
#ifdef USE_ONLY_8DOT3
202
202
      if (opt.mangle_dos_filenames)
203
203
        {
204
 
          /* It is quite common DOS system to have only one dot in a
 
204
          /* It is quite common for DOS system to have only one dot in a
205
205
           * a filename So if we have something like this, we simple
206
 
           * replace the suffix execpt in cases where the suffix is
207
 
           * larger than 3 characters and not the same as.
 
206
           * replace the suffix except in cases where the suffix is
 
207
           * larger than 3 characters and not identlically to the new one.
208
208
           * We should really map the filenames to 8.3 but this tends to
209
209
           * be more complicated and is probaly a duty of the filesystem
210
210
           */
214
214
          
215
215
          buf = xmalloc(strlen(iname)+4+1);
216
216
          strcpy(buf,iname);
217
 
          dot = strchr(buf, '.' );
 
217
          dot = strrchr(buf, '.' );
218
218
          if ( dot && dot > buf && dot[1] && strlen(dot) <= 4
219
 
                                  && CMP_FILENAME(newsfx, dot) )
 
219
               && CMP_FILENAME(newsfx, dot) 
 
220
               && !(strchr (dot, '/') || strchr (dot, '\\')))
220
221
            {
221
 
              strcpy(dot, newsfx );
 
222
              /* There is a dot, the dot is not the first character,
 
223
                 the suffix is not longer than 3, the suffix is not
 
224
                 equal to the new suffix and tehre is no path delimter
 
225
                 after the dot (e.g. foo.1/bar): Replace the
 
226
                 suffix. */
 
227
              strcpy (dot, newsfx );
222
228
            }
223
 
          else if ( dot && !dot[1] ) /* don't duplicate a dot */
224
 
            strcpy( dot, newsfx+1 );
 
229
          else if ( dot && !dot[1] ) /* Don't duplicate a trailing dot. */
 
230
            strcpy ( dot, newsfx+1 );
225
231
          else
226
 
            strcat ( buf, newsfx );
 
232
            strcat ( buf, newsfx ); /* Just append the new suffix. */
227
233
        }
228
234
      if (!buf)
229
235
#endif /* USE_ONLY_8DOT3 */