1. juster
  2. passcard

Commits

juster  committed 8df3277

Change to K&R style.

  • Participants
  • Parent commits 3c6647d
  • Branches default

Comments (0)

Files changed (1)

File passcard.awk

View file
  • Ignore whitespace
 	nums = "0123456789"
 }
 
-function randidx (len) {
+function randidx(len)
+{
 	return int(rand() * len) + 1
 }
 
-function header () {
+function header()
+{
 	end = length(hdr)
-	for (i=2; i<=end; i++) {
+	for(i=2; i<=end; i++){
 		j = randidx(i)
 		tmp = hdr[i]
 		hdr[i] = hdr[j]
 	}
 
 	outstr = ""
-	for (i=1; i<=end; i++) {
+	for(i=1; i<=end; i++){
 		outstr = outstr hdr[i]
 	}
 	return outstr
 }
 
 {
-	if($0) { srand($0) }
-	else { srand() }
+	if($0){
+        srand($0)
+    }else{
+        srand()
+    }
 
 	print "  " header()
 	print " +-----------------------------"
-	for (i=1; i<=9; i++) {
-		line = "" i "|"
-		for (j=0; j<29; j++) {
-			if(usedigits && i>5) { charset = nums }
-			else if(usesyms && j%2 == 0) { charset = alphanumsym }
-			else { charset = alphanum }
+	for(i=1; i<=9; i++){
+		line = i "|"
+		for(j=0; j<29; j++){
+            charset = (usedigits && i > 5 ? nums :
+                usesyms && j % 2 == 0 ? alphanumsym :
+                alphanum)
 			setlen = length(charset)
 			line = line substr(charset, randidx(setlen), 1)
 		}