added three tests

This commit is contained in:
gdr 1997-07-27 23:50:59 +00:00
parent 945f94e0e0
commit 44802413cf
3 changed files with 66 additions and 0 deletions

View 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;
}

View 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;
}

View 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;
}