🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #9043

Re: Free memory available

#9043
From: mwm
Date: Wed, 01 Jun 1988 02:51
48 lines
2072 bytes
In article <6743@cit-vax.Caltech.Edu> glewis@cit-vax.UUCP (Glenn M. Lewis) writes:
<	I want to make a command that takes one argument, a memory size,
<and compares it to the amount of free memory available, and if there is more
<than the argument, it will return a "true" error code, so that I can test
<it with the AmigaDOS command "IF".  (What is a boolean "true" error code
<in AmigaDOS, by the way?)

Almost forgot - I wrote that program for FAST memory quite a while
back. It's short and simple, so here's a copy.

	<mike

/*
 * fast-mem-p - exit 6 (WARN) if there is more K of fast mem than
 *      the argument. Default is zero.
 *
 *      Copyright (c) this? Are you kidding?
 *
 * Typical useage would be something like:
 *
 *      fast-mem-p      2048    ; Have I got two meg or more of fast?
 *      if warn
 *              ; yes, do whatever setup you want here.
 *      else
 *              ; no, do small-time setup here.
 *      endif
 *
 * For more power, (and more size), see "enough", on Fish disk 29.
 */

#include <exec/types.h>
#include <exec/memory.h>

void
_main(argc, argv) char **argv; {
        register ULONG required ;
        ULONG           AvailMem() ;

        required = (ULONG) (argc > 1 ? atoi(argv[1]) : 0) ;
        if ((AvailMem(MEMF_FAST) >> 10) > required) exit(6) ;
        exit(0) ;
        }

--
So this is where the future lies			Mike Meyer
In a beer gut belly; In an open fly			mwm@berkeley.edu
Brilcreamed, acrylic, mindless boys			ucbvax!mwm
Punching, kicking, making noise				mwm@ucbjade.BITNET
Technical Details
Message-ID: <10434@agate.BERKELEY.EDU>
Path: arc1-ca.pugleaf.net!utzoo!dciem!nrcaer!scs!spl1!laidbak!att!chinet!mcdchg!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!bloom-beacon!tut.cis.ohio-stat
References: <6743@cit-vax.Caltech.Edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!dciem!nrcaer!scs!spl1!laidbak!att!chinet!mcdchg!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!bloom-beacon!tut.cis.ohio-stat
From: mwm@eris.UUCP
Newsgroups: comp.sys.amiga.tech
Subject: Re: Free memory available
Message-ID: <10434@agate.BERKELEY.EDU>
Date: 1 Jun 88 02:51:59 GMT
Article-I.D.: agate.10434
References: <6743@cit-vax.Caltech.Edu>
Sender: usenet@agate.BERKELEY.EDU
Distribution: na
Organization: Missionaria Phonibalonica
Lines: 48