[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

627.0. "Looking for SETPREFS" by Z::TENNY (Dave Tenny | DTN 225-6089) Sun Aug 02 1987 19:34

Does anyone have on-line, or would anyone upload the SETPREFS utility?
I think there's a very old preference setting tools called PREFS too,
but I'm not sure if it works under 1.2.  

I want to zap my preferencs from amigados/shell scripts.

Thanks,
Dave
T.RTitleUserPersonal
Name
DateLines
627.1devs/system-configuration a struct preferences?Z::TENNYDave Tenny | DTN 225-6089Sun Aug 02 1987 20:2210
Thanks for the (misplaced?) reply in 591.19,
the documentation for the SetPrefs call.
Can I just read the devs/system-configuration file into
a preferences structure and use that for the call?

I have several versions of preferences that I use,
in particular, my wife likes her own colors...
(what's wrong with brown,white/violet/black :-)

Dave
627.2Works on TuesdaysZ::TENNYDave Tenny | DTN 225-6089Sun Aug 02 1987 23:2515
Never mind .-1; I figured it out.  The program works when compiled
with +p, linked with -lcl32.  I couldn't figure out how to suppress
these warnings, after much casting etc.  I suspect they are the problem.
Any ideas???  Source code (which works when compeled as above) follows
in next note.  I would like to know why it won't work with 16bit ints.

Aztec C68K 3.4a  2-3-87  (C) 1982-1987 by Manx Software Systems, Inc.
			OpenLibrary("intuition.library", 31L)))
			                                      ^
prefs.c:35: WARNING 121: ptr/int conversion: 
F_CHIP) ;
         ^
prefs.c:46: WARNING 121: ptr/int conversion: 
Aztec 68000 Assembler 3.4a  2-3-87
627.3A preference setting program, sometimes.Z::TENNYDave Tenny | DTN 225-6089Sun Aug 02 1987 23:2669
/* This program takes a system-configuration file and makes it the
   current preferences.

   Compile this with +p, link with -lcl32.
   What have I missed that it won't work with 16bit ints?
   
*/
#include <stdio.h>
#include <fcntl.h>
#include <exec/types.h>
#include <exec/memory.h>
#include <intuition/intuition.h>

struct IntuitionBase *IntuitionBase ;

#define PREFSIZE sizeof(struct Preferences)
#define go(s) {puts(s);fflush(stdout);}

main(argc, argv)
  int argc;
  char **argv ;
{				/* main */

struct Preferences *p ;
int fd ; 

/* Text */
if (argc < 2)
   {
   puts("Usage: prefs preferences-file (e.g. devs/system-configuration)") ;
   exit(0) ;
   }

if (!(IntuitionBase = (struct IntuitionBase *)
			OpenLibrary("intuition.library", 31L)))
   exit(16) ;		

fd = open(argv[1], O_RDONLY) ;
if (fd < 0)
   {
   puts("Error opening file.") ;
   CloseLibrary(IntuitionBase) ;
   exit(8) ;
   }

p = (struct Preferences *) AllocMem((long) PREFSIZE, (long) MEMF_CHIP) ;
if (!p)
   {
   puts("Error allocating memory.") ;
   close(fd) ;
   CloseLibrary(IntuitionBase) ;
   exit(8) ;
   }

if (read(fd, p, PREFSIZE) < PREFSIZE)
   {
   puts("Not enough bytes in file, or error reading.") ;
   close(fd) ;
   FreeMem(p, (long) PREFSIZE) ;
   CloseLibrary(IntuitionBase) ;
   exit(8) ;
   }

SetPrefs(p, (long) PREFSIZE, (long) TRUE) ;
FreeMem(p, (long) PREFSIZE) ;
close(fd) ;
CloseLibrary(IntuitionBase) ;
exit(0) ;
}					/* main */
627.4Declare FunctionsTLE::RMEYERSRandy MeyersMon Aug 03 1987 14:0410
Re: .3

It appears you didn't declare all of the functions you are using.

For example, OpenLibrary returns a pointer.  You didn't declare
it, so the Manx compiler thinks it returns a 16 bit int.  Since you
then cast the int to a pointer, the compiler just zero extends the
16 bit quantity to 32 bits.  Since the intuition.library is in Kickstart,
its start vector isn't within the first 64k of the machine, so the
result is garbage.
627.5the answerZ::TENNYDave Tenny | DTN 225-6089Mon Aug 03 1987 18:4410

re: .4

Give the man a cigar.  That was the problem.
The 16bit version links at 4700 bytes, about 2000 bytes less than
using the +p option.

Thanks,
Dave
627.6There is a header fileNOVA::RAVANTue Aug 18 1987 14:275
    If I recall correctly, there is a Manx header file that declares
    all the Amiga functions.  I think it is called ... functions.h ?
    Maybe.  '#include'ing it should get rid of most problems like this.
    
    -jim
627.7stdlib.hNULL::TORNHEIMTue Aug 18 1987 16:197
    or maybe
    
    	# include	<stdlib.h>
    
    I recently had a problem because I didn't include this file in
    a VAXC program.

627.8I hope notTLE::RMEYERSRandy MeyersTue Aug 18 1987 17:165
Re: .7

Personally, I hope the Amiga functions are not declared in stdlib.h.
The file's contents is specified by the draft ANSI C standard.  Putting
lots of OS specific stuff in there is in somewhat bad taste.