#ifndef _MSGARG_H_accf793a_ #define _MSGARG_H_accf793a_ #include "folder.h" typedef struct mm_arg ARG; struct mm_arg { char *folder; int type; #define AT_NOMSG 1 /* no mesage, just folder spec */ #define AT_SINGLE 2 /* single message number */ #define AT_RANGE 3 /* u.range.first through u.range.last */ #define AT_SEQNAM 4 /* sequence name */ #define AT_FIRST 6 /* firstN or first#N */ #define AT_LAST 8 /* lastN or last#N */ #define AT_NEXT 10 /* prevN or prev#N */ #define AT_PREV 12 /* nextN or next#N */ #define AT__N 0 /* add to AT_* above; range is by msg numbers */ #define AT__M 1 /* add to AT_* above; range is by msg count */ #define AT__NM 1 /* mask: &AT__NM and &~AT__NM give bit and rest */ /* values for u.n and u.range.{first,last}; u.n can never hold MA_LIMIT */ #define MA_LIMIT (-1) /* "first" or "last" (as appropriate) */ #define MA_CUR (-2) /* "cur" */ union { int n; /* SINGLE, {FIRST,LAST}[NM] */ struct { int first; int last; } range; char *seqnam; } u; } ; /* Turn an arglist element into an ARG. On success, returns 1; on failure, returns zero. The argument string may be modified, even on failure. */ extern int msgarg_parse(char *, ARG *, char **); /* Handle an argument; this take the argument as being relative to the given folder and calls the specified function with a vector of message numbers. The folder must be locked; as far as msgarg_handle is concerned, only a shared lock is necessary, but depending on what the function does with the messages, an exclusive lock may be called for. The last argument is a cookie that's passed on to the function. */ extern void msgarg_handle(ARG *, FOLDER *, void (*)(int *, int, void *), void *); #endif