8
8
#include <strings.h>
9
9
#include <unistd.h>
10
10
#include <errno.h>
11
- #include <sys/ time.h>
11
+ #include <time.h>
12
12
#include <ctype.h>
13
13
#define issaltchar (c )(isalnum(c) || (c) == '.' || (c) == '/')
14
14
@@ -111,7 +111,7 @@ read_pwd_file(char *filename)
111
111
112
112
/* get user name */
113
113
p = line ;
114
- if ((q = index (p ,':' ))== NULL )
114
+ if ((q = strchr (p ,':' ))== NULL )
115
115
{
116
116
fprintf (stderr ,"%s: line %d: illegal format.\n" ,
117
117
filename ,npwds + 1 );
@@ -138,10 +138,10 @@ read_pwd_file(char *filename)
138
138
139
139
/* get password field */
140
140
p = q ;
141
- q = index (p ,':' );
141
+ q = strchr (p ,':' );
142
142
143
143
/*
144
- * --- don't care ----- if ((q =index (p, ':')) == NULL) {
144
+ * --- don't care ----- if ((q =strchr (p, ':')) == NULL) {
145
145
* fprintf(stderr, "%s: line %d: illegal format.\n", filename,
146
146
* npwds + 1); exit(1); }
147
147
*/
@@ -215,10 +215,7 @@ encrypt_pwd(char key[9], char salt[3], char passwd[14])
215
215
/* get encrypted password */
216
216
if (salt [0 ]== '\0' )
217
217
{
218
- struct timeval tm ;
219
-
220
- gettimeofday (& tm ,NULL );
221
- srand (tm .tv_sec ?tm .tv_sec :1 );
218
+ srand (time (NULL ));
222
219
do
223
220
{
224
221
n = rand () %256 ;