Usually when I create a new file, I just copy some old one, but then I
get the copyright date wrong, or forget to update the include guards.
I just fixed a lot of incorrect include guards in our code, which were
clearly mistakes from manually typing out the names.  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.

#!/bin/sh

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

GUARD=`echo "$1"_ | tr '[:lower:]./-' '[:upper:]___'`

cat <<EOF
// Copyright (c) 2009 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

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: [email protected] 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to