-
Notifications
You must be signed in to change notification settings - Fork 0
/
client1.c
42 lines (32 loc) · 942 Bytes
/
client1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "interface.h"
#define MAX_FILENAME_SIZE 25
int main() {
char passwd[MAX_FILENAME_SIZE];
char shadow[MAX_FILENAME_SIZE];
FILE *fpasswd, *fshadow;
// Input filenames from user
puts("Enter the name of the passwd file along with the extension:");
scanf("%s", passwd);
puts("Enter the name of the shadow file along with the extension:");
scanf("%s", shadow);
// Open files
fpasswd = fopen(passwd, "r");
fshadow = fopen(shadow, "r");
// Check if files opened successfully
file_check(fpasswd, passwd);
file_check(fshadow, shadow);
// Process passwd file
puts("****** PASSWD FILE *******");
passwd_check(fpasswd);
// Process shadow file
puts("****** SHADOW FILE *******");
shadow_check(fshadow);
// Close files
fclose(fpasswd);
fclose(fshadow);
return 0;
}