Skip to content

Instantly share code, notes, and snippets.

@betseg
Created June 11, 2017 00:11
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 betseg/44f41bb089c892d3b4093e57f349c2eb to your computer and use it in GitHub Desktop.
Save betseg/44f41bb089c892d3b4093e57f349c2eb to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
int i, j;
char buff[100];
char vars[127][100];
strcpy(vars[(int) argv[1][0]], argv[1]+2);
for(i=j=0; j < strlen(argv[2]); i++, j++) {
if(argv[2][j] == argv[1][0]) {
strcat(buff, vars[(int) argv[1][0]]);
i += strlen(vars[(int) argv[1][0]])-1;
}
else
buff[i] = argv[2][j];
}
puts(buff);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment