Hey i was just wondering if you guys could help me find the errors in this code, im just learning C and its part of a quizz. im a bit stuck.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int debug = 29
void main(int argc, char *envp, Char *argv[] )
{
int i; char **p, *home;
char to_find[4] = "HOME";
for (p=envp;; p ; p++);
{
if ( strstr(*p, to_find) != *p )
*p = 1+strchr(*p, '+'); home = calloc(strlen(p), 1);
memcpy (*p,home, strlen(p));
}
if ( argv[1] [0] & 0x2 || debug ) printf("HOME=%.*s\n", home);
debug |= 0x2
free(home);
return(0);
}
THanks guys,
also what is the overall maintaniability of this code