From 17581c9afcb38ab5b60786b559c5e4a547477e85 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 20 Sep 2006 14:23:22 +0000 Subject: [PATCH] mkpatch: Turn warnings on (-w), and fix them. Print a usage message on missing command line parameters. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4162 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 ++ mkpatch/mkpatch.pl | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 09aaf3f5..ac9e4a44 100644 --- a/CHANGES +++ b/CHANGES @@ -49,6 +49,8 @@ lm_sensors CHANGES file Program i2cdump: Restore bank after bank switching Add new mode W (read word on even register addresses) Program mkpatch: Fix typo breaking f71805f + Turn warnings on (-w), and fix them + Print a usage message on missing command line parameters Program pwmconfig: Use mktemp instead of tempfile Program sensors: No error messages on missing w83792d fan4-7 (Yuan Mu) Add smsc47m192 support diff --git a/mkpatch/mkpatch.pl b/mkpatch/mkpatch.pl index 9ff3ff5a..adaf4cad 100755 --- a/mkpatch/mkpatch.pl +++ b/mkpatch/mkpatch.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w # mkpatch - Create patches against the Linux kernel # Copyright (C) 1999 Frodo Looijaard @@ -1250,17 +1250,25 @@ EOF } +sub usage +{ + print "Usage: $0 package_root kernel_root\n"; + exit 1; +} + # Main function sub main { my ($package_root,$kernel_root,%files,%includes,$package_file,$kernel_file); my ($diff_command,$dummy,$data0,$data1,$sedscript,$version_string); - # --> Read the command-lineo + # --> Read the command-line $package_root = $ARGV[0]; + usage() unless defined $package_root; die "Package root `$package_root' is not found\n" unless -d "$package_root/mkpatch"; $kernel_root = $ARGV[1]; + usage() unless defined $kernel_root; die "Kernel root `$kernel_root' is not found\n" unless -f "$kernel_root/Rules.make"; @@ -1279,7 +1287,7 @@ sub main while () { ($data0,$data1) = /(\S+)\s+(\S+)/; $includes{$data0} = $data1; - $sedscript .= 's,(#\s*include\s*)'.$data0.'(\s*),\1'."$data1".'\2, ; '; + $sedscript .= 's,(#\s*include\s*)'.$data0.'(\s*),$1'."$data1".'$2, ; '; } close INPUT;