#include #include #include #include #include #include /* for mode_t */ void usage() { printf("\n"); printf(" check out \"man rpc.statd\":\n"); printf(" This callout program should receive callouts for\n"); printf(" NLM client monitor and unmonitor requests. It is\n"); printf(" run with 3 arguments: \n"); printf(" 1st: either add-client or del-client\n"); printf(" 2nd: the name of the client\n"); printf(" 3rd: the name of the server as known to the client.\n"); return; } int main (int argc, char* argv[]) { char* file = "/tmp/NLM/from-ha"; mode_t rw_mode; int rc, debug=0, i; FILE *fd; struct flock lock; /* Open a file descriptor to the file. */ rw_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; /* 0644 */ fd = fopen(file, "a+"); fprintf(fd, "%s is invoked with %d arguments.\n", argv[0], argc - 1); if (argc != 4) { fprintf (fd, " error: invalid arguments\n"); debug = 1; } for (i = 1; i < argc; ++i) fprintf (fd, " %s\n", argv[i]); fclose(fd); return 0; }