Compare commits

..

No commits in common. "7ee4eb093035d5992c6db52a15678328f7b93ae4" and "19e3db36ede7e02be3ab2b672951cf7990d6c602" have entirely different histories.

10 changed files with 17 additions and 85 deletions

View File

@ -26,7 +26,7 @@ Ces paramètres sont fournis par des mécanismes planquées
dans la soute du système d'exploitation, et n'ont pas
d'importance pour le moment..
\lstinputlisting[language=c]{code/C/hello.c}
\lstinputlisting[language=c]{code/hello.c}
Un fois passé l'entrée, nous sommes dans la partie active.
Nous appelons à ce moment une fonction de la bibliothèque
@ -53,7 +53,7 @@ un tableau de chaines de caractères contenant ces différents mots.
Ce petit bout de code va nous afficher tout ça~:
\lstinputlisting[language=c]{code/C/arguments.c}
\lstinputlisting[language=c]{code/arguments.c}
Et voici un exemple d'exécution depuis un shell~:\index{shell}
@ -75,14 +75,6 @@ En C, les tableaux commencent toujours à l'indice 0.
Pour le traitement des options, il faut sauter à
la page \pageref{getopt}.
. . .
\begin{verbatim}
if (config->optind < config->argc)
for (int i = config->optind; i < config.argc; ++i)
process(config->argv[i]);
\end{verbatim}
% =========================================================
\section{Les variables}

View File

@ -122,7 +122,7 @@ Comme vous le savez tous, un appel système
est \textbf{le} moyen de communication qu'utilise un process
utilisateur pôur demander un service au noyau.
\lstinputlisting[language=C]{code/C/hello.c}
\lstinputlisting[language=C]{code/hello.c}
Un exemple canonique, n'est-il pas ? Ce bout de code affichant
quelque chose à l'écran, il doit bien y avoir un appel au noyau

View File

@ -2,17 +2,8 @@
# exemples pour le chapitre sur le C
# new Sat Feb 11 12:06:34 CET 2023
all: no-op slowprint fgets-simple packtest use_envp
# simplified version of the canonical first C program
hello: hello.c Makefile
gcc -Wall $< -o $@
# please show me the command line
arguments: arguments.c Makefile
gcc -Wall $< -o $@
no-op: no-op.c Makefile
gcc -Wall $< -o $@

View File

@ -1,16 +0,0 @@
/*
* afficher les arguments.
*/
#include <stdio.h>
int main(int argc, char *argv[])
{
int foo;
for (foo=0; foo<argc; foo++) {
printf(" %3d %s\n", foo, argv[foo]);
}
return 0;
}

View File

@ -1,7 +0,0 @@
#include <stdio.h>
int main(int argc, char *argv[])
{
puts("hello world.");
return 0;
}

View File

@ -10,9 +10,23 @@ ex_curses: ex_curses.c Makefile
thread-demo: thread-demo.c Makefile
gcc -Wall -pthread $< -o $@
hello: hello.c Makefile
gcc -Wall $< -o $@
arguments: arguments.c Makefile
gcc -Wall $< -o $@
voirenv: voirenv.c Makefile
gcc -Wall $< -o $@
#------------- OSC -----------------------
osc: send-osc listen-osc
send-osc: send-osc.c Makefile
gcc -Wall $< -llo -o $@
listen-osc: listen-osc.c Makefile
gcc -Wall $< -llo -o $@
#------------- IPC -----------------------

View File

@ -1,9 +0,0 @@
#------------- OSC -----------------------
osc: send-osc listen-osc
send-osc: send-osc.c Makefile
gcc -Wall $< -llo -o $@
listen-osc: listen-osc.c Makefile
gcc -Wall $< -llo -o $@

View File

View File

@ -1,15 +0,0 @@
/* LISTEN OSC */
#include <stdio.h>
#include <lo/lo.h>
#define LOCAL_PORT "9000"
int main(int argc, char *argv[])
{
lo_server_thread st;
st = lo_server_thread_new(LOCAL_PORT, NULL);
return 0;
}

View File

@ -1,18 +0,0 @@
/* SEND OSC */
#include <stdio.h>
#include <lo/lo.h>
#define REMOTE_HOST "localhost"
#define REMOTE_PORT "9000"
int main(int argc, char *argv[])
{
lo_address loana;
int foo;
loana = lo_address_new(REMOTE_HOST, REMOTE_PORT);
foo = lo_send(loana, "/dev/kmem", "is", 61, "meg, efface !");
fprintf(stderr, "foo %d\n", foo);
return 0;
}