File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 7
7
8
8
int main (int argc , char * * argv )
9
9
{
10
- char * command ;
10
+ char command [ 1000 ] ;
11
11
char reply [1000 ];
12
12
int host , connection , size ;
13
13
14
- if (argc != 2 ) {
15
- fprintf (stderr , "Usage: %s host\n" , argv [0 ]);
14
+ if (argc < 2 || argc > 3 ) {
15
+ fprintf (stderr , "Usage: %s host [user(s)] \n" , argv [0 ]);
16
16
exit (1 );
17
17
}
18
18
@@ -39,8 +39,8 @@ int main (int argc, char **argv)
39
39
exit (1 );
40
40
}
41
41
42
- command = "Sample Finger command from client. \r\n";
43
- size = strlen ( command );
42
+ size = snprintf ( command , sizeof command , "%s \r\n",
43
+ argc == 3 ? argv [ 2 ] : "" );
44
44
if (ncp_write (connection , command , & size ) == -1 ) {
45
45
fprintf (stderr , "NCP write error.\n" );
46
46
exit (1 );
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ echo "Test ICP and simple data transfer using the Finger protocol."
38
38
NCP=ncp2 ../src/finser &
39
39
PID=$!
40
40
sleep 1
41
- NCP=ncp3 ../src/finger 002 &
41
+ NCP=ncp3 ../src/finger 002 " Sample Finger command from client. " &
42
42
sleep 10
43
43
kill $! $PID 2> /dev/null || :
44
44
You can’t perform that action at this time.
0 commit comments