]>
diplodocus.org Git - nmh/blob - h/prototypes.h
b04fbcfd1a76a0d26780fbeffb8034171a57d461
1 /* prototypes.h -- various prototypes
3 * If you modify functions here, please document their current behavior
4 * as much as practical.
8 * prototype from config.h
10 char *etcpath(char *) NONNULL(1);
13 * prototypes from the nmh subroutine library
18 char *concat (const char *, ...) ENDNULL
;
21 * Print null-terminated PROMPT to and flush standard output. Read answers from
22 * standard input until one matches an entry in SWITCHES. When one matches,
23 * return its swret field. Return 0 on EOF.
25 int read_switch(const char *PROMPT
, const struct swit
*SWITCHES
);
28 * If standard input is not a tty, return 1 without printing anything. Else,
29 * print null-terminated PROMPT to and flush standard output. Read answers from
30 * standard input until one is "yes" or "no", returning 1 for "yes" and 0 for
31 * "no". Also return 0 on EOF.
33 int read_yes_or_no_if_tty(const char *PROMPT
);
36 * Print null-terminated PROMPT to and flush standard output. Read multi-word
37 * answers from standard input until a first word matches an entry in SWITCHES.
38 * When one matches, return a pointer to an array of pointers to the words.
39 * Return NULL on EOF, interrupt, or other error.
41 char **read_switch_multiword(const char *PROMPT
, const struct swit
*SWITCHES
);
44 * Same as read_switch_multiword but using readline(3) for input.
46 #ifdef READLINE_SUPPORT
47 char **read_switch_multiword_via_readline (char *, struct swit
*);
48 #endif /* READLINE_SUPPORT */
50 char **getarguments (char *, int, char **, int);
52 m_getfld_state_t
m_getfld_state_init(FILE *iob
);
53 void m_getfld_state_reset (m_getfld_state_t
*);
54 void m_getfld_state_destroy (m_getfld_state_t
*);
55 void m_getfld_track_filepos (m_getfld_state_t
*, FILE *);
56 void m_getfld_track_filepos2(m_getfld_state_t
*);
57 int m_getfld (m_getfld_state_t
*, char[NAMESZ
], char *, int *, FILE *);
58 int m_getfld2(m_getfld_state_t
*, char[NAMESZ
], char *, int *);
59 int m_gmprot (void) PURE
;
62 void m_unknown(m_getfld_state_t
*, FILE *);
63 void m_unknown2(m_getfld_state_t
*);
65 char *nmh_getpass(const char *);
66 int pidwait (pid_t
, int);
67 char *r1bindex(char *, int) PURE
;
68 int refile (char **, char *);
71 * Read our credentials file and (optionally) ask the user for anything
76 * host - Hostname (to scan credentials file)
77 * aname - Pointer to filled-in username
78 * apass - Pointer to filled-in password
79 * flags - One or more of RUSERPASS_NO_PROMPT_USER,
80 * RUSERPASS_NO_PROMPT_PASSWORD
82 void ruserpass (const char *host
, char **aname
, char **apass
, int flags
);
83 #define RUSERPASS_NO_PROMPT_USER 0x01
84 #define RUSERPASS_NO_PROMPT_PASSWORD 0x02
87 void scan_detect_mbox_style (FILE *);
88 void scan_finished(void);
91 * Read the sequence files for the folder referenced in the given
92 * struct msgs and populate the sequence entries in the struct msgs.
96 * mp - Folder structure to add sequence entries to
97 * lockflag - If true, obtain a write lock on the sequence file.
98 * Additionally, the sequence file will remain open
99 * and a pointer to the filehandle will be stored in
100 * folder structure, where it will later be used by
104 * OK - successfully read the sequence files, or they don't exist
105 * NOTOK - failed to lock sequence file
107 int seq_read (struct msgs
* mp
, int lockflag
);
108 void seq_save (struct msgs
*);
109 void seq_setcur (struct msgs
*, int);
110 void seq_setprev (struct msgs
*);
111 void seq_setunseen (struct msgs
*, int);
112 int showfile (char **, char *);
113 int smatch(const char *, const struct swit
*) PURE
;
116 * Convert a set of bit flags to printable format.
120 * buffer - Buffer to output string to.
121 * size - Size of buffer in bytes. Buffer is always NUL terminated.
122 * flags - Binary flags to output
123 * bitfield - Textual representation of bits to output. This string
124 * is in the following format:
126 * Option byte 0x01 STRING1 0x02 STRING2 ....
128 * The first byte is an option byte to snprintb(). Currently the only option
129 * supported is 0x08, which indicates that the flags should be output in
130 * octal format; if the option byte is any other value, the flags will be
131 * output in hexadecimal.
133 * After the option bytes are series of text strings, prefixed by the number
134 * of the bit they correspond to. For example, the bitfield string:
136 * "\020\01FLAG1\02FLAG2\03FLAG3\04FLAG4"
138 * will output the following string if "flags" is set to 0x09:
142 * You don't have to use octal in the bitfield string, that's just the
143 * convention currently used by the nmh code. The order of flags in the
144 * bitfield string is not significant, but again, general convention is
145 * from least significant bit to most significant.
147 char *snprintb (char *buffer
, size_t size
, unsigned flags
, char *bitfield
);
148 int ssequal (const char *, const char *) PURE
;
149 int stringdex (char *, char *) PURE
;
152 * prototypes for some routines in uip
154 int annotate (char *, char *, char *, bool, bool, int, bool);
155 void annolist(char *, char *, char *, int);
156 void annopreserve(int);
157 int mhl(int, char **);
158 int mhlsbr(int, char **, FILE *(*)(char *));
159 int distout (char *, char *, char *);
160 int sendsbr (char **, int, char *, char *, struct stat
*, int, const char *);
161 int what_now (char *, int, int, char *, char *,
162 int, struct msgs
*, char *, int, char *, int);
163 int WhatNow(int, char **) NORETURN
;