-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutil5cli.h
156 lines (137 loc) · 2.28 KB
/
util5cli.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/********************************************************************
prog5ftp.c
Class: CSCI 631 Network Applications Programming
Program: Assignment 5
Author: Vishrant K Gupta
Z-number: z1815637
Date Due: 04/28/17
Purpose: FTP
Execution: Make execute N=5 T=1
*********************************************************************/
#ifndef UTIL5CLI_H_
#define UTIL5CLI_H_
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <netdb.h>
#include <sys/socket.h>
#include <wordexp.h>
#include "prog5cli.h"
// command ip enum
typedef enum cmd_id {
NEG_ = -1,
ZERO_,
QM_,
BYE_,
CD_,
CDUP_,
CLOSE_,
DISCONNECT_,
HELP_,
LCD_,
OPEN_,
PWD_,
QUIT_
} cmd_id;
/*
* Name: get_args
*
* Prototype:
* cmd_id get_args(char* buf, char* cmd, char* arg1, char* arg2)
*
* Description:
* get args
*
* Header files:
* wrap1cli.h
*
*/
cmd_id get_args(char* buf, char* cmd, char* arg1, char* arg2);
/*
* Name: prnt_cmd_help
*
* Prototype:
* void prnt_cmd_help()
*
* Description:
* print perticular cmd help
*
* Header files:
* wrap1cli.h
*
*/
void prnt_cmd_help(char* cmd);
/*
* Name: prnt_cmd_list
*
* Prototype:
* void prnt_cmd_list()
*
* Description:
* print all list of help
*
* Header files:
* wrap1cli.h
*
*/
void prnt_cmd_list();
/*
* Name: trim
*
* Prototype:
* void trim(char* str)
*
* Description:
* trim string
*
* Header files:
* wrap1cli.h
*
*/
void trim(char* str);
/*
* Name: find_id
*
* Prototype:
* cmd_id find_id(char* cmd)
*
* Description:
* get command id
*
* Header files:
* wrap1cli.h
*
*/
cmd_id find_id(char* cmd);
/*
* Name: new_dir
*
* Prototype:
* bool new_dir(char* dir, cmd_id id, int socket_fd)
*
* Description:
* handle cd , lcd cdup command
*
* Header files:
* wrap1cli.h
*
*/
bool new_dir(char* dir, cmd_id id, int socket_fd);
/*
* Name: not_connected
*
* Prototype:
* void not_connected()
*
* Description:
* for printing not connected message
*
* Header files:
* wrap1cli.h
*
*/
void not_connected();
#endif /* UTIL5CLI_H_ */