#include #include #include #define SMS_SIZE 128 #define NEMA_POSTE 0 #define IMA_POSTE 1 #define MAX_INPUT 128 #define P_SIZE 16 int posta; char korisnik[MAX_INPUT-P_SIZE]; char mailbox[MAX_INPUT]; char data[SMS_SIZE]; int main() { FILE *fajl; char *mbpointer = mailbox; system ("stty susp ^O"); system ("stty intr ^L"); printf ("Ime korisnika: "); scanf ("%s", &korisnik); if ( strlen(korisnik) >= MAX_INPUT-P_SIZE) { printf ("Ime korisnika je predugacko !"); return 1; } else { mbpointer = stpcpy(mbpointer, "/var/spool/mail/"); mbpointer = stpcpy(mbpointer, korisnik); } fajl = fopen(mailbox,"r"); if (!fajl) { printf ("Nema poste ili nepostoji takav korisnik na sistemu !"); fclose (fajl); return 1; } posta = IMA_POSTE; while (fgets(data, SMS_SIZE, fajl) != NULL) printf ("%s", data); fclose(fajl); return 0; }