X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/6bc64765f773ce75454ec1592a86779e3547fe46..c87ca5cca:/h/mh.h?ds=inline diff --git a/h/mh.h b/h/mh.h index 1ecb4882..b8c60ca8 100644 --- a/h/mh.h +++ b/h/mh.h @@ -1,4 +1,3 @@ - /* * mh.h -- main header file for all of nmh */ @@ -19,6 +18,12 @@ #define DMAXFOLDER 4 /* typical number of digits */ #define MAXFOLDER 1000 /* message increment */ +/* + * This macro is for use by scan, for example, so that platforms with + * a small BUFSIZ can easily allocate larger buffers. + */ +#define NMH_BUFSIZ (BUFSIZ>=8192 ? BUFSIZ : 8192) + #ifndef FALSE #define FALSE 0 #endif @@ -38,6 +43,35 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ #define NMH_UNUSED(i) i #endif +/* + * char array that keeps track of size in both bytes and characters + * Usage note: + * Don't store return value of charstring_buffer() and use later + * after intervening push_back's; use charstring_buffer_copy() + * instead. + */ +typedef struct charstring *charstring_t; + +charstring_t charstring_create (size_t); +charstring_t charstring_copy (const charstring_t); +void charstring_free (charstring_t); +/* Append a single-byte character: */ +void charstring_push_back (charstring_t, const char); +/* Append possibly multi-byte character(s): */ +void charstring_push_back_chars (charstring_t, const char [], size_t, size_t); +void charstring_append (charstring_t, const charstring_t); +void charstring_append_cstring (charstring_t, const char []); +void charstring_clear (charstring_t); +/* Don't store return value of charstring_buffer() and use later after + intervening push_back's; use charstring_buffer_copy() instead. */ +const char *charstring_buffer (const charstring_t); +/* User is responsible for free'ing result of buffer copy. */ +char *charstring_buffer_copy (const charstring_t); +size_t charstring_bytes (const charstring_t); +size_t charstring_chars (const charstring_t); +/* Length of the last character in the charstring. */ +int charstring_last_char_len (const charstring_t); + /* * user context/profile structure */ @@ -165,7 +199,6 @@ unsigned int bvector_at (bvector_t, size_t); const unsigned long *bvector_bits (bvector_t); size_t bvector_maxsize (bvector_t); -struct svector; typedef struct svector *svector_t; svector_t svector_create (size_t); @@ -176,7 +209,6 @@ char **svector_find(svector_t, const char *); char **svector_strs (svector_t); size_t svector_size (svector_t); -struct ivector; typedef struct ivector *ivector_t; ivector_t ivector_create (size_t); @@ -439,7 +471,6 @@ extern char *mhlproc; extern char *mhlreply; extern char *moreproc; extern char *msgprot; -extern char *mshproc; extern char *nmhaccessftp; extern char *nmhaccessurl; extern char *nmhstorage; @@ -461,7 +492,6 @@ extern char *showproc; extern char *usequence; extern char *version_num; extern char *version_str; -extern char *vmhproc; extern char *whatnowproc; extern char *whomproc;