Hello all, I am currently working on a package manager in C and am at the point where I am trying to check to see if the package is already installed. To do this I am taking the package name(s) as an argument using argv. The working code for doing this as follows:
This works, I have tested it with prints and everything. The issue with this is that it does not check /bin and /sbin, but rather checks the directory it is being run from. So I did some research and wrote a separate .c file to list /bin which is as follows:
this also works. The issue I am having is I can't figure out how to
A) List both /bin and /sbin
B) Check for the program in those directories (this one is the one I really need help with).
Now for checking both I figure I can say basically
If I can get B solved than A should be pretty easy. I just can't for the life of me figure it out, I would love some advice. Thank you for reading.
Edit:
Progress! Oh sweet sweet progress on this issue I have been stuck on for weeks, so after thinking with a clear head I realized my first function checks for the file and my second opens the directory. All I needed to do was combine them, so I did so and got this:
Now this always prints not found, I am still working on this but am having a hard time debugging it.
Last edited by realpath_issue; 07-04-2019 at 08:23 PM..
Reason: added updated code (still a work in progress)
Hello,
I create a file touch 1201093003 fichcomp
and inside a repertory (which hava a lot of files) I want to list all files created before this file :
find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long
but i make a filter all... (1 Reply)
hi there,
Would you able to advise that why the syntax or statement below couldn't work as expected ?
/usr/bin/find /backup -name "*tar*" -mtime +2 -exec /bin/rm -f {} \; 1> /dev/null 2>&1
In fact, I was initially located it as in crontab job, but it doesn't work at all. So, I was... (9 Replies)
Hello,
When i run a bash script on ubuntu i get this message..
#!/bin/bash cannot find file or directory...
Can anibody help me with this, because the file actually exists....
Is there any extra configuration to be made? (5 Replies)
I'm trying to compile sudo on RHEL 4.8 and during the make I get the this error. Does anyone know what package I'm missing?
gcc -o sudo sudo_auth.o pam.o mkstemps.o ldap.o exec_pty.o get_pty.o iolog.o audit.o boottime.o check.o env.o exec.o getspwuid.o gettime.o goodpath.o fileops.o find_path.o... (2 Replies)
All of my machines (various open source derivatives on x86 and amd64) store argv above the stack (at a higher memory address). I am curious to learn if any systems store argv below the stack (at a lower memory address).
I am particularly interested in proprietary Unices, such as Solaris, HP-UX,... (9 Replies)
I am installing lxml module for python on redhat
I have installed libxml2 already.
When I run for libxslt:
./configure --prefix=libxslt_folder --with-libxml-prefix=libxml2_folder
It is ok
the I run :
make
I have error:
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
I... (4 Replies)