~ubuntu-branches/ubuntu/trusty/lifelines/trusty

« back to all changes in this revision

Viewing changes to src/stdlib/path.c

  • Committer: Bazaar Package Importer
  • Author(s): Felipe Augusto van de Wiel (faw)
  • Date: 2007-08-14 00:02:04 UTC
  • mfrom: (1.1.4 upstream) (3.1.4 gutsy)
  • Revision ID: james.westby@ubuntu.com-20070814000204-mpv5faygl0dgq3qi
Tags: 3.0.61-1
* New upstream release. (Closes: #387856).
* Fixing documentation build problems also fixes FTBFS if built twice in a
  row. (Closes: #424543).
* Adding lynx as a build dependency. This is necessary to generate txt files
  from html, discovered while fixing #424543.
* Upstream fix: charset for gedcom file in unicode. (Closes: #396206).
* Upstream fim: updating documentation about desc-tex2. (Closes: #405501).
* Bumping Standards-Version to 3.7.2 without package changes.
* Dropping local debian patches added upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
235
235
        if (ext && *ext) {
236
236
                elen = strlen(ext);
237
237
                if ((nlen > elen) && path_match(name+nlen-elen, ext)) {
238
 
                /*  name has an explicit extension the same as this one */
239
238
                        ext = NULL;
240
239
                        elen = 0;
241
240
                }
242
241
        }
243
242
        else { ext = NULL; elen = 0; }
 
243
        /*  at this point ext is non-null only if name doesn't 
 
244
         *  end in ext.  I.E. we need to check for name + ext and name
 
245
         */
 
246
 
244
247
        if (nlen + strlen(path) + elen >= MAXLINELEN) return NULL;
245
248
 
246
249
        /* for absolute and relative path names we first check the
254
257
                if (ext) {
255
258
                        strcpy(buf1,name);
256
259
                        nlen = strlen(buf1);
257
 
                        if (nlen < elen || strcmp(&buf1[nlen-elen],ext) != 0) {
258
 
                                strcat(buf1, ext);
259
 
                                if (access(buf1, 0) == 0) return strsave(buf1);
260
 
                                buf1[nlen] = '\0'; /* remove extension */
261
 
                        }
262
 
                        if (access(buf1, 0) == 0) return strsave(buf1);
263
 
                } else {
264
 
                        if (access(name, 0) == 0) return strsave(name);
 
260
                        strcat(buf1, ext);
 
261
                        if (access(buf1, 0) == 0) return strsave(buf1);
 
262
                        buf1[nlen] = '\0'; /* remove extension */
 
263
                        if (access(buf1, 0) == 0) return strsave(buf1);
265
264
                }
 
265
                if (access(name, 0) == 0) return strsave(name);
266
266
                /* fail if get here and name begins with a / or ./
267
267
                 * as we didn't find the file.
268
268
                 * however let foo/bar sneak thru, so we allow access
294
294
                strcpy(q, name);
295
295
                if (ext) {
296
296
                        nlen = strlen(buf2);
297
 
                        if (nlen < elen || strcmp(&buf2[nlen-elen],ext) != 0) {
298
 
                                strcat(buf2, ext);
299
 
                                if (access(buf2, 0) == 0) return strsave(buf2);
300
 
                                buf2[nlen] = '\0'; /* remove extension */
301
 
                        }
 
297
                        strcat(buf2, ext);
 
298
                        if (access(buf2, 0) == 0) return strsave(buf2);
 
299
                        buf2[nlen] = '\0'; /* remove extension */
302
300
                }
303
301
                if (access(buf2, 0) == 0) return strsave(buf2);
304
302
                p += strlen(p);