#include #include #include #include #include #include #include int main(int argc, char *argv[]) { int length, test; struct stat file_data; char nome_file[2048]; if(argc != 2) { printf("\n errore:va passato un nome di file sulla linea di comando\n"); exit(-1); } if((test = lstat(argv[1], &file_data)) < 0) printf("\n Errore %d nel tentativo di usare stat su %s\n ", errno, argv[1]); if(S_ISLNK(file_data.st_mode)) { printf("\n E' un link simbolico\n"); length = readlink(argv[1], nome_file, 2048); nome_file[length]='\0'; unlink(nome_file); } else unlink(argv[1]); }