FBB::Tty(3bobcat)

πŸ’… FBB::Tty β€” a.k.a. the 3bobcat page babe, "Controls echoing of characters"

okay so bestie, welcome to FBB::Tty(3bobcat), the lil guy who decides whether the terminal shows what you're typing or keeps it lowkey secret πŸ‘€


✨ NAME ✨

FBB::Tty β€” Controls echoing of characters entered at the terminal πŸŽ€


🌸 SYNOPSIS 🌸

#include <bobcat/tty>
Linking option: -lbobcat

πŸ’– DESCRIPTION πŸ’–

So like, Tty(3bobcat) objects are literally your little remote control for the echoing of characters typed at the terminal (usually at /dev/tty). And the reason you'd read straight from /dev/tty is iconic: it lets programs grab info (passwords, pass phrases, all that secret-girl stuff πŸ™ˆ) even when the standard input stream is redirected to a file. And fun fact, unless it's been redirected, std::cin is connected to /dev/tty. no cap.

You can use Tty(3bobcat) objects as stand-alone besties, or β€” and this is the usual move β€” you can insert or extract (usually anonymous) Tty(3bobcat) objects into or out of streams. And here's the thing: when you insert or extract those objects, the streams themselves are NOT affected. The only thing getting manipulated is the echoing of characters entered at /dev/tty. the way that works is so clean fr fr.

⚠️ ok important, listen up: Tty(3bobcat)'s destructor does NOT reset the echo-state of /dev/tty back to its original value. it literally does not. so if you need that, you have to construct a Tty(3bobcat) object first, and then call its echo(Tty::RESET) member at the right moment. periodt.

πŸ¦‹ NAMESPACE πŸ¦‹

FBB

Every single constructor, member, operator and manipulator mentioned in this man-page is defined in the namespace FBB. that's the whole vibe.


🌈 INHERITS FROM 🌈

-

(yeah bestie, it inherits from nothing. it's self-made. main character energy πŸ‘‘)


πŸŽ€ ENUM πŸŽ€

The enum EchoType requests the type of echo-handling:

  • RESET β€” used to reset /dev/tty's state back to the actual state it had when a Tty(3bobcat) object was constructed
  • ON β€” used to activate echoing of characters entered at /dev/tty
  • OFF β€” used to suppress echoing of characters entered at /dev/tty

🧚 CONSTRUCTORS 🧚

  • Tty() β€” the current state of /dev/tty is saved. πŸ’Ύ
  • Tty(EchoType type) β€” the current state of /dev/tty is saved, and the object's member echo(type) is called. two things at once, we love a multitasker ✨

Copy and move constructors (and assignment operators) are available. πŸ’…


πŸ”₯ OVERLOADED OPERATORS πŸ”₯

  • std::istream &operator>>(std::istream &in, Tty const &tty) β€” the extraction operator does not affect in, but /dev/tty's state is set according to the way the tty object was constructed.
  • std::ostream &operator<<(std::ostream &out, Tty const &tty) β€” the insertion operator does not affect out, but /dev/tty's state is set according to the way the tty object was constructed.

πŸ’œ MEMBER FUNCTION πŸ’œ

  • echo(EchoType type) β€” /Dev/tty's state is set according to the EchoType value that's passed to this member.

⭐ EXAMPLE ⭐

ok here's the whole thing, copy it, it's cute:

#include <iostream>
#include <string>

#include <bobcat/tty>

using namespace std;
using namespace FBB;

int main()
{
    cout << "Enter some text (not echoed): " << Tty(Tty::OFF);
    string line;
    getline(cin, line);
    cout << "\n"
            "You entered: `" << line << "’\n";

    cout << "Enter some text (echoed): ";
    getline(cin >> Tty(Tty::ON), line);
    cout << "You entered: `" << line << "’\n";
}

🌸 FILES 🌸

bobcat/tty β€” defines the class interface


πŸ‘€ SEE ALSO πŸ‘€

bobcat(7), onekey(3bobcat)


πŸ’€ BUGS πŸ’€

None Reported.

(yes bestie, none. we ate. πŸ“)


🫢 BOBCAT PROJECT FILES 🫢

Debian Bobcat project files:

  • libbobcat6 β€” debian package containing the shared library, changelog and copyright note;
  • libbobcat-dev β€” debian package containing the static library, headers, manual pages, and developer info;

πŸ‘‘ BOBCAT πŸ‘‘

Bobcat is an acronym of Brokken’s Own Base Classes And Templates. iykyk 🌈


This is free software, distributed under the terms of the GNU General Public License (GPL).


πŸ’Œ AUTHOR πŸ’Œ

Frank B. Brokken (f.b.brokken@rug.nl).


ok and that's a wrap bestie, this was libbobcat-dev_6.15.01, dated 2005-2026, and the page is literally called FBB::Tty(3bobcat). go forth and control those echoes, you absolute icon πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from