common.h (dosfstools-4.1) | : | common.h (dosfstools-4.2) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with this program. If not, see <http://www.gnu.org/licenses/>. | along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
The complete text of the GNU General Public License | The complete text of the GNU General Public License | |||
can be found in /usr/share/common-licenses/GPL-3 file. | can be found in /usr/share/common-licenses/GPL-3 file. | |||
*/ | */ | |||
#ifndef _COMMON_H | #ifndef _COMMON_H | |||
#define _COMMON_H | #define _COMMON_H | |||
#include <sys/types.h> | ||||
#include <limits.h> | ||||
#include <stdint.h> | ||||
#ifndef OFF_MAX | ||||
#define OFF_MAX (off_t)((1ULL << (sizeof(off_t) * CHAR_BIT - 1)) - 1) | ||||
#endif | ||||
extern int interactive; | ||||
extern int write_immed; | ||||
extern int atari_format; /* Use Atari variation of MS-DOS FS format */ | ||||
/* program_name used for printing messages; no name will be printed when it is | ||||
* left as NULL */ | ||||
extern const char *program_name; | ||||
void die(const char *msg, ...) | void die(const char *msg, ...) | |||
__attribute((noreturn, format(printf, 1, 2))); | __attribute((noreturn, format(printf, 1, 2))); | |||
/* Displays a prinf-style message and terminates the program. */ | /* Displays a prinf-style message and terminates the program. */ | |||
void pdie(const char *msg, ...) | void pdie(const char *msg, ...) | |||
__attribute((noreturn, format(printf, 1, 2))); | __attribute((noreturn, format(printf, 1, 2))); | |||
/* Like die, but appends an error message according to the state of errno. */ | /* Like die, but appends an error message according to the state of errno. */ | |||
skipping to change at line 53 | skipping to change at line 70 | |||
/* Like alloc, but registers the data area in a list described by ROOT. */ | /* Like alloc, but registers the data area in a list described by ROOT. */ | |||
void qfree(void **root); | void qfree(void **root); | |||
/* Deallocates all qalloc'ed data areas described by ROOT. */ | /* Deallocates all qalloc'ed data areas described by ROOT. */ | |||
int min(int a, int b); | int min(int a, int b); | |||
/* Returns the smaller integer value of a and b. */ | /* Returns the smaller integer value of a and b. */ | |||
char get_key(const char *valid, const char *prompt); | int xasprintf(char **strp, const char *fmt, ...) | |||
__attribute((format(printf, 2, 3))); | ||||
/* Runs asprintf() and terminates the program if it fails. */ | ||||
int get_choice(int noninteractive_result, const char *noninteractive_msg, | ||||
int choices, ...); | ||||
/* Displays PROMPT and waits for user input. Only characters in VALID are | /* | |||
accepted. Terminates the program on EOF. Returns the character. */ | * Display a numbered list of choices and accept user input to select one. If | |||
* interactive is false, it will instead print noninteractive_msg and return | ||||
* noninteractive_result. The number of options must be given in choices and | ||||
* must be more than one and less then ten. | ||||
* | ||||
* The variable arguments are choices times <int val, const char *desc>, where | ||||
* val is the value that is returned when the user selects this option and desc | ||||
* is the string describing this option. | ||||
*/ | ||||
char *get_line(const char *prompt, char *dest, size_t length); | ||||
/* | ||||
* Display prompt and read a line, placing it in dest with at most length-1 | ||||
* characters plus a null byte. This behaves like printing a prompt and fgets() | ||||
* afterwards with the addition of temporarily enabling canonical input mode | ||||
* with echo if needed. | ||||
*/ | ||||
void check_atari(void); | ||||
/* | ||||
* ++roman: On m68k Linux, check if this is an Atari; if yes, turn on Atari | ||||
* variant of MS-DOS filesystem by default. | ||||
*/ | ||||
uint32_t generate_volume_id(void); | ||||
/* | ||||
* Generate a 32 bit volume ID | ||||
*/ | ||||
int validate_volume_label(char *doslabel); | ||||
/* | ||||
* Validate volume label | ||||
*/ | ||||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 62 lines changed or added |