mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-21 07:30:05 +00:00
added three tests
This commit is contained in:
parent
945f94e0e0
commit
44802413cf
20
lib/libc/tests/stdio/fgetln.c
Normal file
20
lib/libc/tests/stdio/fgetln.c
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Tests fgetln(3) routine -- interactively.
|
||||
*
|
||||
* Devin Reade, 1997.
|
||||
*
|
||||
* $Id: fgetln.c,v 1.1 1997/07/27 23:50:59 gdr Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *p;
|
||||
size_t len;
|
||||
|
||||
while ((p = fgetln(stdin, &len)) != NULL) {
|
||||
printf("%d:%s", len, p);
|
||||
}
|
||||
return 0;
|
||||
}
|
28
lib/libc/tests/stdio/offsetof.c
Normal file
28
lib/libc/tests/stdio/offsetof.c
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This shows the offset (expected and actual) of the _file member of
|
||||
* struct FILE for the stdio package.
|
||||
*
|
||||
* Devin Reade, 1997.
|
||||
*
|
||||
* $Id: offsetof.c,v 1.1 1997/07/27 23:50:59 gdr Exp $
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
|
||||
#ifdef __ORCAC_VERSION
|
||||
int version = __ORCAC_VERSION;
|
||||
#else
|
||||
int version = 20;
|
||||
#endif
|
||||
printf("the expected offsets are:\n");
|
||||
printf("\tv2.0.x:\t\t28\n");
|
||||
printf("\tv2.1.0:\t\t28\n");
|
||||
printf("\tv2.1.1b2:\t30\n");
|
||||
printf("for version %d, offsetof(_file) is %d\n", version,
|
||||
offsetof(FILE, _file));
|
||||
|
||||
return 0;
|
||||
}
|
18
lib/libc/tests/stdio/showfds.c
Normal file
18
lib/libc/tests/stdio/showfds.c
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* This shows the defined values for STDIN_FILENO, STDOUT_FILENO,
|
||||
* and STDERR_FILENO. These will differ for GNO and ORCA.
|
||||
*
|
||||
* Devin Reade, 1997.
|
||||
*
|
||||
* $Id: showfds.c,v 1.1 1997/07/27 23:50:59 gdr Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
printf("stdin: %d %d\n", STDIN_FILENO, fileno(stdin));
|
||||
printf("stdout: %d %d\n", STDOUT_FILENO, fileno(stdout));
|
||||
printf("stderr: %d %d\n", STDERR_FILENO, fileno(stderr));
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user