uriloader/exthandler/tests/WriteArgument.cpp
author Iulian Moraru <imoraru@mozilla.com>
Tue, 28 Jun 2022 00:49:18 +0300
changeset 622178 5563ec0537500a2ac4a38aa9271452b851a0c3ab
parent 450554 09c71a7cf75aeaf2963050e315276fb9a866fd62
permissions -rw-r--r--
Merge autoland to mozilla-central. a=merge

#include <stdio.h>
#include "prenv.h"

int main(int argc, char* argv[]) {
  if (argc != 2) return 1;

  const char* value = PR_GetEnv("WRITE_ARGUMENT_FILE");

  if (!value) return 2;

  FILE* outfile = fopen(value, "w");
  if (!outfile) return 3;

  // We only need to write out the first argument (no newline).
  fputs(argv[argc - 1], outfile);

  fclose(outfile);

  return 0;
}