{"record":{"id":"87131ed52f5ed152","repo":"DrKLO/Telegram","slug":"usage-s-options-input-file-output-file-n","errorCode":null,"errorMessage":"usage: %s [options] input_file output_file\\n","messagePattern":"usage: (.+?) \\[options\\] input_file output_file\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"TMessagesProj/jni/opus/src/repacketizer_demo.c","lineNumber":41,"sourceCode":"   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include \"opus.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define MAX_PACKETOUT 32000\n\nvoid usage(char *argv0)\n{\n   fprintf(stderr, \"usage: %s [options] input_file output_file\\n\", argv0);\n}\n\nstatic void int_to_char(opus_uint32 i, unsigned char ch[4])\n{\n    ch[0] = i>>24;\n    ch[1] = (i>>16)&0xFF;\n    ch[2] = (i>>8)&0xFF;\n    ch[3] = i&0xFF;\n}\n\nstatic opus_uint32 char_to_int(unsigned char ch[4])\n{\n    return ((opus_uint32)ch[0]<<24) | ((opus_uint32)ch[1]<<16)\n         | ((opus_uint32)ch[2]<< 8) |  (opus_uint32)ch[3];\n}\n\nint main(int argc, char *argv[])\n{","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/opus/src/repacketizer_demo.c#L23-L59","documentation":"repacketizer_demo is a CLI utility that reads length-prefixed Opus packets from a binary input file and either merges multiple packets into one (-merge N) or splits multi-frame packets into individual frames (-split). With fewer than 3 arguments (program name + input + output), it prints the usage string and returns EXIT_FAILURE. The usage() function at line 39 only prints to stderr; it does not exit, so the caller checks argc and exits.","triggerScenarios":"Running the binary with zero, one, or two total arguments (e.g., just `repacketizer_demo` or `repacketizer_demo input.16k` without an output path). The check at line 69 requires argc >= 3.","commonSituations":"Script typo missing the output argument; unfamiliarity with the tool's required positional arguments; shell quoting that swallowed an argument.","solutions":["Provide both input and output file paths as positional arguments: `repacketizer_demo [options] input_file output_file`.","If using options, ensure they appear before the two positional file arguments (the loop at line 74 iterates only up to argc-2)."],"exampleFix":"// before\nrepacketizer_demo input.oct\n// after\nrepacketizer_demo input.oct output.oct","handlingStrategy":"validation","validationCode":"// Validate argument count before invoking repacketizer_demo\nif (argc < 3) {\n    fprintf(stderr, \"usage: %s [options] input_file output_file\\n\", argv[0]);\n    return EXIT_FAILURE;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In scripts, always provide both input and output file arguments.","Use shell parameter expansion with defaults to avoid missing arguments."],"tags":["opus","cli","usage","argument-validation","repacketizer"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}