--- /dev/null
+#!/bin/bash
+
+# Comptage des lignes de code.
+
+# find $1 -print0 | xargs -0 touch
+# That terminates each filename with \000 (character 0) and instructs xargs to expect the filenames terminated by \000
+#
+# -print0
+# True; print the full file name on the standard output, followed
+# by a null character (instead of the newline character that
+# -print uses). This allows file names that contain newlines or
+# other types of white space to be correctly interpreted by pro‐
+# grams that process the find output. This option corresponds to
+# the -0 option of xargs.
+
+echo -n "Lignes de code: "
+find . \
+ \( \
+ -name '*.c' -o \
+ -name '*.C' -o \
+ -name '*.h' -o \
+ -name '*.H' -o \
+ -name '*.cxgate' \
+ \) \
+ -print0 | xargs -0 cat | wc -l
+
+echo -n "Fichiers: "
+find . \
+ \( \
+ -name '*.c' -o \
+ -name '*.C' -o \
+ -name '*.h' -o \
+ -name '*.H' -o \
+ -name '*.cxgate' \
+ \) \
+ -print | wc -l
--- /dev/null
+#!/bin/bash
+
+VCS_SUPPORTED="GIT, Subversion or Mercurial"
+
+print_usage()
+{
+ echo "$(basename $0) -- checkout for version control (${VCS_SUPPORTED})."
+ echo "Usage: $(basename $0) [OPTIONS...]"
+}
+
+if [ "x${1}" = "x--help" ]; then
+ print_usage
+ exit 1
+fi
+
+if git diff 1> /dev/null 2>&1; then
+ git checkout "$@"
+elif svn diff 1> /dev/null 2>&1; then
+ svn co "$@"
+elif hg status 1> /dev/null 2>&1; then
+ hg update "$@"
+else
+ echo "Not a ${VCS_SUPPORTED} repository"
+ exit 1
+fi
--- /dev/null
+#!/bin/bash
+set -o errexit
+
+PROG_NAME=$(basename $0)
+
+# Version control checkout command for all subrepositories.
+# For use with git-remote-hg:
+# http://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/
+
+# Uncomment to have verbose debug output
+debug=1
+
+print_usage()
+{
+ echo "$(basename $0) -- Version control subrepository checkout"
+ echo "Usage: $(basename $0) [OPTIONS...]"
+ echo "Options:"
+ echo " -h display this help and exit"
+ echo " -m display only subrepositories with local modifications"
+}
+
+display_subrepo_name()
+{
+ COLOR_BLUE='\033[1;34m'
+ COLOR_NORMAL='\033[0m'
+
+ echo -en "${COLOR_BLUE}"
+ echo "${dest}"
+ echo -en "${COLOR_NORMAL}"
+}
+
+if [ "x${1}" = "x--help" ]; then
+ print_usage
+ exit 1
+fi
+
+if [ ${#} -eq 0 ]; then
+ echo "${PROG_NAME}: Missing branch name."
+ echo "Try \`${PROG_NAME} --help' for more information."
+ exit 1
+elif [ ${#} -gt 1 ]; then
+ echo "${PROG_NAME}: Too many arguments."
+ echo "Try \`${PROG_NAME} --help' for more information."
+ exit 1
+fi
+
+branch=${1}
+
+if [ ! -f .hgsub ]; then
+ echo "No Mercurial subrepositories found"
+ exit 1
+fi
+
+checkout_branch()
+{
+ if [ ${#} -eq 0 ]; then
+ echo "${PROG_NAME}: Missing branch name."
+ exit 1
+ fi
+
+ local branch=${1}
+
+ if vb | egrep -q "^\s+${branch}$" ; then
+ # Branch found
+ vco ${branch} 1> /dev/null 2>&1
+ if [ -n "${debug}" ]; then
+ echo "Changing branch"
+ echo # Blank line
+ fi
+ elif vb | egrep -q "^\**\s+${branch}$" ; then
+ if [ -n "${debug}" ]; then
+ echo "Already on branch"
+ echo # Blank line
+ fi
+ else
+ if [ -n "${debug}" ]; then
+ echo "Branch not found"
+ echo # Blank line
+ fi
+ fi
+}
+
+# Switch branch on main assembly
+if [ -n "${debug}" ]; then
+ dest="Top assembly"
+ display_subrepo_name
+fi
+checkout_branch ${branch}
+
+# Read lines from .hgsub
+while read sub; do
+ # Remove CR (DOS)
+ sub="${sub//$'\r'/}"
+
+ if [ "${sub}" != "" ]; then
+ # Get subrepository local alias or label
+ dest="${sub// =*}"
+
+ # Get project ID (example: S0289)
+ id=$(echo ${sub} | sed "s/.*\(S[0-9][0-9][0-9][0-9]\).*/\1/")
+
+ if [ -n "${debug}" ]; then
+ display_subrepo_name
+ fi
+
+ if [ -d "${dest}" ]; then
+ pushd "${dest}" 1> /dev/null
+ checkout_branch ${branch}
+ popd 1> /dev/null
+ else
+ display_subrepo_name
+ echo "Error: missing local subrepository"
+ echo # Blank line
+ fi
+ fi
+done < .hgsub