first milestone reached
This commit is contained in:
9
Code/common/Makefile
Normal file
9
Code/common/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# MYRYS ROVER COMMON CODE
|
||||
#
|
||||
|
||||
COPT = -g -Wall -DDEBUG_LEVEL=0
|
||||
|
||||
protocol.o: protocol.c protocol.h Makefile
|
||||
gcc -c $(COPT) $< -o $@
|
||||
|
||||
43
Code/common/protocol.c
Normal file
43
Code/common/protocol.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* MYRYS ROVER
|
||||
* Low level communication protocol
|
||||
*
|
||||
* new Wed May 27 03:58.27 AM UTC 2026
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "protocol.h"
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
int show_the_version(int code, char *why)
|
||||
{
|
||||
fprintf(stderr, "$$$$ show version %x on pid %ld\n",
|
||||
0xfde9, (long)getpid());
|
||||
fprintf(stderr, "$$$$ number %04X because {%s}\n", code, why);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
int send_a_ping(int code, char *texte, int k)
|
||||
{
|
||||
unsigned int foo, bar;
|
||||
|
||||
fprintf(stderr, "\tpid %ld is sending \"%s\"\n", (long)getpid(), texte);
|
||||
foo = 3 + (rand() % 8);
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "+++ in %s, foo is %u\n", __func__, foo);
|
||||
#endif
|
||||
|
||||
bar = sleep(foo);
|
||||
|
||||
return bar;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
10
Code/common/protocol.h
Normal file
10
Code/common/protocol.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* MYRYS ROVER
|
||||
* Low level communication protocol
|
||||
*
|
||||
* new Wed May 27 03:51.45 AM UTC 2026
|
||||
*/
|
||||
|
||||
int show_the_version(int code, char *why);
|
||||
|
||||
int send_a_ping(int, char *, int);
|
||||
Reference in New Issue
Block a user