~ubuntu-branches/ubuntu/quantal/foomatic-filters/quantal

« back to all changes in this revision

Viewing changes to foomaticrip.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud, Translation updates
  • Date: 2011-02-09 15:38:14 UTC
  • mfrom: (1.2.4 upstream) (6.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110209153814-noiljpseb0kzdlzs
Tags: 4.0.6-1
* Upload to unstable.

[ Translation updates ]
* Japanese: Indent correctly.

* Explicitly depend on bash (Closes: #600179)

Show diffs side-by-side

added added

removed removed

Lines of Context:
946
946
 
947
947
int guess_file_type(const char *begin, size_t len, int *startpos)
948
948
{
949
 
    const char * p;
 
949
    const char * p, * end;
 
950
    p = begin;
 
951
    end = begin + len;
950
952
 
951
 
    p = memchr(begin, '%', len);
952
 
    if (!p)
953
 
        return UNKNOWN_FILE;
954
 
    *startpos = p - begin;
955
 
    if (!memcmp(p, "%!", 2))
956
 
        return PS_FILE;
957
 
    else if (!memcmp(p, "%PDF-1.", 7))
958
 
        return PDF_FILE;
 
953
    while (p < end)
 
954
    {
 
955
        p = memchr(p, '%', end - p);
 
956
        if (!p)
 
957
            return UNKNOWN_FILE;
 
958
        *startpos = p - begin;
 
959
        if ((end - p) > 2 && !memcmp(p, "%!", 2))
 
960
            return PS_FILE;
 
961
        else if ((end - p) > 7 && !memcmp(p, "%PDF-1.", 7))
 
962
            return PDF_FILE;
 
963
        ++ p;
 
964
    }
959
965
    *startpos = 0;
960
966
    return UNKNOWN_FILE;
961
967
}
1377
1383
        dstrcpyf(filelist, "<STDIN>");
1378
1384
 
1379
1385
    /* Check filelist */
1380
 
    p = strtok(filelist->data, " ");
 
1386
    p = strtok(strdup(filelist->data), " ");
1381
1387
    while (p) {
1382
1388
        if (strcmp(p, "<STDIN>") != 0) {
1383
1389
            if (p[0] == '-')