uriloader/exthandler/tests/WriteArgument.cpp
author Carsten "Tomcat" Book <cbook@mozilla.com>
Fri, 06 Nov 2015 13:59:27 +0100
changeset 293148 5dbceb9638a01828296241661ff3c644d894f118
parent 15220 b5b210b0cd7ee10e89c9933164832604d608a868
permissions -rw-r--r--
Merge mozilla-central to fx-team

#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;
}