#include <sys/stat.h>
#include <unistd.h>

char * fullpath = "/home/cs473";
struct stat stats;
printf("Checking for file (%s)\n", fullpath);
int result = stat(fullpath, &stats);

if (result != 0) {
  // snprintf(data, 9999, "Bad link, file does not exist");
}
else if (S_ISDIR(stats.st_mode)) {
  // then do popen ls -l %s fullpath and copy into data
}
else if (S_ISREG(stats.st_mode)) {
  // regular feel, read_file and copy the data
}