unix

UNIX/OSX version of semtimedop

GLibC has a method semtimedop which allows you to perform an operation (a semaphore acquire in this case) which times out after a certain amount of time. Win32 also provides WaitForSingleObject which provides similar functionalty. As far as I can see there is no equivalent on OSX or other Unices. Can you suggest either the equivalent fo...

how to deal with a Server close TCP.

Right now I've got a simple TCP server/client. I have it set up so that whenever a client connects it gets forked() and the connection itself is put into an infinite loop so that the connection stays open. The server is receiving information from the client, I have a check to make sure that the number of bytes received is > 0. That has b...

need to create a shell script or a command in unix which can do the following process(command will be preferred)

at the following path \\ncsusnasent02.na.jnj.com\its_diq_na_win_dev\PowerCenter\infa_shared\WCPIT_BIO_EDW\SrcFiles\DDDMD\DDD.CLI026.WK0933.DDDMR45.001.head I have one file DDD.CLI026.WK0933.DDDMR45.001.head if i open this file i get data as following(in a single line) HEADER0101IMS HEALTHDMD Weekly D DD.CLI026.WK0933.DDDMR4...

Shared Memory Semaphore

Hi, I have 10 processes running, each writing to the same file. I don't want multiple writers, so basically I am looking for a mutex/binary semaphore to protect file writes. The problem is I can't share the semaphore amongst 10 processes, so I am looking at using shared memory between 10 processes, and putting the semaphore inside share...

Post to Twitter using Terminal with CURL

I got this far: :~ curl -u username:password -d status="new_status" http://twitter.com/statuses/update.xml Now, how can I alias this with variables so I can easily twit from Terminal? How can I make the alias working through different sessions (when I close Terminal aliases reset). Thanks! ...

(sun)RPC auth_unix

Im implementing my own RPC framework and well moste of the stuff is done but i need some help how do i verify a auth_unix? the structure of the data is definied in http://www.faqs.org/rfcs/rfc1050.html 9.2 UNIX Authentication but how should i verify the user? ...

PATH and programmatic usage?

In programmatic usage of CLI commands (in Java on Linux), would you rely on these commands being on the PATH, or specify the absolute path of each command in the code? Different for "standard" commands, e.g. "ls", vs. non-standard commands? Addendum: By "in the code" I didn't mean "hard-coded". Having the the commands' paths config...

Which code set is /etc/passwd stored in? Can it be UTF-8? What limits are placed on user names?

On a modern Unix or Linux system, how can you tell which code set the /etc/passwd file stores user names in? Are user names allowed to contain accented characters (from the range 0x80..0xFF in, say, ISO 8859-1 or 8859-15)? Can the /etc/passwd file contain UTF-8? Can you tell that it contains UTF-8? What about the plain text of passwo...

What is the best way for C# app to communicate unix c++ app

the ways I can think of Web service or soap Socket Database table shared file Any concise example you know of for webservice? ...

Unix-style tools on Windows?

At work (a mostly Unix development shop), I've had an OS X box for the past 1.5 years and a Linux box before that. Due to various circumstances, I'll be getting a Windows XP laptop in the next few weeks. I'm of mixed feelings about this - it's good in that, as a manager, I'm used to running a Windows install (via Parallels) for Excel, Ou...

What is the easiest way to expand HTML escape codes in UNIX?

My cUrl call is returning HTML code like: "Some stuff." and I'd like to convert it to a UNIX string like: "Some stuff." Is there a way to do this without using search and replace? ...

Deep dark secrets of Emacs?

Possible Duplicate: The single most useful Emacs feature So, there is this question for Vim users that keeps popping up in my feed reader, but I'm an Emacs person. So, what are some of the cool little hacks and tricks you've come up with using Emacs? And like the Vim thread, I'm talking about the things that only a very few ...

Need to implement in unix following thing

there is one variable var=581 we need to copy the value of this variable at following address(location) and value should appear in front of $$DRM45_RowCount \ncsusnasent02.na.jnj.com\its_diq_na_win_dev\PowerCenter\infa_shared\WCPIT_BIO_EDW\PrmFiles\LND\IMS_FILE_to_LND.par when I open this file IMS_FILE_to_LND.par it has data as follow...

How to search for a pattern inside a file and delete the lines in Unix on the command line?

I need to search for a pattern in files. For example the content of the file is below: 3555005!K!00630000078!C!20090805235959!47001231000000!16042296!336344324!A!1!ENG!0!00630000078!NO!00630000078! 3555005!K!204042880166840!I!20090805235959!47001231000000!16042296!336344324!A!1!ENG!0!00630000078!NO!00630000078! 3555005!D!16042296!DUMMY...

Is there any way to synchronize parent and child in C using one pipe in Unix?

Suppose both parent and child use one pipe for writing and reading means when one writes then only other read otherwise it blocks. Is there any way to do it? I tried to do it with sleep function but due to race conditions, it does not give the correct output. This is my code #include <stdio.h> #include <stdlib.h> #include <string.h> #i...

awk gives the following error

"awk: Function systime is not defined." but systime is a built in command ...

Ruby gem for unix 'at' command

I've found the whenever gem quite useful for working with cron from Ruby. Does anyone know of a similar project for at/batch? ...

Delete a line with a pattern

Hi I want to delete a line from a file which matches particular pattern the code I am using is BEGIN { FS = "!"; stopDate = "date +%Y%m%d%H%M%S"; deletedLineCtr = 0; #diagnostics counter, unused at this time } { if( $7 < stopDate ) { deletedLineCtr++; } else ...

A doubt on pipes in Unix

This code below is for executing ls -l | wc -l. In the code, if I comment close(p[1]) in parent then the program just hangs, waiting for some input. Why it is so? The child writes output of ls on p1 and parent should have taken that output from p0. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #includ...

How can I calculate the date preceeding a given date in unix?

I have two variables: X and Y. The value of X will be a date given in the format mmddyy and I want to calculate the date preceeding that date and have it be returned in in the format yyyymmdd. Let me give you an example. When X="091509" (mmddyy format) Y should be "20090914" (yyyymmdd format) ...