Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
script3r
GitHub Repository: script3r/os161
Path: blob/master/user/testbin/ft4/ft4.c
734 views
1
#include <unistd.h>
2
#include <stdio.h>
3
#include <stdlib.h>
4
5
#define BUF_SIZE 128
6
7
static
8
int
9
test_chdir( const char *path ) {
10
int err;
11
12
putchar( '\n' );
13
14
printf( "attempting to switch directories to %s\n", path );
15
err = chdir( path );
16
if( err ) {
17
printf( "failed to switch directories to %s\n", path );
18
return -1;
19
}
20
21
printf( "successfully switched to %s\n", path );
22
return 0;
23
}
24
25
int main( int argc, char *argv[] ) {
26
(void)argc;
27
(void)argv;
28
29
if( test_chdir( "/testbin" ) )
30
return -1;
31
32
if( test_chdir( "/" ) )
33
return -1;
34
35
36
return 0;
37
}
38
39