int ls_lockhost(time_t duration)
ls_lockhost()has the following parameter:
The following code example demonstrates how to use ls_lockhost() to lock a host:
/******************************************************* LSLIB -- Examples** ls_lockhost()* Locks the local host for a specified time.******************************************************/#include <lsf/lsf.h>#include <time.h>int main(int argc, char ** argv){/* Declaring variables*/u_long duration;/* Checking for the correct format */if (argc !=2){fprintf(stderr, "usage: sudo %s <duration>\n", argv[0]);exit(-1);}/* assigning the duration of the lockage*/duration = atoi(argv[1]);/* If an error occurs, exit with an error msg*/if (ls_lockhost(duration) !=0){ls_perror("ls_lockhost");exit(-1);}/* If ls_lockhost() is successful, then check to see if duration is > 0. Indicate how long the host is locked if duration is >0 */if (duration > 0){printf("Host is locked for %i seconds \n", (int) duration);}else /* Indicate indefinite lock on host */{printf("Host is locked\n");}/* successful exit */exit(0);}