|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 4400 (0x1130) Types: TextFile Names: »misc.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit └─⟦653021b30⟧ »EurOpenD3/utils/downtime.tar.Z« └─⟦946c717da⟧ └─⟦this⟧ »misc.c«
/* * Copyright (c) 1988 Michael A. Cooper, University of Southern California. * This program may be used, copied, modified, and redistributed freely * for noncommercial purposes, so long as this notice remains intact. */ #ifndef lint static char *RCSid = "$Header: misc.c,v 4.3 88/07/05 16:00:23 mcooper Exp $"; #endif /* *------------------------------------------------------------------ * * $Source: /usr/skat3/src/common/usc/etc/downtime/RCS/misc.c,v $ * $Revision: 4.3 $ * $Date: 88/07/05 16:00:23 $ * $State: Exp $ * *------------------------------------------------------------------ * * Michael A. Cooper * Research and Development Group * University Computing Services * University of Southern California * (mcooper@oberon.USC.EDU) * *------------------------------------------------------------------ * * $Log: misc.c,v $ * Revision 4.3 88/07/05 16:00:23 mcooper * Added copyright notice. * * Revision 4.2 88/07/01 16:57:23 mcooper * Sprinkled some comments around. * * Revision 4.1 88/06/10 13:10:27 mcooper * In prinfo() print MOTD_DONE if * set. * * Revision 4.0 88/04/20 15:42:51 mcooper * Version 4. * * Revision 3.4 88/04/20 13:37:50 mcooper * Replace F_BROADCAST with F_MSG_REMOTE. * Added F_MSG_LOCAL. * * Revision 3.3 88/04/19 18:26:25 mcooper * Added stmsg() for printing status messages * of what's going on, and itoa(). * * Revision 3.2 88/04/11 19:48:33 mcooper * Converted all dt_flags to use flag * bits. * * Revision 3.1 88/02/04 11:07:52 mcooper * Added xmalloc(). * * Revision 3.0 87/07/24 14:20:30 mcooper * Version 3. * *------------------------------------------------------------------ */ #include <stdio.h> #include <ctype.h> #include "defs.h" /* * prinfo - Print information about a given downtime entry. */ prinfo(d) struct downtime *d; { char flg[BUFSIZ]; /* * Start checking flags */ strcpy(flg, ""); if (d->dt_flags & F_KILL) strcat(flg, "KILL "); else if (d->dt_flags & F_HALT) strcat(flg, "HALT "); else if (d->dt_flags & F_REBOOT) strcat(flg, "REBOOT "); else if (d->dt_flags & F_FAKE) strcat(flg, "FAKE "); if (d->dt_flags & F_MOTD) strcat(flg, "MOTD "); else strcat(flg, "NO_MOTD "); if (d->dt_flags & F_DONEMOTD) strcat(flg, "MOTD_DONE "); if (d->dt_flags & F_FASTBOOT) strcat(flg, "FASTBOOT "); else if (d->dt_flags & F_NOSYNC) strcat(flg, "NOSYNC "); if (d->dt_flags & F_SHUTMSG_ONE) strcat(flg, "SHORT_MSGS "); else if (d->dt_flags & F_SHUTMSG_VER) strcat(flg, "VERBOSE_MSGS "); if (d->dt_flags & F_MSG_LOCAL) strcat(flg, "LOCAL_MSGS "); else strcat(flg, "NO_LOCAL_MSGS "); #ifdef RPCWALL if (d->dt_flags & F_MSG_REMOTE) strcat(flg, "REMOTE_MSGS "); else strcat(flg, "NO_REMOTE_MSGS "); #endif RPCWALL printf("\tScheduled Down: %s\n", mkdate(d->dt_down, D_DATE)); printf("\t Scheduled Up: %s\n", mkdate(d->dt_up, D_DATE)); printf("\t Entry Dated: %s\n", mkdate(d->dt_orderdown, D_DATE)); printf("\t Scheduled By: %s@%s\n", d->dt_shutter, d->dt_host); printf("\t Reason: %s\n", ((strcmp(d->dt_reason, EMPTY) == 0) ? "[ Non Specified ]" : d->dt_reason)); printf("\t Flags: %s\n", flg); printf("\t Process ID: "); if (d->dt_islocked) printf("%d\n", d->dt_islocked); else printf("[ NONE ]\n"); } /* * Toggle debugging information. */ dbug () { verbose != verbose; printf ("Debugging is now %s\r\n", debug ? "ON" : "OFF"); } /* * Print version information. */ prversion() { extern char *version; printf("Version %s.\n", version); } /* * Convert integers to ascii. */ char * itoa(i) int i; { char buf[100]; sprintf(buf, "%d", i); return((char *) buf); } /* * Print status messages when debugging is set correctly. */ stmsg(fmt, a1, a2, a3, a4, a5, a6) char *fmt; { if (verbose >= 5) { printf(fmt, a1, a2, a3, a4, a5, a6); fflush(stdout); } } /* * isblank - Is buf blank (empty or all white space)? */ isblank(buf) char *buf; { char *p; if (buf[0] == '\n') { /* Just a newline */ return(1); } else if (buf[0] != ' ' && buf[0] != '\t') { /* text? */ return(0); } else { /* all white space? */ p = buf; while (p && *p++ && *p != '\n') { if (*p != ' ' && *p != '\t') { return(0); } } return(1); } }