xref: /openbsd-src/sbin/fdisk/misc.h (revision de8cc8edbc71bd3e3bc7fbffa27ba0e564c37d8b)
1 /*	$OpenBSD: misc.h,v 1.33 2015/11/21 16:45:41 krw Exp $	*/
2 
3 /*
4  * Copyright (c) 1997 Tobias Weingartner
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _MISC_H
20 #define _MISC_H
21 
22 struct unit_type {
23 	char	*abbr;
24 	int64_t	 conversion;
25 	char	*lname;
26 };
27 extern struct unit_type unit_types[];
28 #define SECTORS	1	/* units are bytes/sectors/kbytes/mbytes/gbytes */
29 
30 /* Prototypes */
31 int unit_lookup(char *);
32 int string_from_line(char *, size_t);
33 void ask_cmd(char **, char **);
34 int ask_num(const char *, int, int, int);
35 int ask_pid(int, struct uuid *);
36 char *ask_string(const char *, const char *);
37 int ask_yn(const char *);
38 u_int64_t getuint64(char *, u_int64_t, u_int64_t, u_int64_t);
39 u_int32_t crc32(const u_char *, const u_int32_t);
40 char *utf16le_to_string(u_int16_t *);
41 u_int16_t *string_to_utf16le(char *);
42 
43 #endif /* _MISC_H */
44