#!/bin/csh setenv LANG en_US.UTF-8 setenv LC_COLLATE en_US.UTF-8 set months=(January February March April May June July August September October November December) set ROOTURL="http://bachlab.balbach.net/" set REVIEWPATH="cool-reviews/" set INDEXPATH="cool-index/" # Set to number of core arguments before optional groups set NUMBARG=4 # To add a new Category: # new set, new echo, new case switch set HISTORYAMERICAN="historyamerican.html" set HISTORYWORLD="historyworld.html" set HISTORYMODERN="historymodern.html" set HISTORY1500TO1914="history1500-1914.html" set HISTORYMEDIEVAL="historymedieval.html" set HISTORYCLASSIC="historyclassic.html" set FICTION21ST="fiction21st.html" set FICTION20TH="fiction20th.html" set FICTION19TH="fiction19th.html" set FICTIONPRE1800="fictionpre1800.html" set BIOGRAPHY="biography.html" set TRAVEL="travel.html" set SCIENCEANDNATURE="scienceandnature.html" set GLOBALISSUES="globalissues.html" set DARKTOURISM="darktourism.html" set SLAVERY="slavery.html" set HOLOCAUST="holocaust.html" set ALL2010="coolread7.html" set ALL2009="coolread6.html" set ALL2008="coolread5.html" set ALL2007="coolread4.html" set ALL2006="coolread3.html" set ALL2005="coolread2.html" set ALL2004="coolreading" #Is there no argument? if ($#argv < $NUMBARG + 1) then echo "" echo "Usage: new \042Book Title\042 \042First Last\042 \042Edition\042 ID cat1 cat2 cat3 cat4 cat5" echo "" echo "ID = Date Read-Date Published-Pages-Cost" echo "example: Date Read = 20080705 (2008, July 5th) - 8-digit" echo " Date Pub = 1886 - 4 digit" echo " Pages = 0345 - 4 digit" echo " Cost = 009 (9 dollars, round nearest) - 3 digit" echo " ID: 20080705-1886-0345-009" echo "" echo "Categories: historyamerican" echo " historyworld" echo " historymodern" echo " history1500-1914" echo " historymedieval" echo " historyclassic" echo " fiction21st" echo " fiction20th" echo " fiction19th" echo " fictionpre1800" echo " biography" echo " travel" echo " sciencenature" echo " globalissues" echo " darktourism" echo " slavery" echo " holocaust" echo " 2010" echo " 2009" echo " 2008" echo " 2007" echo " 2006" echo " 2005" echo " 2004" exit(1) endif set k = 1 set g = 1 set group=(0 0 0 0 0 0) while ($#argv) switch ($k) case 1: set title = `echo "|$argv[1]|"|awk -F"|" '{printf("%s",$2)}'` set filename = $REVIEWPATH`echo "|$argv[1]|"|awk -F"|" '{printf("%s.html",$2)}'` breaksw case 2: set author = `echo "|$argv[1]|"|awk -F"|" '{printf("%s",$2)}'` breaksw case 3: set edition = `echo "|$argv[1]|"|awk -F"|" '{printf("%s",$2)}'` breaksw case 4: set dateread = `echo "$argv[1]"|awk -F"-" '{split($0,ida);printf("%s",ida[1])}'` set datepub = `echo "$argv[1]"|awk -F"-" '{split($0,ida);printf("%s",ida[2])}'` set pages = `echo "$argv[1]"|awk -F"-" '{split($0,ida);printf("%s",ida[3])}'` set cost = `echo "$argv[1]"|awk -F"-" '{split($0,ida);printf("%s",ida[4])}'` set id = $argv[1] set yearread = `echo $dateread|awk '{printf("%s\n",substr($0,1,4))}'` set monthread = `echo $dateread|awk '{printf("%s\n",substr($0,5,2))}'` set dayread = `echo $dateread|awk '{printf("%s\n",substr($0,7,2))}'` if ($monthread > 0 && $monthread <= 12) then set monthreadname=$months[$monthread] else set monthreadname="MONTHREADNAME-ERROR" endif echo $monthreadname breaksw case [56789]: set group[$g] = $1 @ g++ breaksw case 10: echo "ERROR: NUMBER OF ARGUMENTS EXCEEDS BOUNDS" exit breaksw endsw shift @ k++ end echo "

$title


$2 ($datepub)
$edition
$monthreadname $dayread, $yearread
" echo"" echo "
" echo "
" echo "" if ($#argv > $NUMBARG) then @ numberofgroups = $#argv - $NUMBARG @ i = 1 @ j = NUMBARG$ + $i while ($i <= $numberofgroups) switch ($argv[$j]) case historyamerican: breaksw case historyworld: breaksw case historymodern: breaksw case history1500-1914: breaksw case historymedieval: breaksw case historyclassic: breaksw case fiction21st: breaksw case fiction20th: breaksw case fiction19th: echo "
" echo "|$ROOTURL|$INDEXPATH|$FICTION19TH" | awk -F"|" '{printf("Category: Fiction 19th Century\n",$2,$3,$4)}' set group[$i] = fiction19th breaksw case fictionpre1800: breaksw case biography: breaksw case travel: echo "
" echo "|$ROOTURL|$INDEXPATH|$TRAVEL" | awk -F"|" '{printf("Category: Travel\n",$2,$3,$4)}' set group[$i] = travel breaksw case sciencenature: breaksw case globalissues: breaksw case darktourism: breaksw case holocaust: breaksw case slavery: breaksw case 2010: breaksw case 2009: breaksw case 2008: breaksw case 2007: breaksw case 2006: breaksw case 2005: breaksw case 2004: breaksw case 2003: breaksw default: echo "ERROR: Unknown Group" echo $argv[$j] breaksw endsw @ i++ @ j = $NUMBARG + $i end endif echo "%s (%s)\n",$2,$6,$5,$3,$4)}' echo "|$author" | awk -F"|" '{printf("00AUTHOR | %s\n",$2)}' echo "|$title" | awk -F"|" '{printf("00TITLE | %s\n",$2)}' echo "|$edition" | awk -F"|" '{printf("00EDITION | %s\n",$2)}' echo "|$id" | awk -F"|" '{printf("00ID | %s\n",$2)}' @ i = 1 while ($group[$i] != 0) echo "|$group[$i]" | awk -F"|" '{printf("00GROUP | %s\n",$2)}' @ i++ end echo "\055\055>"