On Tue, Mar 17, 2009 at 04:57:09PM +0100, Dean McNamee wrote:
> It could be much
> easier, so here is my script.  You run it something like genc
> chrome/common/my_new_file.h > my_new_file.h  I also use it for .cc
> files and just remove the guards.

This is indeed a useful approach that I've seen used with other
projects.  One change I'd suggest is having the copyright year generated
when the script is run.

> #!/bin/sh
> 
> if [ $# -ne 1 ]; then
>   echo "usage: genc base/pants.h"
>   exit 1
> fi

  DATE=`date +%Y`
> GUARD=`echo "$1"_ | tr '[:lower:]./-' '[:upper:]___'`
> 
> cat <<EOF
  // Copyright (c) $DATE The Chromium Authors. All rights reserved.
> // Use of this source code is governed by a BSD-style license that can be
> // found in the LICENSE file.
> 
> #ifndef $GUARD
> #define $GUARD
> 
> #endif  // $GUARD
> EOF

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>

Attachment: signature.asc
Description: Digital signature

Reply via email to