+ ((val)<<4) + ((val)<<2) + (val)) /* *big* hack */
-extern const char *months[12];
-extern const char *daynames[7];
+extern const char * const months[12];
+extern const char * const daynames[7];
+
extern void caljulian (u_int32, struct calendar *);
extern u_int32 caltontp (const struct calendar *);
* excess! But then, we need no leap year flag, either...)
*/
extern ntpcal_split
-ntpcal_days_in_months(int32 months);
+ntpcal_days_in_months(int32 mons);
/*
* Convert ELAPSED years/months/days of gregorian calendar to elapsed
* days in Gregorian epoch. No range checks done here!
*/
extern int32
-ntpcal_edate_to_eradays(int32 years, int32 months, int32 mdays);
+ntpcal_edate_to_eradays(int32 years, int32 mons, int32 mdays);
/*
* Convert a time spec to seconds. No range checks done here!
* even if months & days are off-scale.
*/
extern int32
-ntpcal_edate_to_yeardays(int32 years, int32 months, int32 mdays);
+ntpcal_edate_to_yeardays(int32 years, int32 mons, int32 mdays);
/*
* Convert the date part of a 'struct tm' (that is, year, month,
static char *common_prettydate(l_fp *, int);
-const char * months[12] = {
+const char * const months[12] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
-const char * daynames[7] = {
+const char * const daynames[7] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
extern char * chosts[];
extern char currenthost[];
-int maxhostlen;
+size_t maxhostlen;
/*
* Declarations for command handlers in here
int af
)
{
- register int i;
+ u_int i;
char fullname[LENHOSTNAME];
sockaddr_u netnum;
* Holds association data for use with the &n operator.
*/
struct association assoc_cache[MAXASSOC];
-u_int numassoc = 0; /* number of cached associations */
+u_int numassoc; /* number of cached associations */
/*
* For commands typed on the command line (with the -c option)
if (a_info == 0)
freeaddrinfo(ai);
havehost = 1;
+ numassoc = 0;
+
return 1;
}
ai_fam_templ = AF_INET;
else if (!strcmp("-6", pcmd->argval[i].string))
ai_fam_templ = AF_INET6;
- else {
- if (havehost)
- (void) fprintf(fp,
- "current host remains %s\n",
- currenthost);
- else
- (void) fprintf(fp, "still no current host\n");
- return;
- }
+ else
+ goto no_change;
i = 1;
}
if (openhost(pcmd->argval[i].string)) {
- (void) fprintf(fp, "current host set to %s\n", currenthost);
- numassoc = 0;
+ fprintf(fp, "current host set to %s\n", currenthost);
} else {
+ no_change:
if (havehost)
- (void) fprintf(fp,
- "current host remains %s\n",
- currenthost);
+ fprintf(fp, "current host remains %s\n",
+ currenthost);
else
- (void) fprintf(fp, "still no current host\n");
+ fprintf(fp, "still no current host\n");
}
}