root/tags/5.52/mxget.c

Revision 4, 1.8 kB (checked in by heitor.barbieri, 2 years ago)

Versão 5.52 do cisis (28/04/2010)

Line 
1/* ------------------------------ mxget.c ---------------------------------- */
2
3#include <stdio.h>
4#include <ctype.h>
5#include <string.h>
6
7#include "cisis.h"   /* CISIS Interface header file */
8#include "cirun.h"   /* CISIS Interface runtime declarations */
9
10
11void mxsyntax(void);
12void mxsyntax()
13{
14        printf("%s",cicopyr("Utility MXGET"));
15        printf("\n");
16        printf("mxget [cipar=<file>] <fmt_spec> \n");
17        printf("\n");
18}
19
20
21#define cistderr stderr
22
23
24void main(argc,argv)
25int argc;
26char *argv[];
27
28{
29    RECSTRU *recp; /* mandatory for defines REC RDB MF0 MFR DIR, FIELDP */
30
31    int iarg;
32    long rc;
33
34    char *cgipfxp="tag";
35    UWORD cgitag=2000;
36
37    /* int cicgi0(int *argc, char *argv[], char **wwwp, UWORD taghxsub, char *taghpfxp); */
38    char *wwwp;
39    char *xp,*p,*q;
40    long wwrec1,wwrec2;
41    char *cgispecp;
42
43    if (argc < 2) {
44        mxsyntax();
45        exit(1);
46    }
47
48        RECORD(wwrec1=nrecs,"null",1L); RECrc=RCNORMAL; MFRstatus=ACTIVE;
49        RECORD(wwrec2=nrecs,"null",1L); xp=(char *)MFX; /* current */
50        for (iarg=1; iarg < argc; iarg++) {
51
52                    cgispecp=argv[iarg];
53                    wwwp=NULL; cicgi0(NULL, NULL, &wwwp, cgitag, cgipfxp);
54                    if (!wwwp) wwwp="";
55                    sprintf(xp,"D%ld",(long)cgitag); fldupdat(wwrec1,xp);
56                    p=fldupdat(wwrec1,wwwp); if (p) fatal(p);
57                    rc=recfmt(wwrec1,RECnbytes,cgispecp,p=xp,RECnbytes);
58                    if (rc < 0) fatal(cgispecp);
59                    while (*p) {
60                        for (q=p; *p; p++)
61                           if (*p == '\r' || *p == '\n') {
62                               *p++='\0'; if (*p == '\n') *p++='\0'; break;
63                           }
64                        printf("%s\n",q);
65                    }
66                    break;
67
68        } /* end for */
69
70    exit(0);
71}
Note: See TracBrowser for help on using the browser.