# This file is part of GNU Bison
 
-# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2012 Free Software
+# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015 Free Software
 # Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Usage: extexi input-file.texi ... -- [FILES to extract]
+# Usage: extexi [OPTION...] input-file.texi ... -- [FILES to extract]
 
 # Look for @example environments preceded with lines such as:
 #
 
 use strict;
 
+# Whether we generate synclines.
+my $synclines = 0;
+
 # normalize($block)
 # -----------------
 # Remove Texinfo mark up.
             {
               # Bison supports synclines, but not Flex.
               $input .= sprintf ("#line %s \"$in\"\n", $. + 1)
-                if $file =~ /\.[chy]*$/;
+                if $synclines && $file =~ /\.[chy]*$/;
               next;
             }
           elsif (/^\@end (small)?example$/)
 my $seen_dash = 0;
 for my $arg (@ARGV)
 {
-  if ($arg eq '--')
+  if ($seen_dash)
+    {
+      use File::Basename;
+      $file_wanted{basename($arg)} = $arg;
+    }
+  elsif ($arg eq '--')
     {
       $seen_dash = 1;
     }
-  elsif ($seen_dash)
+  elsif ($arg eq '--synclines')
     {
-      use File::Basename;
-      $file_wanted{basename($arg)} = $arg;
+      $synclines = 1;
     }
   else
     {