Fixed a problem with updatenext, and allowed shortcuts for the main options.
authorlbatlle@npdl268.bpo.hp.com
Wed, 25 Oct 2006 19:37:54 +0200
changeset 5 131f3e87f9bf
parent 4 b3a6e3ad6dc5
child 6 0193c946ee18
Fixed a problem with updatenext, and allowed shortcuts for the main options.
bug
--- a/bug	Tue Oct 24 20:39:28 2006 +0200
+++ b/bug	Wed Oct 25 19:37:54 2006 +0200
@@ -119,10 +119,10 @@
 
 function addfile
 {	
-	ID=`grep "^Id:" $1 | head -n 1 | cut -d : -f 2 | string2db`
-	SUBJECT=`grep "^Subject:" $1 | head -n 1 | cut -d : -f 2 | string2db`
-	STATE=`grep "^State:" $1 | head -n 1 | cut -d : -f 2 | string2db`
-	PRIORITY=`grep "^Priority:" $1 | head -n 1 | cut -d : -f 2 | string2db`
+	ID=`grep "^Id:" $1 | head -n 1 | cut -d : -f 2- | string2db`
+	SUBJECT=`grep "^Subject:" $1 | head -n 1 | cut -d : -f 2- | string2db`
+	STATE=`grep "^State:" $1 | head -n 1 | cut -d : -f 2- | string2db`
+	PRIORITY=`grep "^Priority:" $1 | head -n 1 | cut -d : -f 2- | string2db`
 
 	if ( [ "x$SUBJECT" == "" ] || [ "x$PRIORITY" == "" ] ); then
 		echo "Error in ticket: subject or priority." 2>&1
@@ -136,7 +136,15 @@
 	DESCRIPTION=`tail -n $TOTAIL $1 | text2db | trimlastdbNL`
 
 	echo "$ID	$PRIORITY	$STATE	$SUBJECT	$DESCRIPTION" >> $BUG_PROJECT
-	updatenext $((ID + 1))
+
+	# Update the next ID number
+	NEXT=`getnext`
+	if [ $NEXT -gt $ID ]; then
+		updatenext $((NEXT + 1))
+	else
+		updatenext $((ID + 1))
+	fi
+		
 	return 0
 }
 
@@ -283,25 +291,25 @@
 fi
 
 case "$CMD" in
-	add)
+	a*)
 		add || exit 1
 		;;
-	list)
+	l*)
 		list || exit 1
 		;;
-	view)
+	v*)
 		view $2 || exit 1
 		;;
-	project)
+	p*)
 		echo Project: $BUG_PROJECT
 		;;
-	delete)
+	del*)
 		delete $2 || exit 1
 		;;
 	create)
 		create || exit 1
 		;;
-	edit)
+	e*)
 		edit $2 || exit 1
 		;;
 	*)