Combining Postscript Files

Posted in Uncategorized on June 29, 2008 by aghoras

To merge postscript files:

gs -sDEVICE=pswrite -sOutputFile=output.ps -dNOPAUSE -dBATCH file1.ps file2.ps file3.ps

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

Self installing bash script

Posted in Linux on March 18, 2008 by aghoras

Here’s bash script that can be added to a compressed tar file to create a single image extractor/installer. To create the final image, simply create a compressed tar file and concatenate it with this script. Don’t forget to set the read and execute bits.

cat install_script.sh.in my_tar_image.tar.gz > install_script.sh
chmod a+r+x install_script.sh

Here is the script. Remove the gif extension. Make sure there is new line character after the %%%% delimiter:

Fedora Core 8 Mirror List

Posted in Linux with tags on February 26, 2008 by aghoras

The yum repositories for Fedora Core 8 (FC8) are installed via the fedora-release-8-5.noarch.rpm package. The package itself can be downloaded from any of the sites listed at http://mirrors.fedoraproject.org/publiclist.

Big Endian Little Endian bit fields

Posted in Programming on February 21, 2008 by aghoras

For big endian machines (e.g. Motorola) :

typedef union{
   struct{
      uint32_t MSB       :1;
      .
      .
      .
      uint32_t LSB       :1;
   }_bit;
   uint32_t _word
} typename_t;

For little endian machines (e.g. Intel):

typedef union{
   struct{
      uint32_t LSB       :1;
      .
      .
      .
      uint32_t MSB       :1;
   }_bit;
   uint32_t _word
} typename_t;

How to get cpu info on Solaris

Posted in Solaris on January 9, 2008 by aghoras

Use prtdiag to get hardware information on Solaris.