Difference between revisions of "FreeBSD Programming Tips"

From Free Pascal wiki
Jump to navigationJump to search
(→‎Commonly used Unix commands: Added new section)
Line 26: Line 26:
 
*[[LCL Internals]] - Some info about the inner workings of the LCL
 
*[[LCL Internals]] - Some info about the inner workings of the LCL
 
*[[Windows CE Development Notes]] - For Pocket PC and Smartphones
 
*[[Windows CE Development Notes]] - For Pocket PC and Smartphones
 +
 +
==Commonly used Unix commands==
 +
 +
If you’re coming to FreeBSD from Windows, you may find some of its Unix terminal commands confusing. Here are some equivalents. For more information about a command, enter man ''command'' in a console or xterm.
 +
 +
{| class="wikitable"
 +
! Action !! Windows command prompt window !! FreeBSD console or X11 xterm
 +
|-
 +
|Change to a different directory||cd||cd
 +
|-
 +
|Make a new directory||mkdir||mkdir
 +
|-
 +
|Delete a directory||rmdir||rmdir
 +
|-
 +
|List file directory in chronological order with detail||dir /od||ls -ltr
 +
|-
 +
|Copy a file, preserving its date-time stamp||copy||cp -p
 +
|-
 +
|Display contents of a text file||type||cat
 +
|-
 +
|Delete a file||erase||rm
 +
|-
 +
|Move a file||move||mv
 +
|-
 +
|Rename a file||ren||mv
 +
|-
 +
|Find a file||dir /s||find
 +
|-
 +
|Grep a file||findstr||grep
 +
|-
 +
|Display differences between two text files||fc||diff
 +
|-
 +
|Change file attributes||attrib||chmod
 +
|-
 +
|“Super-user” root authorization||N/A||sudo
 +
|-
 +
|Create symbolic link to a file or directory||N/A||ln
 +
|-
 +
|Shrink executable file size||strip (included w/ Free Pascal)||strip
 +
|-
 +
|Download source from subversion repo||TortoiseSVN||svnlite
 +
|}
 +
  
 
== Configuration Files ==
 
== Configuration Files ==

Revision as of 10:59, 20 July 2019

English (en)

Light bulb  Note: Work in Progress

FreeBSD Programming Tips

Other Interfaces

Platform specific Tips

Interfaces Development Articles

Commonly used Unix commands

If you’re coming to FreeBSD from Windows, you may find some of its Unix terminal commands confusing. Here are some equivalents. For more information about a command, enter man command in a console or xterm.

Action Windows command prompt window FreeBSD console or X11 xterm
Change to a different directory cd cd
Make a new directory mkdir mkdir
Delete a directory rmdir rmdir
List file directory in chronological order with detail dir /od ls -ltr
Copy a file, preserving its date-time stamp copy cp -p
Display contents of a text file type cat
Delete a file erase rm
Move a file move mv
Rename a file ren mv
Find a file dir /s find
Grep a file findstr grep
Display differences between two text files fc diff
Change file attributes attrib chmod
“Super-user” root authorization N/A sudo
Create symbolic link to a file or directory N/A ln
Shrink executable file size strip (included w/ Free Pascal) strip
Download source from subversion repo TortoiseSVN svnlite


Configuration Files

Refer to the Multiplatform Programming Guide Configuration files section.

Making a Beep

As SysUtils.Beep has no effect on FreeBSD, I looked around for a way to make a beep and found nothing useful. So, I reinvented the wheel as follows:

    {$IFDEF FREEBSD}
    procedure FBSDbeep;
    var
      BProcess: TProcess;
      begin
        BProcess:= TProcess.Create(nil);
        BProcess.CommandLine := 'sh -c "echo xxxxxxx > /dev/dsp"';
        BProcess.Execute;
        BProcess.Free;
      end;
    {$ENDIF}

Note: /dev/dsp will automatically reroute to the sound device's correct device node (eg /dev/dsp0.0) using the dynamic devfs(5) clone handler.

Qualifications

  • Ok, it's more of a burp than a beep, but it serves the purpose. If you're really fussy, you could send a real .wav file to /dev/dsp and play any musical note(s) you desire.
  • If FreeBSD is using a GENERIC kernel, it will work.
  • If FreeBSD is using a custom kernel and it's a desktop system, then it will most probably work because who doesn't want sound on their desktop system.
  • If FreeBSD is using a custom kernel and is running on a server, it may not work. I don't see this as a significant defect in user applications which is its use case for my purposes.

Using HTTPS

Placeholder. Content to come.