#ifndef IN_GROUP
extern int max_groups;
#else
#ifdef NETWARE
int max_groups=26000;
#else
int max_groups=55000;
#endif
#endif

/* Must leave 5000 header for GID's. */
/* Must add commands to trim the list better */

char *group_name_x(int x, char *file, int line);
char *group_namelc_x(int x, char *file, int line);
void group_null_name(int chan);

#define group_name(g) group_name_x(g,__FILE__,__LINE__)
#define group_namelc(g) group_namelc_x(g,__FILE__,__LINE__)
#define group_delete(g) group_delete_x(g,__FILE__,__LINE__)
void group_delete_x(int x, char *file, int line);

/*
char *group_name(int x);
char *group_namelc(int x);
*/
void stats_groups_clear(void);
int group_isdownloading(int group, int num);
void group_setcached_slave(int g);
int group_read_changed(void);
int group_write_changed(void);
int group_binsucked(int g);
int get_sort_piles_nf(void);
int gage_getnext(void);
int group_here_get(void);
int group_getxsort(int x);
void group_setxsort(int x, int t);
int group_xov_nohits(int x);
void group_fix_byindex(int x, int from, int to, int nitems);

void group_setcached_hit(int g);
void group_slavegid(int g);
void group_xref_clear(void);
void group_export(void);
void group_regid(void);
void group_setxreplic(char *s);
void group_fixup(int gid, int i);
void group_setcachedc(int x, int cached_char);
int group_rawrange(int x);
void group_setxover(int x, int days);
int group_isxover(int x);
int group_nxover(void);
int group_hitxover(int x);
int group_downmsg(int g, int n);
int group_nx(void);
int g_list_start(int grp);
int g_list_next(void);
int group_iscachedreal(int x);
int g_list_findnum(int grp, int *xfirst, int *xlast);
int gid_to_group(int gid);
char *group_name_gid(int gid);
void gage_setpile(int g);
int group_backgnd(void);
int group_write_changed_later(void);
int group_getmrej(int x);
void group_addmrej(int x);

void gage_sethash(int g, int x);
void group_monthly(void);
char *group_gettitle(int i);
int group_settitle(int i, char *title);
int group_gid(int grp);
int getagid(int g, int x, char *gname);
int group_write_backup(void);
int group_nodup(void);
int group_getgroupid(int x);
int group_iscached3(int x);
int group_iscached2(int x);
int group_remove_now(int x);
int group_fixnames(void);
int group_getfrom(int x);
char *group_getlist2(int x);
void group_sort(void);
char *group_getlistx(int x);

int group_ord(int i);
void group_unknown(int x);
int group_xref(char *xref);
int group_find_file(char *s);
int group_xref_here(int g, int num);
void group_addsize(int grp, int sz);
char *group_status(void);
void group_fixtimes(int age);
void group_times(int g, char *gname, char *user, int t);
int group_times_add(int g, int t);
void group_times_load(void);
int group_times_n(void);
int group_times_g(int n);
int group_times_time(int n);
int group_times_after(int t);
char *gid_find_group(int gid);
int gid_find_g(char *s);

void group_addrange(int x, int i);
void group_setrange(int x, int i);
int group_fixrange(void);
int group_getrange(int x);

void group_setfeedendif(int x, int f, int i);

int group_wanted(char *s);
int group_getfake(int x);
int group_remove(int x);
int group_feedend(int x, int f);
void group_setfeedend(int x, int f, int i);
void group_times_flush(void);
void group_read(void);
int  group_write(void);
void group_use_xref(int t);
int group_lastgid(void);

int group_xref_ary(int n, int grps[], int nums[]);
int group_add(char *s);
int group_new(char *s, char *user, char *mod, char *title);
int group_find(char *s);
int group_getend(int x);
int group_getnext(int x);
int group_getstart(int x);
int group_getmod(int x);
void group_setmod(int x, char *m);
int group_getlife(int x);
void group_setlife(int x, int m);
void group_setend(int x,int i);
void group_setstart(int x, int i);
void group_setcached(int x, int i);
int group_iscached(int x);
int group_ismod(int x);
int group_isdeleted(int x);
int group_n(void);
char *group_getlist(int x);
int group_match(char *wildgrps, char *grp);
int group_inupdate(int g);
void group_setupdate(int g,int v);
void group_uncache_most(void);

void group_clearxsort(void);
int group_used(int chan, int grp, int num, int sz);
void group_used_flush(void);
void group_age(void);
void group_cacheall(int days);

void group_names_load(void);
int group_names_add(char *s);
char *group_names_get(int i);
void group_names_write(void);
int group_names_n(void);

#ifdef NETWARE
#define SHORT_NAMES TRUE
#endif

#ifdef SHORT_NAMES
#define DNEWS_ACTIVE_NAMES file_work("active.nam")
#define DNEWS_ACTIVE_TIMES file_work("active.tim")
#else
#define DNEWS_ACTIVE_NAMES file_work("active.names")
#define DNEWS_ACTIVE_TIMES file_work("active.times")
#endif
#define DNEWS_ACTIVE_BACKUP file_log("active.bak")
#define DNEWS_ACTIVE_BACKUP2 file_work("active.mon")
int group_names_find(char *gname);
int group_names_set(int i,char *s);
int group_names_addfix(char *gname);
void group_setcatchup(int x, int f, int v);
void group_usecatchup(int x, int f);
void group_merge(char *p1); /* Merge a bunch of groups from another active file */
void group_undelete(int x);
int next_groupid(int x);
int ghash_del(char *gname);

int empty_count(int chan, int n);
int empty_hide(int chan, int n);
int empty_unhide(int chan, char *wild);

int empty_addif(char *xname, char *mod);
int empty_add(char *xname, char *mod);
int empty_isempty(char *s);
int empty_unempty(char *s);
int empty_close(void);
int empty_read(void);
int empty_write(void);
void gage_init(void);
int gage_get(int g);
int gage_hash(int g);
void gage_add(int g, int age);
void gage_write(void);
void gage_spread(void);



void group_write_nread(void) ;
void group_write_nread_now(void) ;
void group_read_nread(void);
void group_read_rsize(int n);
void group_reset_rsize(void);

