Skip to content

Instantly share code, notes, and snippets.

@geekman
Created January 4, 2012 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geekman/1559526 to your computer and use it in GitHub Desktop.
Save geekman/1559526 to your computer and use it in GitHub Desktop.
simple shim (not really) executable for logging arguments
/*
* simple replacement executable for logging arguments
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int i;
char *outfname;
if (argc <= 1)
return 0;
outfname = malloc(strlen(argv[0]) + 5);
sprintf(outfname, "%s.args", argv[0]);
FILE *f = fopen(outfname, "w");
if (! f)
return 2;
for (i = 0; i < argc; i++)
fprintf(f, "%s\n", argv[i]);
fclose(f);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment