MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / main

Function main

xs/tools/xsid.c:104–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104int main(int argc, char* argv[])
105{
106 int argi;
107 char inputPath[C_PATH_MAX];
108 char outputPath[C_PATH_MAX];
109
110 char* input = NULL;
111 char* output = NULL;
112 char* rename = NULL;
113 FILE* file = NULL;
114 size_t size;
115 char* buffer = NULL;
116 txInteger* code;
117 txInteger* data;
118 char reason[256];
119 int offset;
120 int count;
121 int total;
122 txLink* list = NULL;
123 txLink* link;
124 txByte byte;
125 txID id;
126 txByte* p;
127
128 for (argi = 1; argi < argc; argi++) {
129 if (!strcmp(argv[argi], "-o")) {
130 argi++;
131 if (argi >= argc)
132 fxReportError("no output directory");
133 else if (output)
134 fxReportError("too many output directories");
135 else
136 output = argv[argi];
137 }
138 else if (!strcmp(argv[argi], "-r")) {
139 argi++;
140 if (argi >= argc)
141 fxReportError("no name");
142 else if (rename)
143 fxReportError("too many names");
144 else
145 rename = argv[argi];
146 }
147 else {
148 if (input)
149 fxReportError("too many files");
150 else
151 input = argv[argi];
152 }
153 }
154 if (!input)
155 fxReportError("no file");
156
157 input = fxRealFilePath(input, inputPath);
158 if (!input)
159 fxReportError("file not found");
160 file = fopen(input, "rb");
161 if (!file)

Callers

nothing calls this directly

Calls 5

fxCompileRegExpFunction · 0.85
fxMatchRegExpFunction · 0.85
fxReportErrorFunction · 0.70
fxRealFilePathFunction · 0.70
fxRealDirectoryPathFunction · 0.70

Tested by

no test coverage detected