|
|
1.1 ! root 1: static char ID[] = "@(#) redeem.c: 1.1 3/16/82"; ! 2: #include <stdio.h> ! 3: #include "sdp.h" ! 4: #include "define3.h" ! 5: ! 6: #ifdef SHORT ! 7: #define RE01 "RE01 " ! 8: #define RE02 "RE02 " ! 9: #define RE03 "RE03 " ! 10: #define RE04 "RE04 " ! 11: #define RE05 "RE05 " ! 12: #define REAU "REAU " ! 13: #else ! 14: #define RE01 "RE01 -- space not connected\n%o\n",sp ! 15: #define RE02 "RE02 -- no permission to redeem\n%o\n",sp ! 16: #define RE03 "RE03 -- id out of range\n%lo\t%lo\n",id,sp->maxpage ! 17: #define RE04 "RE04 -- id not aligned\n%o\t%lo\n",sp,id ! 18: #define RE05 "RE05 -- fail to push\n%o\t%lo\n",sp,id ! 19: #define REAU "%s","REAU -- audit failed in sdp_redeem\n" ! 20: #endif ! 21: ! 22: #ifdef SWEET ! 23: #define PROLOG ! 24: #define EPILOG ! 25: #else ! 26: #define PROLOG if( (aud_flag == AUDITON) && (aud_check() == ERROR) )\ ! 27: ERR_RET(REAU,ERROR) ! 28: #define EPILOG if(aud_flag == AUDITON)\ ! 29: aud_set() ;\ ! 30: if(hist_fp != NULL)\ ! 31: fprintf(hist_fp,"RE\t%o\t%ld\t%u\n",sp,id,howmuch) ; ! 32: #endif ! 33: ! 34: extern int aud_flag ; ! 35: extern struct LIBFILE *Glib_file ; ! 36: extern FILE *hist_fp ; ! 37: ! 38: extern int aud_check() ; ! 39: extern aud_set() ; ! 40: extern FATAL() ; ! 41: extern push_id() ; ! 42: extern spsearch() ; ! 43: ! 44: int /* SUCCESS or ERROR */ ! 45: sdp_redeem(sp,id,howmuch) ! 46: struct SPACE *sp ; ! 47: ITEMID id ; ! 48: unsigned howmuch ; ! 49: { ! 50: ! 51: PROLOG ! 52: ! 53: if(spsearch(sp) == NOTFOUND) ! 54: ERR_RET(RE01,ERROR) ! 55: ! 56: if(sp->perms != WRTN) ! 57: ERR_RET(RE02,ERROR) ! 58: ! 59: if(INVALID(sp,id)) ! 60: ERR_RET(RE03,ERROR) ! 61: ! 62: howmuch = (unsigned)ALIGNID((ITEMID)howmuch) ; ! 63: if(id != ALIGNID(id)) ! 64: ERR_RET(RE04,ERROR) ! 65: ! 66: Glib_file = sp->lib_file ; ! 67: ! 68: if(push_id(sp,id,howmuch) == ERROR) ! 69: ERR_RET(RE05,ERROR) ! 70: ! 71: EPILOG ! 72: return(SUCCESS) ; ! 73: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.