Index: zcrypt.c
===================================================================
--- zcrypt.c	(revision 4133e34e065efa85f3a54a16eea6bdd8d18c2845)
+++ zcrypt.c	(revision f7f35c09cbd35b4b1ed2a47b434aa8a0cbbded5f)
@@ -50,6 +50,6 @@
 char *BuildArgString(char **argv, int start, int end);
 int do_encrypt(char *keystring, int zephyr, char *class, char *instance,
-	  ZWRITEOPTIONS *zoptions, char* keyfile);
-void do_decrypt(char *keystring);
+          ZWRITEOPTIONS *zoptions, char* keyfile);
+int do_decrypt(char *keystring);
 
 #define M_NONE            0
@@ -94,86 +94,86 @@
         /* Zephyr encrypt */
         mode = M_ZEPHYR_ENCRYPT;
-	break;
+        break;
       case 'D':
         /* Decrypt */
-	mode = M_DECRYPT;
-	break;
+        mode = M_DECRYPT;
+        break;
       case 'E':
-	/* Encrypt */
-	mode = M_ENCRYPT;
-	break;
+        /* Encrypt */
+        mode = M_ENCRYPT;
+        break;
       case 'R':
-	/* Randomize the keyfile */
-	mode = M_RANDOMIZE;
-	break;
+        /* Randomize the keyfile */
+        mode = M_RANDOMIZE;
+        break;
       case 'S':
-	/* Set a new key value from stdin */
-	mode = M_SETKEY;
-	break;
+        /* Set a new key value from stdin */
+        mode = M_SETKEY;
+        break;
       case 'F':
-	/* Specify the keyfile explicitly */
-	if (fname != NULL) error = TRUE;
-	fname = optarg;
-	break;
+        /* Specify the keyfile explicitly */
+        if (fname != NULL) error = TRUE;
+        fname = optarg;
+        break;
       case 'c':
-	/* Zwrite/zcrypt: class name */
-	if (class != NULL) error = TRUE;
-	class = optarg;
-	break;
+        /* Zwrite/zcrypt: class name */
+        if (class != NULL) error = TRUE;
+        class = optarg;
+        break;
       case 'i':
-	/* Zwrite/zcrypt: instance name */
-	if (instance != NULL) error = TRUE;
-	instance = optarg;
-	break;
+        /* Zwrite/zcrypt: instance name */
+        if (instance != NULL) error = TRUE;
+        instance = optarg;
+        break;
       case 'a':
-	/* Zwrite: authenticate (default) */
-	zoptions.flags &= ~ZWRITE_OPT_NOAUTH;
-	break;
+        /* Zwrite: authenticate (default) */
+        zoptions.flags &= ~ZWRITE_OPT_NOAUTH;
+        break;
       case 'd':
-	/* Zwrite: do not authenticate */
-	zoptions.flags |= ZWRITE_OPT_NOAUTH;
-	break;
+        /* Zwrite: do not authenticate */
+        zoptions.flags |= ZWRITE_OPT_NOAUTH;
+        break;
       case 'v':
-	/* Zwrite: verbose */
-	zoptions.flags |= ZWRITE_OPT_VERBOSE;
-	break;
+        /* Zwrite: verbose */
+        zoptions.flags |= ZWRITE_OPT_VERBOSE;
+        break;
       case 'q':
-	/* Zwrite: quiet */
-	zoptions.flags |= ZWRITE_OPT_QUIET;
-	break;
+        /* Zwrite: quiet */
+        zoptions.flags |= ZWRITE_OPT_QUIET;
+        break;
       case 't':
-	/* Zwrite: no expand tabs (ignored) */
-	break;
+        /* Zwrite: no expand tabs (ignored) */
+        break;
       case 'l':
-	/* Zwrite: ignore '.' on a line by itself (ignored) */
-	zoptions.flags |= ZCRYPT_OPT_IGNOREDOT;
-	break;
+        /* Zwrite: ignore '.' on a line by itself (ignored) */
+        zoptions.flags |= ZCRYPT_OPT_IGNOREDOT;
+        break;
       case 'u':
-	/* Zwrite: urgent message */
-	instance = "URGENT";
-	break;
+        /* Zwrite: urgent message */
+        instance = "URGENT";
+        break;
       case 'o':
-	/* Zwrite: ignore zephyr variables zwrite-class, zwrite-inst, */
-	/*         zwrite-opcode */
-	zoptions.flags |= ZWRITE_OPT_IGNOREVARS;
-	break;
+        /* Zwrite: ignore zephyr variables zwrite-class, zwrite-inst, */
+        /*         zwrite-opcode */
+        zoptions.flags |= ZWRITE_OPT_IGNOREVARS;
+        break;
       case 'n':
