I am new to rpc ie iam at the training stage, I want none of the users to log in from the program below and I compiled like this "cc samrpc.c -lrpcsvc", but the error and warning that it showed were
samrpc.c: In function 'main': samrpc.c:9:1: warning: incompatible implicit declaration of built-in function 'exit' [enabled by default] samrpc.c:13:1: warning: incompatible implicit declaration of built-in function 'exit' [enabled by default] /tmp/ccxyIUNJ.o: In function `main': samrpc.c:(.text+0x51): undefined reference to `rnusers' collect2: error: ld returned 1 exit status
Can I tell you in detail how to compile the program, and wat are the requirements that I need to note: samrpc.c is the name of the program, my program is below
#include <stdio.h> int main(argc, argv) int argc; char **argv; { int num; if (argc != 2) { fprintf(stderr, "usage: rnusers hostname\n"); exit(1); } if ((num = rnusers(argv[1])) < 0) { fprintf(stderr, "error: rnusers\n"); exit(-1); } printf("%d users on %s\n", num, argv[1]); return 0; }
}
source share