Commit graph

400 commits

Author SHA1 Message Date
Till Mayer
02e787f8a4 aplay: Fixed incomplete playback of files
aplay used to quit as soon as the last enqueue of new buffer data
was sucessful. Because the connection closes as soon as the
application quits, samples were still in the buffer of the
ASBufferQueue as playback was halted.
2019-10-19 20:05:13 +02:00
Andreas Kling
850955053f LibHTML: Rename Document::normalize() to fixup() and always do it
Node.normalize() is a standard DOM API that coalesces Text nodes.
To avoid clashing with that, rename it to fixup().

This patch also makes it happen automagically as part of parsing.
2019-10-09 18:54:34 +02:00
Andreas Kling
ee64d99a96 LibHTML: Make StyleResolver responsible for loading the default style
Instead of HtmlView clients having to worry about parsing and loading
the default CSS, just take care of it inside StyleResolver.

The default style is automatically inserted into the stylesheet list,
at the very start, so everyone else gets a chance to override it.
2019-10-05 09:02:29 +02:00
Andreas Kling
8f45a259fc ByteBuffer: Remove pointer() in favor of data()
We had two ways to get the data inside a ByteBuffer. That was silly.
2019-09-30 08:57:01 +02:00
Andreas Kling
3900eebf15 FileManager+LibGUI+html: Add an icon to represent HTML files
This also becomes the app icon for the little "html" program. :^)
2019-09-29 21:00:41 +02:00
Andreas Kling
8d822ff82b html: Set the window title based on the HTML document's title
If the loaded document has a <title>, we now show that in the app's
window title bar! :^)
2019-09-29 16:26:28 +02:00
Sergey Bugaev
6ec625d6f3 Userland+LibHTML: Add the html command
This is a simple command that can be used to display HTML from a given
file, or from the standard input, in an HtmlView. It replaces the `tho`
(test HTML output) command.
2019-09-28 18:29:42 +02:00
Sergey Bugaev
36eea6c04b Userland: Add a man command 2019-09-28 18:29:42 +02:00
Sergey Bugaev
3089b539f0 Userland: Add an md command
This command uses LibMarkdown to parse and render Markdown documents
either for the terminal using escape sequences, or to HTML. For example,
you can now do:

$ md ReadMe.md

to read the Serenity ReadMe file ^)
2019-09-28 18:29:42 +02:00
Sergey Bugaev
2e80b2b32f Libraries: Add LibMarkdown 2019-09-28 18:29:42 +02:00
Conrad Pankoff
b03a0534e0 Userland: Add disk_benchmark program to test read/write speeds 2019-09-28 09:29:10 +02:00
Andreas Kling
797e132d0c ifconfig: Allow setting an adapter's IPv4 address
You can now do things like "ifconfig e1k0 192.168.1.2" to set the
IPv4 address of e1k0. Pretty neat!
2019-09-23 19:06:53 +02:00
Andreas Kling
87e768f0e3 Userland: Unbreak "copy" and "paste" after GEventLoop removal
Have these programs instantiate a GApplication to ensure they get a
connection to the WindowServer, otherwise the clipboard will not work.

Sorry Sergey! :^)
2019-09-23 09:36:25 +02:00
Andreas Kling
34d0e96aec LibCore+LibGUI: Remove GEventLoop and use CEventLoop everywhere
GEventLoop was just a dummy subclass of CEventLoop anyway. The only
thing it actually did was make sure a GWindowServerConnectionw was
instantiated. We now take care of that in GApplication instead.

CEventLoop is now non-virtual and a little less confusing. :^)
2019-09-22 20:50:39 +02:00
Andreas Kling
bc319d9e88 LibCore: Make CObject reference-counted
Okay, I've spent a whole day on this now, and it finally kinda works!
With this patch, CObject and all of its derived classes are reference
counted instead of tree-owned.

The previous, Qt-like model was nice and familiar, but ultimately also
outdated and difficult to reason about.