-	/* Zwrite: prevent PING message (always used) */
-	break;
+        /* Zwrite: prevent PING message (always used) */
+        break;
       case 's':
-	/* Zwrite: signature */
-	zoptions.flags |= ZWRITE_OPT_SIGNATURE;
-	zoptions.signature = optarg;
-	break;
+        /* Zwrite: signature */
+        zoptions.flags |= ZWRITE_OPT_SIGNATURE;
+        zoptions.signature = optarg;
+        break;
       case 'f':
-	/* Zwrite: file system specification (ignored) */
-	break;
+        /* Zwrite: file system specification (ignored) */
+        break;
       case 'm':
-	/* Message on rest of line*/
-	messageflag = TRUE;
-	break;
+        /* Message on rest of line*/
+        messageflag = TRUE;
+        break;
       case '?':
-	error = TRUE;
-	break;
+        error = TRUE;
+        break;
     }
     if (error || messageflag)
@@ -227,11 +227,11 @@
       FILE *fkey = fopen(fname, "w");
       if (!fkey)
-	printf("Could not open key file for writing: %s\n", fname);
+        printf("Could not open key file for writing: %s\n", fname);
       else
       {
-	char string[100];
-	fputs(fkey, string);
-	fclose(fkey);
-	}
+        char string[100];
+        fputs(fkey, string);
+        fclose(fkey);
+        }
  */
       fprintf(stderr, "Feature not yet implemented.\n");
@@ -245,6 +245,6 @@
       if (isatty(0))
       {
-	printf("Enter new key: ");
-	/* Really should read without echo!!! */
+        printf("Enter new key: ");
+        /* Really should read without echo!!! */
       }
       if(!fgets(newkey, MAX_KEY - 1, stdin)) {
@@ -255,18 +255,18 @@
       fkey = fopen(fname, "w");
       if (!fkey)
-	fprintf(stderr, "Could not open key file for writing: %s\n", fname);
+        fprintf(stderr, "Could not open key file for writing: %s\n", fname);
       else
       {
-	if (fputs(newkey, fkey) != strlen(newkey) || putc('\n', fkey) != '\n')
-	{
-	  fprintf(stderr, "Error writing to key file.\n");
-	  fclose(fkey);
+        if (fputs(newkey, fkey) != strlen(newkey) || putc('\n', fkey) != '\n')
+        {
+          fprintf(stderr, "Error writing to key file.\n");
+          fclose(fkey);
           exit(1);
-	}
-	else
-	{
-	  fclose(fkey);
-	  fprintf(stderr, "Key update complete.\n");
-	}
+        }
+        else
+        {
+          fclose(fkey);
+          fprintf(stderr, "Key update complete.\n");
+        }
       }
     }
@@ -276,21 +276,21 @@
       FILE *fkey = fopen(fname, "r");
       if (!fkey) {
-	fprintf(stderr, "Could not open key file: %s\n", fname);
+        fprintf(stderr, "Could not open key file: %s\n", fname);
         exit(1);
       }
       else
       {
-	char keystring[MAX_KEY];
-	if(!fgets(keystring, MAX_KEY-1, fkey)) {
+        char keystring[MAX_KEY];
+        if(!fgets(keystring, MAX_KEY-1, fkey)) {
           fclose(fkey);
           fprintf(stderr, "Error reading key file.\n");
           return 1;
         }
-	if (mode == M_ZEPHYR_ENCRYPT || mode == M_ENCRYPT)
-	  do_encrypt(keystring, (mode == M_ZEPHYR_ENCRYPT), class, instance,
-		     &zoptions, fname);
-	else
-	  do_decrypt(keystring);
-	fclose(fkey);
+        if (mode == M_ZEPHYR_ENCRYPT || mode == M_ENCRYPT)
+          do_encrypt(keystring, (mode == M_ZEPHYR_ENCRYPT), class, instance,
+                     &zoptions, fname);
+        else
+          do_decrypt(keystring);
+        fclose(fkey);
       }
     }
@@ -329,8 +329,8 @@
       /* Add a space, if not the first argument */
       if (i != start)
-	*ptr++ = ' ';
+        *ptr++ = ' ';
       /* Copy argv[i], leaving ptr pointing to the '\0' copied from temp */
       while ((*ptr = *temp++))
-	ptr++;
+        ptr++;
     }
   }
