clang FreeBSD question

James B. Byrne byrnejb at harte-lyne.ca
Mon Dec 3 22:10:43 UTC 2018


I am hacking an old terminal emulator program originally written for
something other than FreeBSD. Ihave encountered this error:

cc -I../ -I../BSDI -I/usr/include -I/usr/local/include  
-DSHOW_DC1_COUNT=0 -DDEBUG_BREAK=0 -DIGNORE_KEYBOARD_LOCK=1
-DIGNORE_USER_SYSTEM_LOCK=1 -DDEBUG_BLOCK_MODE=0 -DMEMLOCK_2000 -c
tty.c
tty.c:179:28: error: use of undeclared identifier 'CBAUD'
  curr_termio.c_cflag &= ~(CBAUD);


The code in question looks like this:

#ifdef _POSIX_SOURCE
  if (cfsetispeed((PTERMIO)&curr_termio, speed) == -1)
    {
      printf ("Error %d from cfsetispeed(%s)\n", errno, deviceinfo);
      show_tty_error ("cfsetispeed()", errno);
      return(-1);
    }
  if (cfsetospeed((PTERMIO)&curr_termio, speed) == -1)
    {
      printf ("Error %d from cfsetospeed(%s)\n", errno, deviceinfo);
      show_tty_error ("cfsetospeed()", errno);
      return(-1);
    }
#else
  curr_termio.c_cflag &= ~(CBAUD);
  curr_termio.c_cflag |= speed;

I can guess that FreeBSD is not a POSIX compliant OS, or at least does
not declar itself so in the manner the programmer expected.  However,
the only other references to CBAUD that I can find on this system is:

/usr/local/include/gphoto2/gphoto2-port-portability.h:99:#   define
CBAUD   0x0000100f
/usr/local/include/gphoto2/gphoto2-port-portability.h:129:#   define
CBAUDEX 0x00001000

Soooo.  The question is: Do I just define CBAUD by copy and paste into
a header file and add that to the complier includes?  Or is their a
more informed and elegant answer to my problem?



-- 
***          e-Mail is NOT a SECURE channel          ***
        Do NOT transmit sensitive data via e-Mail
 Do NOT open attachments nor follow links sent by e-Mail

James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3



More information about the freebsd-questions mailing list