CObject-derived types should now be stored in RefPtr/NonnullRefPtr and
each class can be constructed using the forwarding construct() helper:

    auto widget = GWidget::construct(parent_widget);

Note that construct() simply forwards all arguments to an existing
constructor. It is inserted into each class by the C_OBJECT macro,
see CObject.h to understand how that works.

CObject::delete_later() disappears in this patch, as there is no longer
a single logical owner of a CObject.
2019-09-22 00:25:25 +02:00
Andreas Kling
8d550c174e LibCore: Convert CFile to ObjectPtr 2019-09-21 20:50:06 +02:00
Andreas Kling
c83da29a9d LibCore: Convert CLocalSocket to ObjectPtr 2019-09-21 15:25:08 +02:00
Sergey Bugaev
72acccb051 Userland: Add copy and paste commands
You can now copy into the system clipboard like this:
  $ copy hello friends
or like this:
  $ copy < ReadMe.md
or like this:
  $ copy --type png < /res/wallpapers/sunset-retro.png

And paste just with
  $ paste
or to view the copied type:
  $ paste --print-type
2019-09-17 21:56:42 +02:00
Tim Morgan
bc23db2c71 Add stdin support to wc program 2019-09-12 07:47:19 +02:00
Andreas Kling
f89944e804 Inspector+LibCore+rpcdump: Rework the RPC stuff to be request/response
RPC clients now send JSON-encoded requests to the RPC server.
The connection also stays alive instead of disconnecting automatically
after the initial CObject graph dump.

JSON payloads are preceded by a single host-order encoded 32-bit int
containing the length of the payload.

So far, we have three RPC commands:

    - Identify
    - GetAllObjects
    - Disconnect

We'll be adding more of these as we go along. :^)
2019-09-11 21:19:23 +02:00
Andreas Kling
8c8fecd6bf rpcdump: Don't call CSocket::connect() before setting up hooks 2019-09-11 19:56:04 +02:00
Andreas Kling
825fa3463c ls: Add -h (human readable) output switch
Fixes #543.
2019-09-11 18:59:13 +02:00
Aaron Malpas
fe1ab7989f cp: Implement directory copying
Recursive copying is only allowed if cp is called with the -r switch, ala POSIX.
2019-09-07 16:54:49 +02:00
Aaron Malpas
86415acd6a cp: Refactor copying into copy_file function 2019-09-07 16:54:49 +02:00
Aaron Malpas
4bc6c20091 cp: Use LibCore/CArgsParser for command-line arg parsing 2019-09-07 16:54:49 +02:00
Andreas Kling
73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.

Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
2019-09-06 15:36:54 +02:00
Andreas Kling
127e1e0077 wc: Add missing newlines to some error messages 2019-09-01 15:32:09 +02:00
Brandon Scott
23e8715022 Userland: Add 'which' command (#497)
This mimics the shell's path resolution to locate the executable that
would execute if typing it as a command.
2019-08-29 06:23:22 +02:00
Sergey Bugaev
e1a6f8a27d LibThread: Introduce a new threading library
This library is meant to provide C++-style wrappers over lower
level APIs such as syscalls and pthread_* functions, as well as
utilities for easily running pieces of logic on different
threads.
2019-08-26 11:31:14 +02:00
Rok Povsic
e36b9635df Userland: Add realpath 2019-08-25 19:47:37 +02:00
Andreas Kling
11f88a78ad Userland: Remove unnecessary output from "rm" 2019-08-24 13:34:52 +02:00
Conrad Pankoff
bcd214c29d Userland: Fix ifconfig use of /proc/net/adapters 2019-08-21 16:57:31 +02:00
Andreas Kling
de87258b4f Userland: Remove immature "tc" and "uc" programs in favor of "nc"
The netcat-lite "nc" utility is where we should put all of the various
"lightweight" TCP/UDP client features.
2019-08-21 16:49:11 +02:00
Andreas Kling
9731bff44c ls: Sort the output alphabetically
Also use StringBuilder to construct the full relative paths, to get rid
of an unnecessary and suspicious-looking buffer.
2019-08-20 21:39:01 +02:00
Andreas Kling
029786e6b5 ls: Don't layout or colorize output if stdout is not a TTY 2019-08-20 21:06:44 +02:00
marprok
d4b7b92492 Userland: ls division by zero.
When the terminal app window became smaller than the longest filename,
a division by zero occured while calculating the offset.
2019-08-20 20:17:10 +02:00
Marios Prokopakis
91c79440a1 Userland: Improved the printing of the ls command. (#468)
The ls command takes into consideration the length of the largest
filename when it prints a line.

Fixes #432.
2019-08-19 16:37:21 +02:00
marprok
338ba238ca Userland: Implemented a simple cut command.
The current version supports only the -b list option for a single file.
Ranges are also supported.
2019-08-18 17:17:06 +02:00
Sergey Bugaev
9dfcbc58ec Userland: Reimplement the mount command
This new version can do three things:

* When invoked as `mount`, it will print out a list of mounted filesystem,
* When invoked as `mount -a`, it will try to mount filesystems
  listed in /etc/fstab,
* When invoked as `mount device mountpoint -t fstype`, it will mount that
  device on that mountpoint. If not specified, fstype defaults to ext2.
2019-08-17 12:07:55 +02:00
Sergey Bugaev
425c356288 Kernel+LibC+Userland: Support mounting other kinds of filesystems 2019-08-17 12:07:55 +02:00
Andreas Kling
1febd59f83 LibCore+rpcdump: Publish CObject graph to on-demand RPC socket
All programs that have a CEventLoop now allow local socket connections
via /tmp/rpc.PID and will dump a serialized JSON array of all the live
CObjects in the program onto connecting sockets.

Also added a small /bin/rpcdump tool that connects to an RPC socket and
produces a raw dump of the JSON that comes out.
2019-08-17 11:39:26 +02:00
Jesse Buhagiar
bc22456f89 Kernel: Added unmount ability to VFS
It is now possible to unmount file systems from the VFS via `umount`.
It works via looking up the `fsid` of the filesystem from the `Inode`'s
metatdata so I'm not sure how fragile it is. It seems to work for now
though as something to get us going.
2019-08-17 09:29:54 +02:00
Conrad Pankoff
c7040cee62 Userland: Use LibPCIDB in lspci to print device names 2019-08-14 13:12:54 +02:00
Conrad Pankoff
ecde025375 Libraries: Add LibPCIDB for reading PCI device information from pci.ids 2019-08-14 13:12:54 +02:00
Conrad Pankoff
99ed4ce30c Userland: Implement simple lspci command 2019-08-14 06:28:53 +02:00
Andreas Kling
7d6689055f Kernel+LibC+crash: Add mprotect() syscall
This patch adds the mprotect() syscall to allow changing the protection
flags for memory regions. We don't do any region splitting/merging yet,
so this only works on whole mmap() regions.

Added a "crash -r" flag to verify that we crash when you attempt to
write to read-only memory. :^)
2019-08-12 19:33:24 +02:00
Conrad Pankoff
e978e7543f Userland: Make sure sockaddr_len is initialised correctly in nc 2019-08-10 08:51:20 +02:00
Conrad Pankoff
fffd3a67ad Userland: Implement -l, -v, -N, -s, and -p for netcat 2019-08-08 10:32:01 +02:00
Conrad Pankoff
fbcf51f81b Userland: Implement nc command
This is a very simple version of the nc (netcat) command. It only
supports outgoing TCP connections, and has no options aside from the
target host and port.
2019-08-08 06:47:30 +02:00
Conrad Pankoff
7ed54d86d5 Kernel: Record network statistics and expose as JSON
This is comprised of five small changes:

* Keep a counter for tx/rx packets/bytes per TCP socket
* Keep a counter for tx/rx packets/bytes per network adapter
* Expose that data in /proc/net_tcp and /proc/netadapters
* Convert /proc/netadapters to JSON
* Fix up ifconfig to read the JSON from netadapters
2019-08-08 06:44:49 +02:00