Show Bid Request
Unix Project #2
Bid Request Id: 38265
|
|
|
Posted by: |
rail1818 (1 ratings)
(Software buyer rating 10)
|
Non-action Ratio: |
Very Good - 0.00%
|
Posted: |
Dec 4, 2002 10:47:05 AM EDT
|
Bidding Closes: |
Dec 7, 2002 10:47:47 AM EDT
|
Viewed (by coders): |
167 times
|
Deadline: |
12/9/2002
TIME EXPIRED
|
|
|
|
Description:
Problem:
c. Name your program as find_path.c
d. The objective is to locate executable programs and to display their pathname.
e. A given argument will be examined along the user&'s path or default shell variable #PATH. To get the variable PATH, you need to use:
getenv (“PATH”);
f. the path is a list of directories separated by “:”. To obtain a directory component, you may want to use strch to split the string.
g. The suggested procedure is following:
To use chdir, opendir, and readdir in sequence, so you can examine the contents of a directory.
Examine each filename if it is matched the given command, then stop the search and print out the pathname of the command by attaching the filename to the directory name.
If no filenames are matched, then the next directory in line will be picked and redo the search.
h. System calls, such as opendir (), readdir (), and getcwd (), may be needed. However, system calls such as system (), fork (), exec (), unlink () and write () are not allowed.
Recommended Pseudo-Codes:
#include <sys/stat.h>
#include <dirent.h>
main (int argc, char * argv[] {
/* check argument */
char *path;
path = getenv (“PATH”);
/* get argument cmd */
xopendir (path);
xopendir (char *path) {
char *ptr;
if ((ptr=strchr(path, ‘: ‘)) !=NULL)
*ptr= 0;
if (stat(path, &stbuf.mode&S_IFMT != S_IFDIR) {
if(ptr 1=NULL) xopendir(ptr+1);
else return;
}searchdir(char *path) {
DIR *dirp; struct dirent *dp;
chdir (path);
dirp = opendir (“.”);
While ((dp =readdir (dirp)) !=NULL) {
if(dp->d_ino == 0 || !dp -> d_name [0] ) continue;
stat (dp ->d_name, &stbuf);
if (!strcmp (cmd, dp->d)name) {
/* Check executable permission */
/* Print out the pathname or continue the loop */
}
}
closedir (dirp);
/* if not found return 0 otherwise 1 */
}
Synopsis: find_path command1 command2…
Submit: the screen shot of your program
Verify your program can be compiled and executed in NJIT&'S AFS system.
If you use gcc compiler, the first line of your program should read as
// Define gcc
If you use c++ compiler, the first line of your program should read as
//define c++ or //define g++
Deliverables: 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.
3) Complete ownership and distribution copyrights to all work purchased.
Platform:
UNIX
Must be 100% finished and received by buyer on:
Dec 9, 2002 EDT
Deadline legal notes: All times are expressed in the time zone of the site EDT (UT - 5). If the buyer omitted a time, then the deadline is 11:59:59 PM EDT on the indicated date.
Special Conditions / Other:
I need it done ASAP!
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
This bid was accepted by the buyer!
|
$13 (USD)
|
Dec 4, 2002 11:17:22 AM EDT
|
8.44
(Very Good)
|
|
|
|
|
|
|
|
|