Skip to content

Commit

Permalink
Make job id numbering start from 1, not 0
Browse files Browse the repository at this point in the history
darcs-hash:20060428132137-ac50b-8e5adcdbc18ad7627b66e9129a13b037a669dd02.gz
  • Loading branch information
liljencrantz committed Apr 28, 2006
1 parent 445f653 commit d690a15
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,16 +421,18 @@ static int find_process( const wchar_t *proc,
{

int jid = wcstol( proc, 0, 10 );

j = job_get( jid );
if( (j != 0) && (j->command != 0 ) )
if( jid > 0 )
{

j = job_get( jid );
if( (j != 0) && (j->command != 0 ) )
{
result = malloc(sizeof(wchar_t)*16 );
swprintf( result, 16, L"%d", j->pgid );
al_push( out, result );
found = 1;

{
result = malloc(sizeof(wchar_t)*16 );
swprintf( result, 16, L"%d", j->pgid );
al_push( out, result );
found = 1;
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ int proc_get_last_status()

job_t *job_create()
{
int free_id=0;
int free_id=1;
job_t *res;

while( job_get( free_id ) != 0 )
Expand All @@ -204,7 +204,7 @@ job_t *job_create()
job_t *job_get( int id )
{
job_t *res = first_job;
if( id == -1 )
if( id <= 0 )
{
return res;
}
Expand Down
2 changes: 1 addition & 1 deletion proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ job_t *job_create();

/**
Return the job with the specified job id.
If id is -1, return the last job used.
If id is 0 or less, return the last job used.
*/
job_t *job_get(int id);

Expand Down

0 comments on commit d690a15

Please sign in to comment.