Skip to content
This repository has been archived by the owner on Oct 31, 2022. It is now read-only.

Commit

Permalink
A few small improvements to get to v1.1
Browse files Browse the repository at this point in the history
They are:
 - Put the version number in the usage string and the man page
 - Improved the efficiency of pulling the command out of argv
 - Check for /dev/urandom via autoconf so that you don't build
   the program it it's not going to work anyway.
  • Loading branch information
rwtodd committed Jun 20, 2020
1 parent 674c742 commit 70205fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
9 changes: 7 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
N E W S
-------

2020-06-20

Version 1.1 Put the program version in the usage string. Also
improved argument handling efficiency.

2020-06-19

Put encryption and rekey functions into the program. Added a
man page with example usage.
Version 1.0 Put encryption and rekey functions into the program.
Added a man page with example usage.

2020-06-17

Expand Down
8 changes: 6 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([spritz], [1.0], [https://github.com/rwtodd/spritz_cipher])
AC_INIT([spritz], [1.1], [https://github.com/rwtodd/spritz_cipher])
AC_CONFIG_SRCDIR([src/b64.c])
AC_CONFIG_HEADERS([src/config.h])

Expand Down Expand Up @@ -36,5 +36,9 @@ AC_CHECK_FUNCS([memset],
[],
AC_MSG_ERROR([Missing required stdlib function!]))

AC_CONFIG_FILES([Makefile])
# we need /dev/urandom to exist...
AC_CHECK_FILE([/dev/urandom],[],
AC_MSG_ERROR([This program requires /dev/urandom to exist on your system.]))

AC_CONFIG_FILES([Makefile spritz.1])
AC_OUTPUT
2 changes: 1 addition & 1 deletion spritz.1 → spritz.1.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH spritz "1" "19 February 2020" "" "Utility"
.TH spritz "1" "19 February 2020" "@PACKAGE_STRING@" "Utility"

.SH NAME
spritz \- compute hashes and encrypt via the spritz streaming cipher
Expand Down
10 changes: 6 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
#include <string.h>
#include <stdio.h>

Expand All @@ -16,11 +17,11 @@ main (int argc, char **argv)

if (argc >= 2)
{
/* peel off the command, and shift up the rest of the args */
/* remove the command from the argument list */
cmd = argv[1];
for (int i = 2; i < argc; ++i)
argv[i - 1] = argv[i];
argv[1] = argv[0];
--argc;
++argv;
}

if (!strcmp (cmd, "hash"))
Expand All @@ -34,7 +35,8 @@ main (int argc, char **argv)
/* print usage if we didn't find a command to run */
if (cmd_func == NULL)
{
fputs ("Usage: spritz hash [-h] [-s size] [file1 file2 ...]\n"
fputs (PACKAGE_STRING "\n", stderr);
fputs ("Usage: spritz hash [-h] [-s size] [file1 file2 ...]\n"
" spritz crypt [-d] [-p pwd] [file]\n"
" spritz crypt -n [-p pwd] [file1 file2 ...]\n"
" spritz rekey [-o oldpwd] [-n newpwd] file1 file2 ...\n\n",
Expand Down

0 comments on commit 70205fd

Please sign in to comment.