Archive for April, 2008

Astyle options

Posted in Uncategorized on April 23, 2008 by aghoras

here are my astyle options
astyle –convert-tabs –style=kr -p -s 4 file.cpp

using aspell to check C++ files

Posted in Uncategorized on April 23, 2008 by aghoras

Here are the options I use to check a file:

aspell check –mode=ccpp –run-together Std1200Intf.cpp

Here’s one liner to do a spell check on all the source files in the current directory:

find . -name ‘*.h’ -or -name ‘*.cpp’ | xargs -L 1 xterm -e aspell check –mode=ccpp –run-together

Script to recursively add all the files and directories to clearcase

Posted in Uncategorized on April 15, 2008 by aghoras

Script to add all the elements under the current directory to clearcase. The current directory must aleardy be under clearcase.

#!/usr/bin/bash
CLEARTOOL=”cleartool”

echo Checking out current directory…
$CLEARTOOL co -nc .
echo
echo
echo
echo “******************************”
echo Adding all directories…
echo
for i in `find . -type d`; do
echo Adding $i …
$CLEARTOOL mkelem -nc $i
echo
done

echo
echo
echo
echo “******************************”
echo “Adding files ….”
echo
for i in `find . -type f`; do
echo “Adding $i …”
$CLEARTOOL mkelem -nc $i
$CLEARTOOL ci -nc $i
echo
done

echo
echo
echo
echo “******************************”
echo “Checking in directories…”
echo
for i in `find . -type d`; do
echo Checking in $i …
$CLEARTOOL ci -nc $i
echo
done

static functions in pthread_create() using solaris compiler

Posted in Programming on April 9, 2008 by aghoras

Create a C function to basically do the conversion from static to extern “C” for you:

extern “C” int CreateThread( pthread_t*& pThread, CVoidFunction pVoidFunction, void* pArgument )
{
// Create the thread
const int nResult = pthread_create( pThread,
(const pthread_attr_t*)0,
(void*(*)(void*))pVoidFunction, // cast to extern “C” void* (*)( void* )
pArgument );

return nResult;
}

GCC Compiler defines

Posted in Programming on April 8, 2008 by aghoras

gcc -E -Wp,-dD hello.c |grep \#define |sort