-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmisc.h
71 lines (59 loc) · 1.69 KB
/
misc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* This file is part of John the Ripper password cracker,
* Copyright (c) 1996-99,2003 by Solar Designer
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*
* There's ABSOLUTELY NO WARRANTY, express or implied.
*/
/*
* Miscellaneous routines.
*/
#ifndef _JOHN_MISC_H
#define _JOHN_MISC_H
#include <stdio.h>
/*
* Exit on error. Logs the event, closes john.pot and the log file, and
* terminates the process with non-zero exit status.
*/
extern void error(void);
/*
* Similar to perror(), but supports formatted output, and calls error().
*/
extern void pexit(const char *format, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)));
#else
;
#endif
/*
* Attempts to write all the supplied data. Returns the number of bytes
* written, or -1 on error.
*/
extern int write_loop(int fd, const char *buffer, int count);
/*
* Similar to fgets(), but doesn't leave the newline character in the buffer,
* and skips to the end of long lines. Handles both Unix and DOS style text
* files correctly.
*/
extern char *fgetl(char *s, int size, FILE *stream);
/*
* Similar to strncpy(), but terminates with only one NUL if there's room
* instead of padding to the supplied size like strncpy() does.
*/
extern char *strnfcpy(char *dst, const char *src, int size);
/*
* Similar to the above, but always NUL terminates the string.
*/
extern char *strnzcpy(char *dst, const char *src, int size);
/*
* Similar to strncat(), but total buffer size is supplied, and always NUL
* terminates the string.
*/
extern char *strnzcat(char *dst, const char *src, int size);
/*
* Converts a string to lowercase.
*/
extern char *strlwr(char *s);
#endif