Recent Notes

Displaying keyword search results 1 - 10
Created by voodoo on September 25, 2012 19:33:02    Last update: June 05, 2013 20:22:50
This a step-by-step example of how to create the files for GNU automake. Put the C source file in directory src ( cat src/hello.c ): #include <config.h> #include <stdio.h> ... Run autoscan to generate configure.scan . Rename configure.scan : mv configure.scan configure.ac Edit autoscan.ac . Update this line: AC_INIT([FULL-PACKAGE-NAME], [VERSION] , [BUG-REP... Add this line after AC_INIT : AM_INIT_AUTOMAKE([foreign -Wall -Werror]) Add this line before AC_OUTPUT : AC_CONFIG_FILES([Makefile src/Makefile]) Create file Makefile.am ( cat Makefile.am ): SUBDIRS = src Create file src/Makefile.am ( cat src/Makefile.am ): bin_PROGRAMS = hello hello_SOURCES = hello.c Run these commands: $ aclocal $ autoheader $ automake --add-miss... The file configure is generated after autoconf is run. Build with: $ ./configure $ make Create tarball for distribution with: $ make dist...
Created by Dr. Xi on April 29, 2013 09:00:48    Last update: April 29, 2013 09:00:48
In the case proposed by Diony , signing multiple elements by id, simply change the newSignedInfo to: // Create the SignedInfo final List transforms0... I must admit that I don't understand transformations, so take my example code with a grain of salt. Also, signing a doc fragment by PATH does not work, simply because there's no way to identify the fragment with a URI without referring to it by id. Reference ode from org.jcp.xml.dsig.internal.dom.DOMURIDereferencer : // Check if same-document URI and register...
Created by voodoo on March 24, 2013 13:44:47    Last update: March 29, 2013 13:08:31
Use getpwnam group of functions. Example code: #include <sys/types.h> #include <pwd.h> #inc... For gid, use getgrnam
Created by magnum on December 25, 2012 15:14:42    Last update: December 25, 2012 15:14:42
The C function strtok tokenizes a string when you call it repeated with a NULL pointer. It should be mentioned that it destroys (alters) the original string. #include <stdio.h> #include <stdlib.h> #incl...
Created by magnum on November 03, 2012 08:57:35    Last update: November 03, 2012 08:57:35
Code snippet to check user name and password in C in Linux #include <sys/types.h> #include <pwd.h> #inc...
Created by magnum on October 22, 2012 20:03:05    Last update: October 22, 2012 20:03:05
First, the test command that sleeps random number of seconds ( sleeper.sh ): #!/bin/bash stime=$[$RANDOM % 20] sleep $sti... As comparison, synchronous pipe code: #include <sys/wait.h> #include <stdio.h> #in... Asynchronous pipe code: #include <sys/wait.h> #include <stdio.h> #in...
Created by magnum on October 22, 2012 19:54:43    Last update: October 22, 2012 19:54:43
Example 1, from the pipe man page. The parent then writes the string contained in the program's command-line argument to the pipe, and the child reads this string a byte at a time from the pipe and echoes it on standard output. #include <sys/wait.h> #include <stdio.h> #in... Example 2, child execs command given at the command line, then writes to stdout (of child), which is piped to parent. Parent reads from pipe and writes to stdout (of parent). #include <sys/wait.h> #include <stdio.h> #in...
Created by magnum on October 22, 2012 15:46:44    Last update: October 22, 2012 15:46:44
Example code from the Linux Programmer's Manual: #include <stdio.h> #include <stdlib.h> #incl...
Created by voodoo on September 17, 2012 15:02:15    Last update: September 17, 2012 15:02:15
Start gdb with the executable and coredump: $ gdb <path to executable> core While in the debugger, use the following commands: (gdb) where ("shows a summary of the stack") ... Example debug session from Debugging Under Unix: gdb Tutorial : Use backtrace (or bt ) to see the callstack: (gdb) backtrace #0 Node<int>::next (this=0x0) ... Inspect the value of item_to_remove at address 0xffbef014 (the value is 1): (gdb) x 0xffbef014 0xffbef014: 0x00000001 (g... Note: The program must be compiled with the debug switch -g in order to see the source code. More resources: Linux software debugging with GDB Debugging with gdb
Created by voodoo on September 13, 2012 20:18:15    Last update: September 13, 2012 20:18:15
Allocate 2-dimensional array with one malloc/calloc. Example1: #include <stdio.h> #include <stdlib.h> i... Example 2: #include <stdio.h> #include <stdlib.h> s...
Previous  1 2 3 4 5 6 7 8 9 10 Next