diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/libc/zztest.c | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/libc/zztest.c')
-rw-r--r-- | sys/libc/zztest.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/sys/libc/zztest.c b/sys/libc/zztest.c new file mode 100644 index 00000000..b43fe705 --- /dev/null +++ b/sys/libc/zztest.c @@ -0,0 +1,98 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + */ + +#define import_libc +#define import_stdio +#define import_spp +#define import_error +#define import_xwhen +#include <iraf.h> + +thello_() +{ + fputs ("hello, world\n", stdout); +} + + +tprint_() +{ + char buf[128]; + + sprintf (buf, "\tabcdef %0*d[%-5.2s], %h\n", 5, 99, "wxyz", 12.5); + fputs (buf, stdout); +} + + +tcopy_() +{ + FILE *in, *out; + int ch; + + if ((in = fopen ("junk", "r")) == NULL) + c_erract (EA_ERROR); + if ((out = fopen ("junk2", "wb")) == NULL) + c_erract (EA_ERROR); + + while ((ch = getc (in)) != EOF) + putc (ch, out); + + fclose (in); + fclose (out); +} + + +tscan_() +{ + char buf[SZ_LINE]; + char str[SZ_LINE]; + char cval; + int ival, nscan, n1, n2; + int onint(), oldint; + double dval; + + c_xwhen (X_INT, onint, &oldint); + + printf (">> \n"); + fflush (stdout); + + while (fgets (buf, SZ_LINE, stdin) != NULL) { + nscan = sscanf (buf, + "%n%c %*s %d %lg %s%n", &n1, &cval, &ival, &dval, str, &n2); + printf ("nscan=%d: %d '%c' %d %g '%s' %d\n", + nscan, n1, cval, ival, dval, str, n2); + printf (">> \n"); + fflush (stdout); + } + + eprintf ("all done\n"); +} + + +onint (code, old_handler) +int *code; /* NOTUSED */ +int *old_handler; +{ + write (2, "\7", 1); + *old_handler = 0; +} + + +tgettk_() +{ + XCHAR fname[SZ_FNAME+1]; + char token[SZ_LINE+1], delim; + int maxch = SZ_FNAME; + FILE *fp; + + clgstr_ (c_sppstr("fname"), fname, &maxch); + c_strpak (fname, token, maxch); + + fp = fopen (token, "r"); + if (fp == NULL) + c_erract (EA_ERROR); + + while (fscanf (fp, " %[^ \t\n,:()!^&+-*/;|?<>]%c", token,&delim) != EOF) + eprintf ("%s\n%c\n", token, delim); + + fclose (fp); +} |