Skip to content

Commit b071d36

Browse files
TooTallNatesaghul
authored andcommitted
Rename qjsc -r to qjsc -b
1 parent aa5e4d2 commit b071d36

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

qjsc.c

+10-6
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ void help(void)
337337
"usage: " PROG_NAME " [options] [files]\n"
338338
"\n"
339339
"options are:\n"
340+
"-b output raw bytecode instead of C code\n"
340341
"-e output main() and bytecode in a C file\n"
341342
"-o output set the output filename\n"
342343
"-n script_name set the script name (as used in stack traces)\n"
@@ -345,7 +346,6 @@ void help(void)
345346
"-D module_name compile a dynamically loaded module or worker\n"
346347
"-M module_name[,cname] add initialization code for an external C module\n"
347348
"-p prefix set the prefix of the generated C names\n"
348-
"-r output raw bytecode instead of C code\n"
349349
"-s strip the source code, specify twice to also strip debug info\n"
350350
"-S n set the maximum stack size to 'n' bytes (default=%d)\n",
351351
JS_GetVersion(),
@@ -380,12 +380,15 @@ int main(int argc, char **argv)
380380
namelist_add(&cmodule_list, "os", "os", 0);
381381

382382
for(;;) {
383-
c = getopt(argc, argv, "ho:N:mn:rxesvM:p:S:D:");
383+
c = getopt(argc, argv, "ho:N:mn:bxesvM:p:S:D:");
384384
if (c == -1)
385385
break;
386386
switch(c) {
387387
case 'h':
388388
help();
389+
case 'b':
390+
output_type = OUTPUT_RAW;
391+
break;
389392
case 'o':
390393
out_filename = optarg;
391394
break;
@@ -429,9 +432,6 @@ int main(int argc, char **argv)
429432
case 'p':
430433
c_ident_prefix = optarg;
431434
break;
432-
case 'r':
433-
output_type = OUTPUT_RAW;
434-
break;
435435
case 'S':
436436
stack_size = (size_t)strtod(optarg, NULL);
437437
break;
@@ -448,7 +448,11 @@ int main(int argc, char **argv)
448448

449449
pstrcpy(cfilename, sizeof(cfilename), out_filename);
450450

451-
fo = fopen(cfilename, "w");
451+
if (output_type == OUTPUT_RAW)
452+
fo = fopen(cfilename, "wb");
453+
else
454+
fo = fopen(cfilename, "w");
455+
452456
if (!fo) {
453457
perror(cfilename);
454458
exit(1);

0 commit comments

Comments
 (0)