clang FreeBSD question

Karl Young freebsd at kipshouse.org
Tue Dec 4 19:23:26 UTC 2018


This mail never made it to the list.  I see I sent it from a different
address than I subscribed with.  Trying again.

FreeBSD should be Posix-compliant.  It looks like the _POSIX_SRC macro
is obsolete, but you might try defining it.

https://www.freebsd.org/cgi/man.cgi?query=feature_test_macros&manpath=SuSE+Linux/i386+11.3



James B. Byrne via freebsd-questions(freebsd-questions at freebsd.org)@2018.12.03 17:10:19 -0500:
> 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
> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list