last updated |
Remote AccessAll homework must be submitted through the CS accounts. More information on remote login into the CSIF computers can be found in the CSIF FAQ. Account Access (SSH)You may access your CS account via SSH. The hostname you want to connect to is: pc<#>.cs.ucdavis.edu where To transfer files to your CS account, you must use SFTP. The hostname is the same as above. For SFTP commands, see the CSIF FAQ. A command-line SFTP client for Windows can be found here. Using Minix Manual Pages (
|
all: cc -g program1.c -o program1 clean: rm -f program1 |
Using the makefile
above, we would compile program1.c
by the following command:
make all
(or by typing make
)To clean up the object files, we could run the command:
make clean
This illustrates the basic functionality required for all makefiles in this class.
One way to debug your programs is to make use of the errno
variable in errno.h
. Whenever a system call results in an error, the value of errno
is set. To use errno
in your Minix C programs, do the following:
errno.h
to your code.
errno
.
/usr/include/errno.h
and check what message the value of errno
corresponds to.man errno
and check what message the value of errno
corresponds to.
Take for example the following code snippet:
rval = chdir( path ); if( rval == -1 ) printf( "chdir( %s ) failed... errno: %i\n", path, errno ); |
If we got the following output:
chdir( nowhere ) failed... errno: 2
We could then look in /usr/include/errno.h
to see that an errno
value of 2
corresponds to the message "no such file or directory
".
You can always find more information from the man
pages. You can also download errno_example.c for another example Minix C code snippet using errno
.