Hello,

  I very bad in C language and I have following program written for
  Linux. I need to change this source for working on bsd could you
  help me? This programm shlould control LED on lpt port.

file pokus.c
----------------------------
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/io.h>
#define base 0x378 /* adresa paralelneho portu*/
main(int argc, char **argv)
{
int value;
if (argc!=2)
fprintf(stderr, "Bad number of arguments.\n"), exit(1);
if (sscanf(argv[1],"%i",&value)!=1)
fprintf(stderr, "Argument isnt a number.\n"), exit(1);
if ((value<0) || (value>255))
fprintf(stderr, "Bad range\n"),
exit(1);
if (ioperm(base,1,1))
fprintf(stderr, "Port doesnt exists on address %x\n", base),
exit(1);
outb((unsigned char)value, base);
}
-----------------------------


I switched #include <sys/io.h> to #include <i386/pio.h> , but
complilation with command # gcc -O pokus.c -o pokus
fails.

# gcc -O pokus.c -o pokus
pokus.c: In function `main':
pokus.c:18: warning: comparison is always true due to limited range of data type
pokus.c:18: warning: large integer implicitly truncated to unsigned type
pokus.c:18: warning: large integer implicitly truncated to unsigned type
/tmp//ccTe4507.o(.text+0x81): In function `main':
: undefined reference to `ioperm'
collect2: ld returned 1 exit status


-- 
Regards,
 Bc. Radek Krejca
 [EMAIL PROTECTED]
 http://www.ceskedomeny.cz
 http://www.skdomeny.com
 http://www.starnet.cz

Reply via email to