Skip to content

Commit

Permalink
send: Specify int as main()’s return type and include string.h
Browse files Browse the repository at this point in the history
Fix the warnings below:

    $ make send
    cc     send.c   -o send
    send.c:41:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
     main(int argc,char *argv[]) {
     ^~~~
    send.c: In function ‘main’:
    send.c:63:5: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
         memset(buffer,0xA3,sizeof(buffer));
         ^~~~~~
    send.c:63:5: warning: incompatible implicit declaration of built-in function ‘memset’
    send.c:63:5: note: include ‘<string.h>’ or provide a declaration of ‘memset’
    send.c:79:5: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
         memcpy(&sin.sin_addr,he->h_addr,he->h_length);
         ^~~~~~
    send.c:79:5: warning: incompatible implicit declaration of built-in function ‘memcpy’
    send.c:79:5: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’

Reported-by: gcc (GCC) 7.5.0
  • Loading branch information
pmenzel committed Mar 18, 2022
1 parent 8f6938f commit d7f0aa3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion send/send.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <netinet/in.h>
Expand Down Expand Up @@ -38,7 +39,7 @@ void setLinger(int s)
static char buffer[8192];


main(int argc,char *argv[]) {
int main(int argc,char *argv[]) {

char *host;
short port;
Expand Down

0 comments on commit d7f0aa3

Please sign in to comment.