|
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 r
Length: 4022 (0xfb6) Types: TextFile Names: »rd_msg.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« └─⟦e5a54fb17⟧ └─⟦this⟧ »pp-5.0/Lib/io/rd_msg.c«
/* rd_msg.c: read in a msg from the queue + write addr offset routines */ # ifndef lint static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/io/RCS/rd_msg.c,v 5.0 90/09/20 16:06:49 pp Exp Locker: pp $"; # endif /* * $Header: /cs/research/pp/hubris/pp-beta/Lib/io/RCS/rd_msg.c,v 5.0 90/09/20 16:06:49 pp Exp Locker: pp $ * * $Log: rd_msg.c,v $ * Revision 5.0 90/09/20 16:06:49 pp * rcsforce : 5.0 public release * */ /* -- These routines are 'high level' taking care of most of the housekeeping. -- */ #include "head.h" #include "q.h" #include <sys/file.h> #include <isode/cmd_srch.h> #include "prm.h" extern void getfpath (); extern int errno; extern char *aquedir, *no2txt3(); static FILE *msg_fp; static char msgname[FILNSIZE]; int ad_count; void rd_end (); /* --------------------- Read Message Routines -------------------------- */ int rd_msg (file, prm, que, sender, recip, rcount) char *file; struct prm_vars *prm; Q_struct *que; ADDR **sender; ADDR **recip; int *rcount; { int retval; char real_aquedir[FILNSIZE]; extern char *quedfldir; PP_DBG (("Lib/io/rd_msg(%s%s)", aquedir, file)); getfpath (quedfldir, aquedir, real_aquedir); getfpath (real_aquedir, file, msgname); if ((msg_fp = flckopen (msgname, "r+")) == NULLFILE) { PP_SLOG (LLOG_EXCEPTIONS, msgname, ("Lib/io/rd_msg flckopen error")); return (RP_FOPN); } if (rp_isbad (retval = rd_prm (prm, msg_fp))) { PP_LOG (LLOG_EXCEPTIONS, ("Lib/io/rd_msg/rd_prm err: '%s'", msgname)); rd_end(); return (retval); } if (rp_isbad (retval = rd_q (que, msg_fp))) { PP_LOG (LLOG_EXCEPTIONS, ("Lib/io/rd_msg/rd_q err: '%s'", msgname)); rd_end(); return (retval); } if (rp_isbad (retval = rd_adr (msg_fp, TRUE, sender))) { PP_LOG (LLOG_EXCEPTIONS, ("Lib/io/rd_msg/rd_adr sender err: %s %s", rp_valstr (retval), msgname)); rd_end(); return (retval); } ad_count = 0; if (rp_isbad (retval = rd_adr (msg_fp, FALSE, recip))) { PP_LOG (LLOG_EXCEPTIONS, ("Lib/io/rd_msg/rd_adr recip err: %s %s", rp_valstr(retval), msgname)); rd_end(); return (retval); } que -> Oaddress = *sender; que -> Raddress = *recip; *rcount = ad_count; return (RP_OK); } void rd_end () { PP_DBG (("Lib/io/rd_end()")); if (msg_fp) (void) flckclose (msg_fp); msg_fp = NULLFILE; } /* --------------------- Write Address Offset Routines ------------------ */ int wr_ad_status (ap, status) ADDR *ap; int status; { char *str; extern CMD_TABLE atbl_status[]; PP_DBG (("Lib/io/wr_ad_status()")); if (msg_fp == NULLFILE) { PP_LOG (LLOG_EXCEPTIONS, ("Lib/io/wr_ad_status (NULLFILE)")); return (RP_MECH); } switch (status) { case AD_STAT_PEND: case AD_STAT_DONE: case AD_STAT_DRREQUIRED: case AD_STAT_DRWRITTEN: break; default: PP_LOG (LLOG_EXCEPTIONS, ("Lib/io/wr_ad_status unknown")); status = AD_STAT_UNKNOWN; break; } str = rcmd_srch (status, atbl_status); if (lseek (fileno (msg_fp), ap -> ad_stat_offset, 0) == -1) { PP_LOG (LLOG_FATAL, ("Lib/io/wr_ad_status lseek err %s", msgname)); return (RP_FIO); } if (write (fileno (msg_fp), str, 4) != 4) { PP_LOG (LLOG_FATAL, ("Lib/io/wr_ad_status write err %s", msgname)); return (RP_FIO); } return (RP_OK); } int wr_ad_rcntno (ap, rcnt) ADDR *ap; int rcnt; { char buf[5]; PP_DBG (("Lib/io/wr_ad_rcntno(%d)", rcnt)); if (msg_fp == NULLFILE) { PP_LOG (LLOG_EXCEPTIONS, ("Lib/io/wr_ad_rcntno (NULLFILE)")); return (RP_MECH); } if (lseek (fileno (msg_fp), ap -> ad_rcnt_offset, 0) == -1) { PP_LOG (LLOG_FATAL, ("Lib/io/wr_ad_rcntno lseek err %s", msgname)); return (RP_FIO); } if (write (fileno (msg_fp), no2txt3 (rcnt, &buf[0]), 3) != 3) { PP_LOG (LLOG_FATAL, ("Lib/io/wr_ad_rcntno write err %s", msgname)); return (RP_FIO); } return (RP_OK); }