Commit 8c186e33 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Changes for vcc:

  Write "{ 0, NULL }" instead of "((Foo){ 0, NULL})".
Cleanup.
parent c50e11bc
/*
* $Id: kom-types.h,v 0.8 1993/10/10 11:59:59 ceder Exp $
* $Id: kom-types.h,v 0.9 1993/10/16 16:35:47 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -65,11 +65,11 @@
#include "misc-types.h"
typedef unsigned short Pers_no;
typedef unsigned short Conf_no;
typedef unsigned long Text_no;
typedef unsigned long Local_text_no;
typedef unsigned long Session_no;
typedef unsigned short Pers_no;
typedef unsigned short Conf_no;
typedef unsigned long Text_no;
typedef unsigned long Local_text_no;
typedef unsigned long Session_no;
#ifdef PROT_a
......@@ -114,19 +114,16 @@ typedef unsigned long Global_text;
#define MAX_LOCAL_TEXT_NO ((Local_text_no) ULONG_MAX)
#ifdef SERVER
#define PASSWD_LEN 64
typedef char Password[PASSWD_LEN];
typedef off_t Text_index;
typedef time_t Time;
# define NULL_TIME_i ((Time) 0)
#ifdef SERVER
# define PASSWD_LEN 64
typedef char Password[PASSWD_LEN];
typedef off_t Text_index;
typedef time_t Time;
# define NULL_TIME_i 0
#else /* CLIENT */
typedef struct tm Time;
# define NULL_TIME_i ((Time) { 0 })
#endif
typedef struct tm Time;
# define NULL_TIME_i {0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0}
#endif /* CLIENT */
......@@ -155,17 +152,17 @@ typedef struct {
} Priv_bits;
#ifdef SERVER
# define DEFAULT_PRIV_BITS_i ((Priv_bits) \
# define DEFAULT_PRIV_BITS_i \
{ 0, 0, 0, ANYONE_CAN_CREATE_NEW_PERSONS, \
ANYONE_CAN_CREATE_NEW_CONFS, \
DEFAULT_CHANGE_NAME, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0 \
})
}
#else
# define DEFAULT_PRIV_BITS_i ((Priv_bits) \
# define DEFAULT_PRIV_BITS_i \
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0 \
})
}
#endif
extern const Priv_bits DEFAULT_PRIV_BITS;
......@@ -175,8 +172,8 @@ extern const Priv_bits DEFAULT_PRIV_BITS;
* Flags in the Person struct.
*/
typedef struct {
unsigned int unread_is_secret : 1;/* FALSE if everyone is allowed to ask how */
/* many unread texts you have. */
unsigned int unread_is_secret : 1;/* FALSE if everyone is allowed to ask
how many unread texts you have. */
unsigned int flg2 : 1;
unsigned int flg3 : 1;
unsigned int flg4 : 1;
......@@ -186,10 +183,9 @@ typedef struct {
unsigned int flg8 : 1;
} Personal_flags;
#define DEFAULT_PERSONAL_FLAGS_i ((Personal_flags) \
{ 0, 0, 0, 0, 0, 0, 0, 0 })
extern const Personal_flags DEFAULT_PERSONAL_FLAGS;
#define DEFAULT_PERSONAL_FLAGS_i { 0, 0, 0, 0, 0, 0, 0, 0 }
extern const Personal_flags DEFAULT_PERSONAL_FLAGS;
/* See file doc/misc_items */
......@@ -275,34 +271,31 @@ typedef struct {
} Text_stat;
#ifdef SERVER
#define EMPTY_TEXT_STAT_i ((Text_stat) \
{ NULL_TIME_i, 0, 0, 0, 0, 0, 0, NULL })
# define EMPTY_TEXT_STAT_i { NULL_TIME_i, 0, 0, 0, 0, 0, 0, NULL }
#else
#define EMPTY_TEXT_STAT_i ((Text_stat) \
{ NULL_TIME_i, 0, 0, 0, 0, 0, NULL })
# define EMPTY_TEXT_STAT_i { NULL_TIME_i, 0, 0, 0, 0, 0, NULL }
#endif
extern const Text_stat EMPTY_TEXT_STAT;
typedef struct {
unsigned int rd_prot : 1; /* !(Can anyone become a member?) */
unsigned int original : 1; /* Comments forbidden? */
unsigned int secret : 1; /* Secret conference? */
/* Note: if a letterbox is secret it
* will be very hard for that person
* to log in, since he can't map his
* name to a pers_no. He must either
* know his pers_no, or have another
* identity which is his supervisor.
*/
unsigned int letter_box : 1; /* Is this a letter box? */
unsigned int rd_prot : 1; /* !(Can anyone become a member?) */
unsigned int original : 1; /* Comments forbidden? */
unsigned int secret : 1; /* Secret conference? */
/* Note: if a letterbox is secret it
* will be very hard for that person
* to log in, since he can't map his
* name to a pers_no. He must either
* know his pers_no, or have another
* identity which is his supervisor.
*/
unsigned int letter_box : 1; /* Is this a letter box? */
} Conf_type;
#define NULL_CONF_TYPE_i ((Conf_type) { 0, 0, 0, 0 })
extern const Conf_type NULL_CONF_TYPE;
#define NULL_CONF_TYPE_i { 0, 0, 0, 0 }
extern const Conf_type NULL_CONF_TYPE;
typedef struct {
......@@ -310,11 +303,10 @@ typedef struct {
} Member;
/* Struct for marks */
typedef struct {
Text_no text_no;
unsigned char mark_type; /* It's up to the clients to decide the
unsigned char mark_type; /* It's up to the clients to decide the
meaning of this field. */
} Mark;
......@@ -323,20 +315,19 @@ typedef struct {
/* Information about a person's membership in a conference */
typedef struct {
Conf_no conf_no;
unsigned char priority; /* Interrupt priority */
unsigned char priority; /* Interrupt priority */
Time last_time_read; /* Updated every time a text in this
conf. is marked as read. */
Local_text_no last_text_read; /* All texts before and inclusive this
are read */
unsigned short no_of_read;
unsigned short no_of_read;
Local_text_no * read_texts; /* Texts after last_text_read. Sorted
in ascending order */
} Membership;
#define EMPTY_MEMBERSHIP_i ((Membership) \
{ 0, 0, NULL_TIME_i, 0, 0, NULL })
extern const Membership EMPTY_MEMBERSHIP;
#define EMPTY_MEMBERSHIP_i { 0, 0, NULL_TIME_i, 0, 0, NULL }
extern const Membership EMPTY_MEMBERSHIP;
/* Some structs to handle variable-sized arrays. */
......@@ -346,7 +337,8 @@ typedef struct {
Mark * marks; /* Pointer to an array of marks. */
} Mark_list;
#define EMPTY_MARK_LIST_i ((Mark_list) { 0, NULL })
#define EMPTY_MARK_LIST_i { 0, NULL }
extern const Mark_list EMPTY_MARK_LIST;
......@@ -355,7 +347,7 @@ typedef struct {
Conf_no *conf_nos;
} Conf_no_list;
#define EMPTY_CONF_NO_LIST_i ((Conf_no_list) { 0, NULL })
#define EMPTY_CONF_NO_LIST_i { 0, NULL }
extern const Conf_no_list EMPTY_CONF_NO_LIST;
......@@ -364,18 +356,17 @@ typedef struct {
Member * members;
} Member_list;
#define EMPTY_MEMBER_LIST_i ((Member_list) { 0, NULL })
#define EMPTY_MEMBER_LIST_i { 0, NULL }
extern const Member_list EMPTY_MEMBER_LIST;
typedef struct {
Local_text_no first_local_no;
unsigned long no_of_texts;
Text_no * texts;
} Text_list;
#define EMPTY_TEXT_LIST_i ((Text_list) { 1, 0, NULL })
#define EMPTY_TEXT_LIST_i { 1, 0, NULL }
extern const Text_list EMPTY_TEXT_LIST;
......@@ -400,10 +391,10 @@ typedef struct {
} Conf_list;
#define EMPTY_CONF_LIST_OLD_i ((Conf_list_old) { 0, NULL, NULL })
#define EMPTY_CONF_LIST_OLD_i { 0, NULL, NULL }
extern const Conf_list_old EMPTY_CONF_LIST_OLD;
#define EMPTY_CONF_LIST_i ((Conf_list) { 0, NULL })
#define EMPTY_CONF_LIST_i { 0, NULL }
extern const Conf_list EMPTY_CONF_LIST;
......@@ -413,7 +404,7 @@ typedef struct {
Pers_no * persons;
} Pers_list;
#define EMPTY_PERS_LIST_i ((Pers_list) { 0, NULL })
#define EMPTY_PERS_LIST_i { 0, NULL }
extern const Pers_list EMPTY_PERS_LIST;
......@@ -423,11 +414,10 @@ typedef struct {
Membership * confs;
} Membership_list;
#define EMPTY_MEMBERSHIP_LIST_i ((Membership_list) { 0, NULL })
#define EMPTY_MEMBERSHIP_LIST_i { 0, NULL }
extern const Membership_list EMPTY_MEMBERSHIP_LIST;
/* The Info struct */
typedef struct {
long version;
......@@ -471,16 +461,16 @@ typedef struct {
#ifdef CLIENT
# define EMPTY_CONFERENCE_i ((Conference) \
# define EMPTY_CONFERENCE_i \
{ 0, NULL_TIME_i, 0, 0, 0, 0, NULL_CONF_TYPE_i, \
NULL_TIME_i, 0, 0, EMPTY_STRING_i, 0, 0, 0 \
})
}
#else /* SERVER */
# define EMPTY_CONFERENCE_i ((Conference) \
# define EMPTY_CONFERENCE_i \
{ 0, NULL_TIME_i, 0, 0, 0, 0, NULL_CONF_TYPE_i, \
NULL_TIME_i, 0, 0, EMPTY_STRING_i, \
EMPTY_MEMBER_LIST_i, EMPTY_TEXT_LIST_i \
})
}
#endif /* SERVER */
extern const Conference EMPTY_CONFERENCE;
......@@ -493,11 +483,9 @@ typedef struct {
Garb_nice nice; /* Number of days to live */
} Small_conf;
#define EMPTY_SMALL_CONF_i ((Small_conf){EMPTY_STRING_i, NULL_CONF_TYPE_i, \
0, 0});
#define EMPTY_SMALL_CONF_i {EMPTY_STRING_i, NULL_CONF_TYPE_i, 0, 0};
extern const Small_conf EMPTY_SMALL_CONF;
#endif
#endif /* SERVER */
/* Struct for persons */
......@@ -532,24 +520,23 @@ typedef struct {
} Person;
#ifdef SERVER
# define EMPTY_PERSON_i ((Person) \
# define EMPTY_PERSON_i \
{ 0, DEFAULT_PRIV_BITS_i, \
DEFAULT_PERSONAL_FLAGS_i, NULL_TIME_i, 0, 0, \
0, 0, 0, 0, 0, 0, EMPTY_STRING_i, \
EMPTY_TEXT_LIST_i, EMPTY_MARK_LIST_i, \
EMPTY_MEMBERSHIP_LIST_i, "\001password" \
})
}
#else
# define EMPTY_PERSON_i ((Person) \
# define EMPTY_PERSON_i \
{ 0, DEFAULT_PRIV_BITS_i, \
DEFAULT_PERSONAL_FLAGS_i, NULL_TIME_i, 0, 0, \
0, 0, 0, 0, 0, 0, EMPTY_STRING_i, 0, 0, 0, 0 \
})
}
#endif
extern const Person EMPTY_PERSON;
/*
* This struct is returned from the 'who_is_on' call.
*/
......@@ -577,11 +564,8 @@ typedef struct {
Session_no session_no; /* Serial number of connection. */
} Who_info_ident;
#define EMPTY_WHO_INFO_IDENT_i ((Who_info_ident) \
{ 0, EMPTY_STRING_i, EMPTY_STRING_i, \
EMPTY_STRING_i, EMPTY_STRING_i, \
0, 0 })
#define EMPTY_WHO_INFO_IDENT_i \
{ 0, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i, 0, 0 }
extern const Who_info_ident EMPTY_WHO_INFO_IDENT;
typedef struct {
......@@ -594,9 +578,9 @@ typedef struct {
unsigned long idle_time; /* Seconds. */
} Session_info;
#define EMPTY_SESSION_INFO_i ((Session_info) { 0, EMPTY_STRING_i, \
EMPTY_STRING_i, 0, 0, \
NULL_TIME_i, 0 })
#define EMPTY_SESSION_INFO_i { 0, EMPTY_STRING_i, \
EMPTY_STRING_i, 0, 0, \
NULL_TIME_i, 0 }
extern const Session_info EMPTY_SESSION_INFO;
......@@ -613,20 +597,17 @@ typedef struct {
unsigned long idle_time; /* Seconds. */
} Session_info_ident;
#define EMPTY_SESSION_INFO_IDENT_i ((Session_info_ident)\
#define EMPTY_SESSION_INFO_IDENT_i \
{ 0, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i, \
EMPTY_STRING_i, 0, 0, \
NULL_TIME_i, 0 })
NULL_TIME_i, 0 }
extern const Session_info_ident EMPTY_SESSION_INFO_IDENT;
#define EMPTY_WHO_INFO_OLD_i ((Who_info_old) { 0, EMPTY_STRING_i, 0 })
#define EMPTY_WHO_INFO_i ((Who_info) { 0, EMPTY_STRING_i, \
EMPTY_STRING_i, 0, 0 })
#define EMPTY_WHO_INFO_OLD_i { 0, EMPTY_STRING_i, 0 }
#define EMPTY_WHO_INFO_i { 0, EMPTY_STRING_i, EMPTY_STRING_i, 0, 0 }
extern const Who_info_old EMPTY_WHO_INFO_OLD;
extern const Who_info EMPTY_WHO_INFO;
......@@ -636,8 +617,8 @@ typedef struct {
Who_info_old * info;
} Who_info_list_old;
#define EMPTY_WHO_INFO_LIST_OLD_i ((Who_info_list_old) { 0, NULL })
extern const Who_info_list_old EMPTY_WHO_INFO_LIST_OLD;
#define EMPTY_WHO_INFO_LIST_OLD_i { 0, NULL }
extern const Who_info_list_old EMPTY_WHO_INFO_LIST_OLD;
typedef struct {
......@@ -645,7 +626,7 @@ typedef struct {
Who_info * info;
} Who_info_list;
#define EMPTY_WHO_INFO_LIST_i ((Who_info_list) { 0, NULL })
#define EMPTY_WHO_INFO_LIST_i { 0, NULL }
extern const Who_info_list EMPTY_WHO_INFO_LIST;
typedef struct {
......@@ -653,9 +634,9 @@ typedef struct {
Who_info_ident * info;
} Who_info_ident_list;
#define EMPTY_WHO_INFO_IDENT_LIST_i ((Who_info_ident_list) { 0, NULL })
#define EMPTY_WHO_INFO_IDENT_LIST_i { 0, NULL }
extern const Who_info_ident_list EMPTY_WHO_INFO_IDENT_LIST;
#define EMPTY_tm_i ((struct tm){0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0})
#define EMPTY_tm_i {0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0}
#endif /* ifndef KOM_TYPES_H_ALREADY_INCLUDED__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment