Programming :: Unable To Use An Alias In The Ksh Functions
Apr 4, 2011
I have problem to use an alias that defined in ksh93 script,in the functions in the same script onm Linux.I definied an alias in main: alias echo='echo -e' in order that echo will read backslashes but when i executed it in function, the alias didnt work, and performewd a regular echo, without -e
cat test.ksh
#!/bin/ksh
alias echo='echo -e'
checkUsage
[code]....
View 1 Replies
ADVERTISEMENT
Oct 11, 2009
I wrote a multithread program(c++,gnu gcc). it contains a main program and plugins. some functions in plugins use sleep(). Using these functions in threads cause freezing program. in other word thread sleeps but dosn't wake. How can i use sleep() in my plugin functions without this problem?
View 3 Replies
View Related
Mar 11, 2010
Is it possible to define functions within other functions in C++? I know it is the case in other languages.
View 2 Replies
View Related
Apr 11, 2011
I need help as I am not proficient with Linux C++ Programming. There are two parts which I need to do in the coding provided below.
1. Produce the program so it can output the word "Hey there!" and wait two minute and print the word "See you later!".
2. Produce the program that will output the text "Cool" every 20 seconds by setting a periodic task.
Quote:
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
int init_module(void)
{
printk("Hey there!
[Code]...
View 3 Replies
View Related
Mar 19, 2011
None of my daemon scripts work now, and the startup process displayed errors. Should I reinstall the OS and start from scratch, or is there a way to recover these files? Is there a way to rebuild the files I deleted?
View 2 Replies
View Related
Dec 24, 2009
Code:
#!/bin/bash
#Functions
CallFunct() {
functio()
[code]....
When I try to run the current code, it stops on the bracket after functio() in CallFunct(). The only way I could get this to run was by removing CallFunct and just calling functio.
View 3 Replies
View Related
May 1, 2010
I want to create an alias or function that when used prints something like this on the command line so I can further modify it before pressing enter myself.
Code:
$ FILE=exercise1; cc -o $FILE $FILE.c && ./$FILE; FILE=
The idea is that I'm studying c and want to change the name of the file once instead of
[code]....
View 3 Replies
View Related
Mar 26, 2011
could you please explain few questions about systemtap.
1st
===
seems gettimeofday_s() always returns 0 Code: stap -ve 'probe timer.s(4){ printf("%d ",
[code]....
View 2 Replies
View Related
Jul 15, 2010
I am trying to execute executable files in bash without adding ./ I know there must be an alias to add in .bashrc, that must be something like alias PATH=$PATH:. But this seems not to be working.
View 1 Replies
View Related
Jul 6, 2011
alias and shopt won't work in script
[Code]....
View 9 Replies
View Related
Apr 24, 2010
Where are the definitions for C library functions located? It was just recently that I realized that header files don't actually define any functions, they merely include their prototypes.
For instance, stdio.h includes the following line:
Code:
This just means that the definition of printf() is located in another file. What file? Is there some kind of default shared object file that is automatically included during compilation?
View 2 Replies
View Related
May 15, 2011
have an application where from time to time I need to check the db for some value and run some functions to do some checks. is the best option do it as php daemon or cron job?Whatworried of cron job is the overalapping.
View 9 Replies
View Related
Aug 12, 2010
But what is the difference between this...
Code:
my_fucnction () {
echo "Hello World"
}
Code:
function my_fucnction {
[Code]...
View 10 Replies
View Related
Jan 4, 2011
Im implementing a chat application using Jabber/XMPP and gloox framework which should send and receive messages concurrently in Ubuntu Linux.
The problem faced is both the threads are created and pthread_join( ) is called for both.The iSend thread is scheduled first but gets suspended at cin. Once the recv( ) function is called, which runs in iRecv thread, the recv call back function handleMessage( ) is called. However the control never shifts back to the iSend thread which should call SendMessage( ) function.
View 1 Replies
View Related
Apr 12, 2010
I am trying to write a simple program in C that involves nesting switches. For example switch 1 offers an option to go to module 1 or 2 or quit. when I go to module 1 there is another switch function offering two or more choices.
I can select either module 1 or 2 at the start of the program and the selection text for, say, module 1 prints to screen but then exits without allowing a second selection to be entered.
I tried using free([first selection]) thinking that might do the trick but it doesn't.
Is it possible to next switches on after another in C?
View 14 Replies
View Related
May 9, 2010
The pthreads library on macos does not have barrier functions (pthread_barrier_t ....). Is there a way to get around this? I know I can do :
#ifdef __APPLE__
pthread_barrier_t ...
#else
my_barrier ...
#endif
But I would like to avoid this approach as there are a lot of places in my program where I would have to make this change. Can I perhaps rebuild the pthreads library on macos without affecting other apps ?
View 2 Replies
View Related
Dec 21, 2010
Let's show the problem: I have a socked connection (in a fd var). In certain moment, I need to use the same socket in two threads. Lets see in the example:
Code: int main(void)
{
int fd; // the socket
[code]....
View 9 Replies
View Related
Feb 1, 2010
I have functions which return different data like: int, char*, double...
I also have a list of datatypes (INTEGER, TEXT, REAL...) which can be returned.
I need to map a datatype with function, which purpose is to return it. Therefore, when I determine a datatype, I would like to call the required function without doing switch all the time.
My idea is to have an array of structs like this:
Code:
struct type_func_map
{
int type;
void (*func_wrapper_int)(void); //void (*func_wrapper_text)(void); void (*func_wrapper_real)(void);
};
[Code].....
View 10 Replies
View Related
Apr 11, 2011
I feel like there should be a cleaner way of doing this. I have one file, for example "a.cpp", calling a function from another file, "b.cpp". Currently I have it set up so that header for "b", "b.h", has the declaration of its functions. And then I'm just including "b.h" in "a.cpp". Do I have to include the "b" header file in "a" to be able to call a function from "b"? Or is there a better way I could be doing this? Like doing something different at compile?
View 7 Replies
View Related
Jun 24, 2011
I've encountered a problem when running a simple bit of code, I'm using c to read write data to a binary file. It works fine when I run as root. However when I run as a user it produces the file, however when I try to open / write after it's produced it caused a seg fault. Is there any reason file functions ( fopen etc ) would work for root and not a user and is there a way to fix this?
View 14 Replies
View Related
Feb 5, 2010
I'm trying to call some kernel functions from userspace, but I'm not sure if I'm doing it right. The functions control a pulse width modulator on an embedded platform. To pick one at random, the function:
Code:
struct pwm_device *pwm_request(int pwm_id, const char *label);
is defined in linux/pwm.h, and the implementation uses the macro EXPORT_SYMBOL(pwm_request), so I should be able to call this from user-space... right?
Anyway, I've got linux/pwm.h to #include in my source so the compiler knows what it's doing, but what do I link against? The only place in by kernel build tree where I can see a symbol pwm_request defined is in object files like vmlinux.o, built-in.o in the directory, etc. which I don't think I should be linking against.
View 2 Replies
View Related
Aug 2, 2010
My distribution is Fedora 12. When I want to get the infos of kernel functions such as printk, i type man printk, failed. I look up some articles and learn that in some distributions the kernel functions is in section 9 of man page. Then i type man 9 printk also no reply. How can i get man pages of kernel functions ?
View 2 Replies
View Related
Jun 7, 2011
So if you are a PHP-programmer (average one) and code for money, how many of funtions and operators of PHP should you remember by heart (in real life)? I was looking through php.net and man there are millions of tons of them!
View 9 Replies
View Related
Feb 12, 2011
I have created a glade file which so far have two regions in it:
1) On the right division is a toggle button which calls a C script when enabled.
2) I have a drawing area, in which I would like to plot a point (X-Y scatter plot). The plot should be generated dynamically using a C script. I am not sure how the integration between the two is possible for a drawing area.
In glade what properties of drawing area should I set? eg.expose event, realize etc. I was thinking of using cairo for generating the plot.
View 2 Replies
View Related
Feb 27, 2010
does anybody idea how to use java functions in python script ?
View 1 Replies
View Related
Sep 29, 2009
Do you know where can I find documentation to SoundTouch library a its functions?
View 2 Replies
View Related
Aug 25, 2011
My CUPS server has hung. Doesn't ask login user/pwd any more - goes straight to admin page. When I try to add printer I get an authorisation error. So unable to do any admin functions: add printers, disable Kerberos authentication etc.
View 1 Replies
View Related
Sep 21, 2010
Okay so I have an alias that looks like this:
Code:
ALIAS sorigin {
MSG sorigin Test1
[code]...
View 1 Replies
View Related
Nov 4, 2010
So I'm teaching myself some scripting to try and create a fairly simple photobooth type affair... I've got gphoto2 playing fairly nicely with my canon, and imagemagick taking that output and rearranging it to a vertical format...
EDIT:
*smacks forehead*
Fairly simple to do what I needed initially: Code: feh -FZ -D 1 --cycle-once $COUNTDOWN & sleep 2 &
feh -FZ -D 20 --cycle-once $SMILE This shows a countdown from 5 to 1 in images and $SMILE is big that says 'smile'
So my question is thus... (fairly basic but I can't get my head round the use of & and sleep in this context) what's the best way to call my gphoto instructions (or a script with them in) mid way through the above code?!
'feh code'
sleep 5
'gphoto code'
this kind of thing seems like the way, but the'sleep 5' and 'gphoto code' doesn't start until feh is finished in this case?
View 1 Replies
View Related
Dec 6, 2010
I have a requirement, to read the complete proc filesystem from the linux pc.. Does linux provide some functions to read the proc filesystem means the directories and files present in the filesystem.. in short I want to create a treeview of proc filesystem. and if a user selects the file in the proc.. I should show the contents in the respective file. So I want some library or functions to read the proc filesystem..
View 1 Replies
View Related