fork download
  1. int create_server_socket(...) {
  2. int fd, ret;
  3. if ((fd = socket(...)) >= 0) {
  4. if ((ret = bind(...)) == 0) {
  5. if ((ret = listen(...)) == 0) {
  6. if ((ret = accept(..)) >= 0) {
  7. ...
  8. close(fd);
  9. return ret;
  10. } else {
  11. close(fd);
  12. return -ERROR_ACCEPT;
  13. }
  14. } else {
  15. close(fd);
  16. return -ERROR_LISTEN;
  17. }
  18. } else {
  19. close(fd);
  20. return -ERROR_BIND;
  21. }
  22. } else {
  23. return -ERROR_SOCKET;
  24. }
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:26: error: ISO C requires a named argument before ‘...’
 int create_server_socket(...) {
                          ^
prog.c: In function ‘create_server_socket’:
prog.c:3:3: warning: implicit declaration of function ‘socket’ [-Wimplicit-function-declaration]
   if ((fd = socket(...)) >= 0) {
   ^
prog.c:3:20: error: expected expression before ‘...’ token
   if ((fd = socket(...)) >= 0) {
                    ^
prog.c:4:5: warning: implicit declaration of function ‘bind’ [-Wimplicit-function-declaration]
     if ((ret = bind(...)) == 0) {
     ^
prog.c:4:21: error: expected expression before ‘...’ token
     if ((ret = bind(...)) == 0) {
                     ^
prog.c:5:7: warning: implicit declaration of function ‘listen’ [-Wimplicit-function-declaration]
       if ((ret = listen(...)) == 0) {
       ^
prog.c:5:25: error: expected expression before ‘...’ token
       if ((ret = listen(...)) == 0) {
                         ^
prog.c:6:9: warning: implicit declaration of function ‘accept’ [-Wimplicit-function-declaration]
         if ((ret = accept(..)) >= 0) {
         ^
prog.c:6:27: error: expected expression before ‘.’ token
         if ((ret = accept(..)) >= 0) {
                           ^
prog.c:7:11: error: expected expression before ‘...’ token
           ...
           ^
prog.c:11:11: warning: implicit declaration of function ‘close’ [-Wimplicit-function-declaration]
           close(fd);
           ^
prog.c:12:19: error: ‘ERROR_ACCEPT’ undeclared (first use in this function)
           return -ERROR_ACCEPT;
                   ^
prog.c:12:19: note: each undeclared identifier is reported only once for each function it appears in
prog.c:16:17: error: ‘ERROR_LISTEN’ undeclared (first use in this function)
         return -ERROR_LISTEN;
                 ^
prog.c:20:15: error: ‘ERROR_BIND’ undeclared (first use in this function)
       return -ERROR_BIND;
               ^
prog.c:23:13: error: ‘ERROR_SOCKET’ undeclared (first use in this function)
     return -ERROR_SOCKET;
             ^
prog.c:25:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
stdout
Standard output is empty