The code for printing out the datas can be find
in src/server/print.c
. Printing out information
contained in data structures is essentially simpler than
parsing and reading in input datas. All the functions for
printing the data structures have three parameters. The first one
is a file handle of an opened output stream. The second parameter
is a pointer to the data structure to print. The last one is
a pseudoparameter of Surprise error system. The only exception
is function print_errors
which has only two parameters.
The value returned by functions is zero if no error occured and
negative otherwise.
All the functions directly print out data structures in
the language used by SurpriseServer which is described in section
Description of Text Protocol API.
There are two macros for printing out the data structures:
writestr(fh,str)
simply prints out to the opened descriptor fh
string str
; writebuf(fh,buf,fstr,...)
is capable of printing out
formated out (the format string is fstr
and is followed by other
parameters, buf
provides a buffer for transiently allocated string).
This function prints out the errors and frees them from memory.
This function is the only output function not using neither
macro writestr
nor macro writebuf
.
This function prints out struct final
.
This function calls print_disk
and print_parameter
.
This function prints out struct resources
.
This function calls print_disk
, print_filesystem
and print_parameter
.
This function prints out struct disk_info
.
This function calls print_parameter
and print_partition
.
This function prints out struct user_parameter
.
The function prints out user parameters of all the five types.
This function does not call any of SurpriseServer output functions.
This function prints out struct fs_pars
.
This function calls only print_parameter
.
This function prints out struct user_partition
.
This function calls print_directory
and print_parameter
.
This function prints out struct user_directory
.
This function does not call any of SurpriseServer output functions.