1 /* common.h - Common functions */
3 # define MSDOS_FAT12 4084 /* maximum number of clusters in a 12 bit FAT */
10 //void die(char *msg,...) __attribute((noreturn));
11 __declspec(noreturn
) void die(char *msg
,...);
13 /* Displays a prinf-style message and terminates the program. */
15 //void pdie(char *msg,...) __attribute((noreturn));
16 __declspec(noreturn
) void pdie(char *msg
,...);
18 /* Like die, but appends an error message according to the state of errno. */
20 void *alloc(int size
);
22 /* mallocs SIZE bytes and returns a pointer to the data. Terminates the program
25 void *qalloc(void **root
,int size
);
27 /* Like alloc, but registers the data area in a list described by ROOT. */
29 void qfree(void **root
);
31 /* Deallocates all qalloc'ed data areas described by ROOT. */
33 //int min(int a,int b);
35 /* Returns the smaller integer value of a and b. */
37 char get_key(char *valid
,char *prompt
);
39 /* Displays PROMPT and waits for user input. Only characters in VALID are
40 accepted. Terminates the program on EOF. Returns the character. */