Mail Archives: cygwin/1999/08/24/09:28:20
--=_-=_-EGNGNPHNEIINBAAA
Content-Type: text/plain; charset=us-ascii
Content-Length: 1332
Content-Transfer-Encoding: 7bit
I just loaded cygwin onto my computer and I have
several questions.
1) is there a way to make a case insensitive file mask?
For example, my c source files appear as a mixture of
.c and .C suffixes. ls *.c returns a different set of
files than ls *.C
2) How does bash search for commands? I am used to DOS/
Windozs programming, where the dos command prompt
searches the path. When I am running bash however,
I must type in the full path of any executable that
I want to run. Is there some way of avoiding having
to type in the full path?
3) I would like to use cp to keep source files in
aggrement on sepparate machines. I have tried the
following command:
cp -v -u -r d:/cclib g:
where d: is a drive on my laptop, and g: is a drive
on my desktop. The problem is that the timestamps on
all the copied files are set to the current system
files. I would like the timestamps to be the same
on all the copied files. This way when I copy back
from g:
cp -v -u -r g:/cclib d:
I get only the files that I have worked on during
the day. They way things stand, all of the files
I copied in the morning are copied back a second
time. Is there a way to make the timestamps match?
Thanks in Advance,
Clark Sims
--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.
--=_-=_-EGNGNPHNEIINBAAA
Content-Type: text/plain; charset=us-ascii; name="mypg.c"
Content-Length: 2820
Content-Transfer-Encoding: 7bit
#include <stdio.h>
#include <string.h>
#include <conio.h>
void append_input( const char *npt, char *pg, int ln, int mxln, int mxwdth);
/*
assumes:
ln > 0
mxwdth > 0
strlen( npt) < mxwdth
ln < mxln
npt can't contain a newline character
changes:
characters between pg[ln*mxwdth] and pg[ln*mxwdth+strlen(npt)]
description:
appends npt to pg, at line ln
*/
void dump_input( const char *pg, int nmln, int mxln, int mxwdth, int wait);
/*
assumes:
mxln >= nmln > 0
pg contains vallid null terminated strings, with a stride of mxwdth
changes:
stdout
description:
this dumps pg to stdout
if wait is true, than getch is called, which causes
the program to pause untill a key is hit from the keyboard
*/
#define MAXWIDTH 258
char input[MAXWIDTH+1];
const char *_usage = "usage: mypg [-p=25]\n";
int main( int argc, const char* argv[])
{
int p=25, i;
char *pg, *pinput;
if (argc > 1)
{
if (argc!=2)
{
goto usage;
}
if (memcmp( argv[1], "-p=", 3) != 0)
{
goto usage;
}
p = atol( argv[1]+3);
if (p<=0)
{
printf( "p must be > 0\n");
goto usage;
}
}
pg = (char *)malloc( p*MAXWIDTH);
if (pg==NULL){
printf( "out of memory\n");
return 2;
}
i = 0;
do {
input[0] = 0;
pinput = gets( input);
if (pinput != NULL || input[0]!=0)
{
append_input( input, pg, i, p, MAXWIDTH);
i++;
}
if (i%p == 0 || pinput==NULL)
{
dump_input( pg, i, p, MAXWIDTH, pinput!=NULL);
i = 0;
}
} while (pinput != NULL);
return 0;
usage:
printf( _usage);
return 1;
}
void append_input(
const char *npt,
char *pg,
int ln,
int mxln,
int mxwdth)
{
char *funcname = "append_input";
long nptlen;
if (npt==NULL)
{
printf( "npt==NULL in %s\n", funcname);
exit( 1);
}
if (pg==NULL)
{
printf( "pg==NULL in %s\n", funcname);
exit( 1);
}
if (ln < 0)
{
printf( "ln<= in %s\n", funcname);
exit( 1);
}
if (mxln < 0)
{
printf( "mxln<= in %s\n", funcname);
exit( 1);
}
if (mxwdth < 0)
{
printf( "mxwdth<= in %s\n", funcname);
exit( 1);
}
nptlen = strlen( npt);
if (nptlen >= mxwdth)
{
printf( "strlen(input) > maxwidth in %s\n", funcname);
exit( 1);
}
strcpy( pg+ln*mxwdth, npt);
}
void dump_input(
const char *pg,
int nmln,
int mxln,
int mxwdth,
int wait)
{
int i;
if (nmln > mxln)
{
printf( "error, nmln > mxln in dump_input\n");
exit( 1);
}
for (i=0;i<nmln;i++)
{
puts( pg+i*mxwdth);
}
fflush( NULL);
if (wait)
{
getch();
}
}
--=_-=_-EGNGNPHNEIINBAAA
Content-Type: text/plain; charset=us-ascii; name="compile.bat"
Content-Length: 0
Content-Transfer-Encoding: 7bit
--=_-=_-EGNGNPHNEIINBAAA
Content-Type: text/plain; charset=us-ascii
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
--=_-=_-EGNGNPHNEIINBAAA--
- Raw text -