#!/bin/csh -f

# Create a new counter for web hits in the file
# ~/.www/counts/$1:r.txt.  With flag -n, will only act if a counter
# with this name does not already exist.

if ($#argv < 1) then
  echo "Usage: wwwnewcount [-n] countername"
  exit 2
endif

cd ~/.www/counts

if ("$1" == "-n") then
  if (-e $2:r.txt) exit 1
  shift
endif

echo -n 1 > $1:r.txt
chmod go+rw $1:r.txt
