#!/bin/sh
# Create a temporary directory, much like mktemp -d does.
-# Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# Copyright (C) 2007-2010 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
base_template=`echo "$template"|sed 's/XX*$//'`
# Calculate how many X's we've just removed.
- nx=`expr length "$template" - length "$base_template"`
+ template_length=`echo "$template" | wc -c`
+ nx=`echo "$base_template" | wc -c`
+ nx=`expr $template_length - $nx`
err=
i=1