|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/demo/checksub.c |
source navigation diff markup identifier search freetext search file search |
1
2 /*****************************************************************************
3 *
4 * checksub.c
5 * reads a sequenct submission with the object loaders
6 *
7 *****************************************************************************/
8 #include <objsub.h>
9
10 #define NUMARGS 3
11 Args myargs[NUMARGS] = {
12 { "Input data", NULL, "Seq-submit", NULL, FALSE, 'i', ARG_DATA_IN, 0.0,0,NULL},
13 { "Input data is binary", "F", NULL, NULL, TRUE , 'b', ARG_BOOLEAN, 0.0,0,NULL},
14 { "Output data", "stdout", "Seq-submit", NULL, FALSE, 'o', ARG_DATA_OUT, 0.0,0,NULL}};
15
16 Int2 Main(void)
17 {
18 AsnIoPtr aip, aipout;
19 AsnTypePtr atp;
20 static CharPtr intypes[2] = { "r", "rb" };
21 Int2 intype;
22 SeqSubmitPtr ssp;
23
24 if (! SubmitAsnLoad())
25 Message(MSG_FATAL, "Unable to load parse trees.");
26
27 atp = AsnFind("Seq-submit");
28 if (atp == NULL)
29 Message(MSG_FATAL, "Unable to find Seq-submit");
30
31 if (! GetArgs("CheckSub 1.0", NUMARGS, myargs))
32 return 1;
33
34 if (myargs[1].intvalue) /* binary input is TRUE */
35 intype = 1;
36 else
37 intype = 0;
38
39 if ((aip = AsnIoOpen(myargs[0].strvalue, intypes[intype])) == NULL)
40 {
41 Message(MSG_FATAL, "Couldn't open %s", myargs[0].strvalue);
42 return 1;
43 }
44
45 if ((aipout = AsnIoOpen(myargs[2].strvalue, "w")) == NULL)
46 {
47 Message(MSG_ERROR, "Couldn't open %s", myargs[2].strvalue);
48 return 1;
49 }
50
51 ssp = SeqSubmitAsnRead(aip, NULL);
52 if (ssp == NULL)
53 Message(MSG_FATAL, "Couldn't read input file");
54 AsnIoClose(aip);
55
56 if (! SeqSubmitAsnWrite(ssp, aipout, NULL))
57 Message(MSG_FATAL, "Couldn't write output file");
58
59 AsnIoClose(aipout);
60 SeqSubmitFree(ssp);
61
62 return 0;
63 }
64
65 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |