Skip to main content

Questions tagged [unix]

Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs.

3 votes
0 answers
133 views

Copy a file portably across UNIX and UNIX-like systems with POSIX API (modeled after Boost's copy_file())

Overview: Following the POSIX API, there are 2 versions of the function: unix_copy_file(), and unix_fcopy_file(). One works with ...
Harith's user avatar
  • 9,462
7 votes
2 answers
712 views

Wrappers around write() and read() and a function to copy file permissions

Below follows wrappers around read() and write() that retry when interrupted by a signal (the case where the return value is -1 ...
Harith's user avatar
  • 9,462
1 vote
0 answers
39 views

Determining the value of PATH_MAX on UNIX-like systems

Below is the approach taken in the function allocpath() in the book "Advanced Programming in Unix Environment", which I have modified to simply determine ...
Harith's user avatar
  • 9,462
3 votes
2 answers
104 views

Get Terminal Size, Enable and Disable Terminal Raw Mode without NCURSES

I searched around and found these 7 ways to determine the width and height of the terminal: ...
Harith's user avatar
  • 9,462
3 votes
3 answers
340 views

Append Buffer for Buffering Small write(2) Calls

The purpose of this is written in the comment below (it is meant to be used in a text editor): abuf.h: ...
Harith's user avatar
  • 9,462
4 votes
2 answers
81 views

Find the Size of a File in a Portable Manner (revision)

This is a follow up to Find the Size of a File in a Portable Manner. What's new: The fast version (POSIX stat()) does not change the position indicator of the ...
Harith's user avatar
  • 9,462
5 votes
2 answers
954 views

An Implementation of UNIX wc shell utility

The implementation doesn't support the "-m" flag, and only works with ASCII, and has rather terrible output formatting in comparison with GNU's implementation of wc. Code: ...
Harith's user avatar
  • 9,462
4 votes
1 answer
180 views

Find the Size of a File in a Portable Manner

There's no function in the Standard C Library to determine the size of a file. The POSIX Standard has stat()/fstat() which are ...
Harith's user avatar
  • 9,462
9 votes
3 answers
2k views

Executing a shell command OS-independently

The goal of the code is to convert a Graphviz DOT file to an SVG file, and it achieves this by creating a child process and executing the "dot" command. ...
Harith's user avatar
  • 9,462
2 votes
1 answer
182 views

minitalk project using Rust | Communication between process using UNIX Signals

I am trying to build minitalk project from 42 school using Rust instead of C. This is a communication program between a client and a server. Both are process. To achieve this I am only allowed to use ...
byk's user avatar
  • 21
2 votes
2 answers
151 views

Wait for child while polling file descriptor with self-pipe controlled by different threads

I am working on a personal project, and one of the things it does is to call a blocking operation on a file descriptor while a forked+exec'ed child process is running. It needs to know when the ...
Seninha's user avatar
  • 171
3 votes
3 answers
140 views

Follow up: A chat server using the select() API

This is a follow up to my last question: Multiperson chat server using the select() API Changes: After much fine critique, I made the following changes to the code: Removed redundant casts and ...
Harith's user avatar
  • 9,462
11 votes
2 answers
1k views

Multiperson chat server using the select() API

I followed the Beej's Guide to Network Programming. The program acts like a multi-user chat server. One connects and sends a message to the server, which is forwarded to all that are connected. There'...
Harith's user avatar
  • 9,462
1 vote
1 answer
31 views

Multistage Dockerfile to build a C project and copy things over to second stage

I wrote this Dockerfile (multi-stage) where the first stage builds the project and in the second stage we just copy the stuff over. I am wondering can I please get some feedback? more specifically the ...
Node.JS's user avatar
  • 389
4 votes
1 answer
93 views

Recursively Copy Dotfiles from Git Repo to New System's Home Directory

I manage my dotfiles in a github repo. The idea would be that I could clone the repo if I ever have to develop on a new system and symlink them to the home ...
Jordan Mandel's user avatar

15 30 50 per page
1
2 3 4 5
9