rpmfc script coloring tweaks
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 1 Feb 2010 11:20:26 +0000 (13:20 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 1 Feb 2010 11:39:42 +0000 (13:39 +0200)
- loosen up the perl token to catch more things, such as
  "/usr/bin/perl -w script text"
- remove unnecessary /usr/bin/python token, these get caught by "python "
  already
- remove what now should be unnecessary coloring by interpreter name,
  both perl and python scripts should get colored by the tokens already

build/rpmfc.c

index 0e8eba7..f967f9b 100644 (file)
@@ -462,11 +462,9 @@ static const struct rpmfcTokens_s const rpmfcTokens[] = {
   { "troff or preprocessor input",     RPMFC_MANPAGE|RPMFC_INCLUDE },
   { "GNU Info",                        RPMFC_MANPAGE|RPMFC_INCLUDE },
 
-  { "perl script text",                RPMFC_PERL|RPMFC_INCLUDE },
+  { "perl ",                   RPMFC_PERL|RPMFC_INCLUDE },
   { "Perl5 module source text", RPMFC_PERL|RPMFC_MODULE|RPMFC_INCLUDE },
 
-  { " /usr/bin/python",                RPMFC_PYTHON|RPMFC_INCLUDE },
-
   /* XXX "a /usr/bin/python -t script text executable" */
   /* XXX "python 2.3 byte-compiled" */
   { "python ",                 RPMFC_PYTHON|RPMFC_INCLUDE },
@@ -670,7 +668,6 @@ rpmds rpmfcRequires(rpmfc fc)
 static int rpmfcSCRIPT(rpmfc fc)
 {
     const char * fn = fc->fn[fc->ix];
-    const char * bn;
     rpmds ds;
     char buf[BUFSIZ];
     FILE * fp;
@@ -727,13 +724,6 @@ static int rpmfcSCRIPT(rpmfc fc)
            ds = rpmdsFree(ds);
        }
 
-       /* Set color based on interpreter name. */
-       bn = basename(s);
-       if (rstreq(bn, "perl"))
-           fc->fcolor->vals[fc->ix] |= RPMFC_PERL;
-       else if (rstreqn(bn, "python", sizeof("python")-1))
-           fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
-
        break;
     }