@@ -379,14 +379,14 @@
       if (!fgets(buffer, MAX_BUFF - 3, fsearch)) break;
       for (i = 0; i < numsearch; i++)
-	if (strncasecmp(varname[i], buffer, length[i]) == 0)
-	{
-	  int j;
-	  for (j = length[i]; buffer[j] == ' '; j++)
-	    ;
-	  strcpy(result[i], &buffer[j]);
-	  if (*result[i])
-	    if (result[i][strlen(result[i])-1] == '\n')
-	      result[i][strlen(result[i])-1] = '\0';
-	}
+        if (strncasecmp(varname[i], buffer, length[i]) == 0)
+        {
+          int j;
+          for (j = length[i]; buffer[j] == ' '; j++)
+            ;
+          strcpy(result[i], &buffer[j]);
+          if (*result[i])
+            if (result[i][strlen(result[i])-1] == '\n')
+              result[i][strlen(result[i])-1] = '\0';
+        }
     }
 
@@ -396,6 +396,6 @@
       if (*result[i])
       {
-	keyfile = result[i];
-	break;
+        keyfile = result[i];
+        break;
       }
 
@@ -410,7 +410,7 @@
       keyfile = (char *)malloc(strlen(temp) + 1);
       if (keyfile)
-	strcpy(keyfile, temp);
+        strcpy(keyfile, temp);
       else
-	fprintf(stderr, "Memory allocation error.\n");
+        fprintf(stderr, "Memory allocation error.\n");
     }
     
@@ -488,5 +488,5 @@
     {
       if (dup2(fildes[0], STDIN_FILENO) != STDIN_FILENO)
-	exit(0);
+        exit(0);
       close(fildes[0]);
     }
@@ -536,5 +536,5 @@
    if zephyr is set. */
 int do_encrypt(char *keystring, int zephyr, char *class, char *instance,
-	  ZWRITEOPTIONS *zoptions, char* keyfile)
+          ZWRITEOPTIONS *zoptions, char* keyfile)
 {
   des_key_schedule schedule;
@@ -566,30 +566,30 @@
       /* tty input, so show the "Type your message now..." message */
       if (zoptions->flags & ZCRYPT_OPT_IGNOREDOT)
-	printf("Type your message now.  End with the end-of-file character.\n");
+        printf("Type your message now.  End with the end-of-file character.\n");
       else
-	printf("Type your message now.  End with control-D or a dot on a line by itself.\n");
+        printf("Type your message now.  End with control-D or a dot on a line by itself.\n");
       use_buffer = TRUE;
       if ((inptr = inbuff = (char *)malloc(MAX_RESULT)) == NULL)
       {
-	fprintf(stderr, "Memory allocation error\n");
-	return FALSE;
+        fprintf(stderr, "Memory allocation error\n");
+        return FALSE;
       }
       while (inptr - inbuff < MAX_RESULT - MAX_LINE - 20)
       {
-	if (!fgets(inptr, MAX_LINE, stdin))
+        if (!fgets(inptr, MAX_LINE, stdin))
           return FALSE;
-	if (inptr[0])
-	{
-	  if (inptr[0] == '.' && inptr[1] == '\n' && 
-	      !(zoptions->flags & ZCRYPT_OPT_IGNOREDOT))
-	  {
-	    inptr[0] = '\0';
-	    break;
-	  }
-	  else
-	    inptr += strlen(inptr);
-	}
-	else
-	  break;
+        if (inptr[0])
+        {
+          if (inptr[0] == '.' && inptr[1] == '\n' && 
+              !(zoptions->flags & ZCRYPT_OPT_IGNOREDOT))
+          {
+            inptr[0] = '\0';
+            break;
+          }
+          else
+            inptr += strlen(inptr);
+        }
+        else
+          break;
       }
       num_blocks = (inptr - inbuff + 7) / 8;
@@ -604,5 +604,5 @@
       fprintf(stderr, "Could not run zwrite\n");
       if (freein && inbuff)
-	free(inbuff);
+        free(inbuff);
       return FALSE;
     }
@@ -619,17 +619,17 @@
       if (num_blocks > 1)
       {
-	size = 8;
-	memcpy(input, inptr, size);
-	inptr += 8;
-	num_blocks--;
+        size = 8;
+        memcpy(input, inptr, size);
+        inptr += 8;
+        num_blocks--;
       }
       else if (num_blocks == 1)
       {
-	size = last_block_size;
-	memcpy(input, inptr, size);
-	num_blocks--;
+        size = last_block_size;
+        memcpy(input, inptr, size);
+        num_blocks--;
       }
       else
-	size = 0;
+        size = 0;
     }
     else
