enc.sh: add prompt for PASS, if it wasn't supplied
[cmccabe-bin] / random-word.c
index c75047b..d751d06 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <time.h>
+#include <sys/time.h>
 
 #define DICT "/usr/share/dict/linux.words"
 #define STARTING_SZ 8192
@@ -91,7 +91,10 @@ int main(void)
        FILE *fp;
        const char *word;
        struct dict *dict;
-       srandom(time(NULL));
+       struct timeval tv;
+
+       gettimeofday(&tv, NULL);
+       srandom(tv.tv_usec * tv.tv_sec);
 
        fp = fopen(DICT, "r");
        if (! fp) {
@@ -106,7 +109,7 @@ int main(void)
        fclose(fp);
 
        word = choose_random_word(dict);
-       printf("%s\n", word); 
+       fputs(word, stdout); 
 
        return 0;
 }