Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,32 @@
|
|||
#if 0
|
||||
I rewrote the driver according to good sense, my style,
|
||||
and discussion.
|
||||
|
||||
This is file main.c on Autumn 2011 ubuntu linux release.
|
||||
The emacs compile command output:
|
||||
|
||||
-*- mode: compilation; default-directory: "/tmp/" -*-
|
||||
Compilation started at Mon Mar 12 20:25:27
|
||||
|
||||
make -k CFLAGS=-Wall main.o
|
||||
cc -Wall -c -o main.o main.c
|
||||
|
||||
Compilation finished at Mon Mar 12 20:25:27
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern int Query(char *Data, unsigned *Length);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char Buffer[1024], *pc;
|
||||
unsigned Size = sizeof(Buffer);
|
||||
if (!Query(Buffer, &Size))
|
||||
fputs("failed to call Query", stdout);
|
||||
else
|
||||
for (pc = Buffer; Size--; ++pc)
|
||||
putchar(*pc);
|
||||
putchar('\n');
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#if 0
|
||||
This is file query.c
|
||||
|
||||
-*- mode: compilation; default-directory: "/tmp/" -*-
|
||||
Compilation started at Mon Mar 12 20:36:25
|
||||
|
||||
make -k CFLAGS=-Wall query.o
|
||||
cc -Wall -c -o query.o query.c
|
||||
|
||||
Compilation finished at Mon Mar 12 20:36:26
|
||||
#endif
|
||||
|
||||
#include<string.h>
|
||||
|
||||
int Query(char *Data, unsigned *Length) {
|
||||
const char *message = "Here am I";
|
||||
unsigned n = strlen(message);
|
||||
if (n <= *Length)
|
||||
return strncpy(Data, message, (size_t)n), *Length = n, 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
$ gcc main.c query.o -o main && ./main
|
||||
Here am I
|
||||
$
|
||||
Loading…
Add table
Add a link
Reference in a new issue