{"record":{"id":"807f3c2122fae308","repo":"nodejs/node","slug":"s-usage-s-infile-cpp-outfile-cpp","errorCode":null,"errorMessage":"%s: usage: %s infile.cpp outfile.cpp\n","messagePattern":"(.+?): usage: (.+?) infile\\.cpp outfile\\.cpp\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"deps/icu-small/source/tools/escapesrc/escapesrc.cpp","lineNumber":61,"sourceCode":"\n\nstatic const char\n  kSPACE   = 0x20,\n  kTAB     = 0x09,\n  kLF      = 0x0A,\n  kCR      = 0x0D;\n\n// For convenience\n# define cp1047_to_8859(c) cp1047_8859_1[c]\n\n// Our app's name\nstd::string prog;\n\n/**\n * Give the usual 1-line documentation and exit\n */\nvoid usage() {\n  fprintf(stderr, \"%s: usage: %s infile.cpp outfile.cpp\\n\", prog.c_str(), prog.c_str());\n}\n\n/**\n * Delete the output file (if any)\n * We want to delete even if we didn't generate, because it might be stale.\n */\nint cleanup(const std::string &outfile) {\n  const char *outstr = outfile.c_str();\n  if(outstr && *outstr) {\n    int rc = std::remove(outstr);\n    if(rc == 0) {\n      fprintf(stderr, \"%s: deleted %s\\n\", prog.c_str(), outstr);\n      return 0;\n    } else {\n      if( errno == ENOENT ) {\n        return 0; // File did not exist - no error.\n      } else {\n        perror(\"std::remove\");","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/escapesrc/escapesrc.cpp#L43-L79","documentation":"Printed by escapesrc's usage() function when the tool is invoked with the wrong number of arguments. escapesrc is an ICU build-time tool that rewrites C/C++ source files to escape non-ASCII bytes into \\u/\\U sequences for EBCDIC-friendliness. The message documents the required invocation shape: progname infile outfile. It is an informational usage banner, not a runtime fault.","triggerScenarios":"main() calls usage() when argc != 3 (i.e. any count other than exactly one program name plus exactly two file arguments). Passing zero, one, three, or more positional arguments, or using unknown flags (escapesrc has no option parser), triggers it.","commonSituations":"Running escapesrc from a hand-typed command line in a custom build; a Makefile or GN/ninja rule that forwards a wrong number of args (e.g. quoting a glob that expands to many files, or passing an extra -o flag); invoking the binary with --help or no args to discover behavior.","solutions":["Invoke as exactly: escapesrc infile.cpp outfile.cpp (two file paths, no options).","If you reached this from a build, inspect the failing command line in the build log and correct the rule that passes the wrong arg count.","Remove any unrecognized flags — escapesrc parses no options, so any token that is not a path counts as an argument."],"exampleFix":"// before\nescapesrc -o out.cpp in.cpp\n\n// after\nescapesrc in.cpp out.cpp","handlingStrategy":"validation","validationCode":"// before invoking escapesrc, assert the arg shape\nif (argc != 3) { fputs(\"usage: escapesrc infile outfile\\n\", stderr); return 2; }\n// then: execlp(\"escapesrc\", \"escapesrc\", infile, outfile, (char*)NULL);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap the escapesrc call in a build macro that takes exactly (in,out) so callers cannot pass a third arg.","Treat any non-zero exit from escapesrc as a hard build failure."],"tags":["icu","escapesrc","cli-usage","c","cpp"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}