#include "circlessrv.h" #include #include #include int square(int x) { return x*x; } double dist(int x1, int y1, int x2, int y2) { int dx2, dy2; dx2 = (x1-x2)*(x1-x2); dy2 = (y1-y2)*(y1-y2); return sqrt(dx2+dy2); } /* circumference */ double circu(double radius) { return 3.1415927 * 2 * radius; } /* shell call - beware of security risk */ int shell(char * command) { int result; int c; printf("Remote process wishes to execute %s\n Continue? ",command); c = (char)getchar(); if (c == 'y') result = system(command); if ((c != 'y') || (result < 0)) return 0; else return 1; } /* compile with: gcc -c colcserver.c base stub gcc -c circlessrv.c generated by mcc gcc -lnsl -lsocket -lm colcserver.o circlessrv.o circlesimp.c -o circsrv */